transhumandesign / kag-base

King Arthur's Gold base folder.
257 stars 118 forks source link

getMap().getBlobs() is broken #1549

Open mugg91 opened 1 year ago

mugg91 commented 1 year ago

Description

Blobs fetched via getBlobs(@bloblist) will give proper values, whereas Blobs fetched via getMap().getBlobs() seem to be broken as they will give garbage values.

This is the conclusion I came to after hours of researching issue #1543 (War Base crash bug) - see the comments to learn more.

Verified by placing this in Food.as:

void onTick(CBlob@ this)
{
    CBlob@[] s;
    getMap().getBlobs(@s);
    if (isServer())
    {
        if (getGameTime() % 60 == 0)
        print(s[0].getPosition()+"");
    }
}

and spawning a food, then looking at logs:

[20:37:14] (-2.26674e+23, -nan)
[20:37:16] (-2.26674e+23, -nan)
...

Only WAR_base.as uses getMap().getBlobs() so there is not much harm.

asumagic commented 1 year ago

getMap().getBlobs() is pretty much a relic from the past, back when the game was written with the assumption that CMaps could exist. This assumption has not been true for a very long time. Maybe it should just be removed entirely since there aren't any users (else they'd be super broken)...