[205.024] ModAPI - multiple gamelogics prevents OnAddedToScene and OnRemovedFromScene

Digi shared this bug 4 days ago
Reported

This impacts mods like DefenseShields where adding another mod that adds gamelogic to the same types will break some of its functions, all because OnAddedToScene() and OnRemovedFromScene() stops triggering.

One such "other mod" would be Fix LCD Support where it needs to be gamelogic to function properly (I did try a lot of alternatives, nothing worked properly).

So adding both of these mods will break DefenseShields' controller and table, most visible is with the terminal info being completely missing.


I have a quicker and simpler example made for this however:

1. Get the attached zip and unzip it to %appdata%/SpaceEngineers/Mods

2. Create an empty world (creative) with that BugTest_GamelogicOnAddedToScene local mod added to it.

3. Place any vanilla module block (e.g. yield module) and see the chat.


Expected chat output:

Test1: Init()
Test2: Init()
Test1: OnAddedToScene()
Test2: OnAddedToScene()
But instead the OnAddedToScene() lines are completely missing.

You can also edit the script to turn an #if true to #if false where I've annotated it and re-test to see that it OnAddedToScene() works after that, which means the mods isolated work fine, only put together they start getting weird.


And you might ask why is this a big deal, the rest of the thing works? Because mods like DefenseShields have been built like that for a long time and redesigning their logics around different timed things would lead to other new bugs.


This lack of OnAddedToScene() being called is way easier to fix in the game itself (at least from an outside perspective :P), it requires changing MyCompositeGameLogicComponent to override OnAddedToScene() and OnRemovedFromScene() and inside them iterate the gamelogics and trigger the respective methods on each, it's pretty straightforward.

Replies (1)

photo
2

Hello Digi,

Thank you for reaching our forum and letting us know about this issue.

Issue was successfully reproduced on our side and put into our internal system.

Kind Regards,

Keen Software House: QA Department

Leave a Comment
 
Attach a file