MeridiusIX / Modular-Encounters-Systems

Modular Encounters Systems is a Massive NPC Management Framework for the game Space Engineers
55 stars 22 forks source link

PlanetSpawnFilter of planets with negative entity IDs is broken #262

Open Nevcairiel opened 1 year ago

Nevcairiel commented 1 year ago

Planets with negative entity IDs will have their entries in the PlanetSpawnFilters array reset after saving/loading, as well as generally not working.

This is caused by this line, which breaks the planet id by taking the absolute value (for some reason?) https://github.com/MeridiusIX/Modular-Encounters-Systems/blob/1cf02fe4a6bc4a3f523f81fddfb02ce50f1bf5fa/Data/Scripts/ModularEncountersSystems/Configuration/ConfigBase.cs#L28

I see no reason the absolute value should be taken here.

If I manually update my config files and add the minus where needed, the config works properly, and remains intact after saving and reloading.

Nevcairiel commented 1 year ago

Thinking about this some more, I believe this is likely the original cause for the duplicate planet entries, since it could no longer find its previous definition.

MeridiusIX commented 1 year ago

Negative IDs were somehow happening before I included the Math.Abs to this. If they're still coming up negative, I've got no idea why - but I'll continue to look into it

MeridiusIX commented 1 year ago

Ok, so I'm finding out Europa actually has a negative entity ID?? I've never seen that for any other entity in the game before, and assumed it was an error.

Gonna look into things more.

Nevcairiel commented 1 year ago

Negative Entity IDs are normal. My star system is customly generated with spawned in planets, and 3 got a negative ID. Should just be handled as-is, and not converted to positive.

In the default star system, Europa indeed has a negative ID (straight from SANDBOX_0_00.sbs) <EntityId>-6999989728267602142</EntityId>

DagonOS commented 1 year ago

I do believe that I have encountered the same issue. I have checked the spawns with MES.Info.GetDiagnostics and MES.GESAP and could not identify anything out of the ordinary. On one Planet, with a positiv entity ID the spawns are working as expected. On another planet with a negativ entity ID no spawn at all is working.

@Nevcairiel would you be willing to point me towards the config files that you updated manually? I would like to try my luck as well