Space Engineers

Space Engineers

Not enough ratings
[Experimental] Fix OnAddedToScene()
   
Award
Favorite
Favorited
Unfavorite
Type: Mod
Mod category: Script, Other
File Size
Posted
4.035 KB
6 Nov, 2024 @ 8:16am
1 Change Note ( view )

Subscribe to download
[Experimental] Fix OnAddedToScene()

Description
A very niche and experimental fix for mods that break from other mods adding gamelogic components on the same block type.

Experimental
Briefly tested with Defense Shields + my LCD support mod to confirm that the shield table has detailed info.
However I don't use Defense Shields to know what new things this breaks or what it doesn't fix, hence being tagged experimental. Please test and let me know if you find problems.

The problem
This is a game bug[support.keenswh.com] but it's also fixable by the mod that breaks by not using OnAddedToScene() in the first place... or by hooking AddedToScene from MyCubeBlock to trigger it manually (and remove the override method to avoid duplicates).

How the fix works
This mod hooks AddedToScene and RemovedFromScene events from any block that has MyCompositeGameLogicComponent and in those events it will call OnAddedToScene() and OnRemovedFromScene() respectively on all components inside the composite component.

My Fix LCD support is one that can cause this because it adds gamelogic for all subtypes, however the mod cannot function with workarounds to not use gamelogic, and trust me I tried (before releasing it).

Known mods that suffer from this bug (and easiest to cause the bug is with my Fix LCD mod above):
- Defense Shields
- 2cm Beam System (or the industrial fix)
1 Comments
Gothicjawa 7 Nov, 2024 @ 3:13pm 
One of the thing that broke was the shield defence modulator, and not allowing entities to pass through the shields while they were up even though the option was enabled, just tested in a creative world, and it seems to have fixed that issue. I stress seems, need more testing.