Closed snipercup closed 2 months ago
The mobs are freed from a thread like this: https://github.com/Khaligufzel/CataX/blob/ca68b8fdea72b4ae3f75053bc677ecdd3a440a42/Scripts/Chunk.gd#L361-L365
After they are queued free, there is still time until the next frame when it's their turn to be freed. In the meantime, the map RID can already be freed.
When playing the game the error sometimes appears in the debug output
This error appears:
This is probably because an invalid map id is set in https://github.com/Khaligufzel/CataX/blob/de2c740050134c4ef6ec448875e8bde9da702933/Scripts/Mob.gd#L58-L62
We will have to do work the way the navigation agent gets it's map id.
The map id is communicated to Helper in this line: https://github.com/Khaligufzel/CataX/blob/de2c740050134c4ef6ec448875e8bde9da702933/Scripts/Chunk.gd#L70
The helper will set the navigationmap id to it's variable: https://github.com/Khaligufzel/CataX/blob/de2c740050134c4ef6ec448875e8bde9da702933/Scripts/Helper.gd#L131-L136
This setup was created as an alternative to stitching all navigationmaps together and working with a single id. Right now all navigationareas are islands. We can either fix this setup or try to find a way to work with a single map and connected navigationmaps.