[205] Cannot mod SessionComponents_Economy.sbc - crashes

Digi shared this bug 49 days ago
Reported

The crash:


Thread:   1 ->  Error: Error during loading session:System.OverflowException: Arithmetic operation resulted in an overflow.
   at System.Linq.Enumerable.Sum(IEnumerable`1 source)
   at Sandbox.Game.World.Generator.MyFactionGenerator.GenerateFactionsCount(MySessionComponentEconomyDefinition economyDefinition, List`1 factionTypes, Int32 factionsCount)
   at Sandbox.Game.World.Generator.MyFactionGenerator.GenerateFactions(MySessionComponentEconomyDefinition def)
   at Sandbox.Game.SessionComponents.MySessionComponentEconomy.BeforeStart()

The weird part is the mod has nothing to do with factions... at least not directly.


The steps to cause this crash:

1. Create a local mod folder: %appdata%/SpaceEngineers/Mods/YourMod/Data/

2. Copy the game's Data/Game/SessionComponents_Economy.sbc into that local mod's Data folder

3. Create a Star System world with that local mod present (economy generator has to run with the modded file)


The cause is that there's a MyFactionGenerator.LegacyModSupport() that reassigns faction types' ratios from the session component if it's a modded one, this is flawed because as you can see copying it from the game causes confusing problems.


The fix is very simple, if all the FactionRatio_* from the economy session definition are 0 then skip doing the LegacyModSupport() entirely.

Replies (1)

photo
2

Hello Digi,

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

We have added this issue into our internal system.

Kind Regards,

Keen Software House: QA Department

Leave a Comment
 
Attach a file