Nanite-Construction-System / NaniteConstructionSystem

A continuation of scripts for the Nanite Construction System
14 stars 13 forks source link

Error on loading save #156

Open adamsong opened 4 years ago

adamsong commented 4 years ago

When loading a save with an active NCF for the first time this game session, the world will not load and the following error appears in the log:

2020-07-10 17:32:30.625 - Thread:  14 ->  ERROR Entity init!: System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at NaniteConstructionSystem.Entities.NaniteAssemblerLogic.Init(MyObjectBuilder_EntityBase objectBuilder)
   at VRage.Game.Entity.MyEntity.Init(MyObjectBuilder_EntityBase objectBuilder)
   at Sandbox.Game.Entities.MyCubeBlock.Init(MyObjectBuilder_CubeBlock builder, MyCubeGrid cubeGrid)
   at Sandbox.Game.Entities.Cube.MyTerminalBlock.Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
   at Sandbox.Game.Entities.Cube.MyFunctionalBlock.Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
   at Sandbox.Game.Entities.Cube.MyProductionBlock.Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
   at Sandbox.Game.Entities.Cube.MyAssembler.Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
   at Sandbox.Game.Entities.Cube.MySlimBlock.Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid, MyCubeBlock fatBlock)
   at Sandbox.Game.Entities.MyCubeGrid.AddCubeBlock(MyObjectBuilder_CubeBlock objectBuilder, Boolean testMerge, MyCubeBlockDefinition blockDefinition)
   at Sandbox.Game.Entities.MyCubeGrid.AddBlock(MyObjectBuilder_CubeBlock objectBuilder, Boolean testMerge)
   at Sandbox.Game.Entities.MyCubeGrid.InitInternal(MyObjectBuilder_EntityBase objectBuilder, Boolean rebuildGrid)
   at Sandbox.Game.Entities.MyEntities.InitEntity(MyObjectBuilder_EntityBase objectBuilder, MyEntity& entity, Boolean tolerateBlacklistedPlanets)

Any subsequent loads of the world work as intended, however partial blocks such as armor slopes, and merge blocks are completely invisible while they are not fully constructed. Finishing their construction makes them visible. A game restart will result in the first error again.

nukeguard commented 3 years ago

Check again, this may be fixed now as main-thread was getting filled with particles