-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hi!
We love the Electrical Progressive (EP) mod, same as we loved the Electricity. We love EP even more, because you actively improve it and also we like the more realism added by you to the mod (applying electrical laws). We'd like to continue using the EP mods on our server, but, unfortunately, there is still the bug I reported a long time ago related to the Electricity mod (see here)
You probably reused some Electricity code, or learned from their code, because the same bug we experienced in the EP mod.
Luckily, I finally can reproduce the bug, so I hope that this text helps you find the bug and remove it.
Your class BEBehaviorEGenerator inherits from the BEBehaviorMPBase class, which implements the IMechanicalPowerDevice interface. So the class is a part of a MechanicalNetwork. The problem occurs when we build a network across chunk borders. I don't know in depth, how it's implemented, but as far as I understood, all chunks should be loaded: with the first chunk that contains a part of the network, all chunks that the network touches must be loaded. For some reason, this does not happen and when processing a node with an EP element, the newnode.CreateJoinAndDiscoverNetwork() method returns null and this causes the server to crash.
It crashes the server with this error:
12.10.2025 11:11:25 [Error] Exception: Object reference not set to an instance of an object.
at Vintagestory.GameContent.Mechanics.MechanicalPowerMod.RebuildNetwork(MechanicalNetwork network, IMechanicalPowerDevice nowRemovedNode) in C:\Develope\VintageStory\ProjectsAnegostudios\VSSurvivalMod\Systems\MechanicalPower\MechanicalPowerMod.cs:line 235
at Vintagestory.GameContent.Mechanics.MechanicalPowerMod.Event_ChunkDirty(Vec3i chunkCoord, IWorldChunk chunk, EnumChunkDirtyReason reason) in C:\Develope\VintageStory\ProjectsAnegostudios\VSSurvivalMod\Systems\MechanicalPower\MechanicalPowerMod.cs:line 311
at Vintagestory.Server.ServerSystemSupplyChunks.mainThreadLoadChunkColumn(ChunkColumnLoadRequest chunkRequest) in VintagestoryLib\Server\Systems\World\LoadThread\SupplyChunks.cs:line 1007
at Vintagestory.Server.ServerMain.ProcessMainThreadTasks() in VintagestoryLib\Server\ServerMain.cs:line 2940
at Vintagestory.Server.ServerMain.ProcessMain() in VintagestoryLib\Server\ServerMain.cs:line 925
at Vintagestory.Server.ServerMain.Process() in VintagestoryLib\Server\ServerMain.cs:line 864
After the crash, the server keeps running for a minute or two, then stops responding and communicating. Server restart is needed to recover from the situation.
I prepared a creative world and reproduces partially a configuration of EP network, which causes the crash. I attached the world save, so you can reproduce the bug.
How to reproduce:
- Clone the VSSurvivalMod project from the Anegostudios github.
- Open the VSSurvivalMod in the Visual Studio and make it debuggable (you'll need to add missing dependencies etc and configure launch settings etc., to be able to run the VSSurvivalMod in VisualStudio debug. I just deleted the VSCreativeMod.dll/VSCreativeMod.pdb from the game mod folder and copied my built version to the location after build.
- Run the VSSurvivalMod in the VisualStudio debug and load my save, enclosed as ep-debug game save.zip.
- There is built my EP network. Different stone blocks indicate chunk borders.
- There is a teleport. Go to the teleport to move to a location far enough for all chunks to unload.
- You'll see an arrow indicating the direction. Go to that direction. After a while, you will come close enough to the network structure so the first chunk is starting loading.
- Crash!! You should see the place, where the Visual Studio catches the error.
It's in the method RebuildNetwork. The newnetwork contains null and this causes the crash.
See the enclosed screenshot of my Visual Studio showing the caught error.
Hope that my description and the enclosed files helps you with fixing the error.
Feel free to contact me if I can help you somehow. I'll keep my fingers crossed :-).
Thank you for the great mod! We have much fun with it.
Fipíl
ep-debug game save.zip
Error in server-main log.txt

EDIT:
Use those mods to simulate:
electricalprogressiveqol_2.3.0.zip
electricalprogressivebasics_2.3.0.zip
electricalprogressivecore_2.3.1.zip