Craluminum-Mods / CraluminumMods-Issues

Issue tracker of my mods for Vintage Story
0 stars 1 forks source link

Drop Vines Anyway (and maybe others ... ???) #34

Closed radfast closed 1 year ago

radfast commented 1 year ago

Hi Cral

In Drop Vines Anyway you are registering a behavior inside the StartServerSide() method. This causes occasional crashes including CMEs, because game engine code in ServerMain proceeds on the assumption that everything will have been registered by, at the very latest, the AssetsFinalize stage, and can be multi-threaded after that time. StartServerSide() is run after AssetsFinalize, it runs when the game is finally ready and running.

image

Please can I suggest register the behavior in the Start() method, with a check whether the api side is serverside if you need to. See also, the XML comment on the StartServerSide() method indicating do not add new behaviors at this stage, it actually means do not add (already registered) behaviors to blocks, but nothing should be registered here either.

I don't know whether a similar potential issue applies to any of your other mods? Nothing should be registered and no assets should be modified in StartServerSide().

Craluminum2413 commented 1 year ago

Okay I will fix that

Craluminum2413 commented 1 year ago

@radfast Can EntityBehavior be registered only server side?

Craluminum2413 commented 1 year ago

Fixed