Jump to content

Mod crashes if server has caves


Recommended Posts

Why are some mods incompatible with servers with caves?

I am specifically looking at the "Additional Equipment (DST)" mod. Here is the link to it: http://steamcommunity.com/sharedfiles/filedetails/?id=681368916

The mod works perfectly fine, as long as the server does not have caves.

If the server has caves, then the backpack items of the mod will crash. The error says something related to the container:Open and a nil value.

 

The problem is caused by components.container: WidgetSetup in the backpacks when opening them (when drawing the inventory of the backpack)

Is there any way to fix this and make it compatible with caves?

 

Link to comment
Share on other sites

Most common problem related with code working without cave and crashing with cave are related to client-side problem (for example a code that shouldn't be client side but is, or something missing client side).

I don't know if it's the case here.

 

When i tried to make my own container, someone suggested me to look at "Storm Cellar" mod. Maybe you can compare the code used in this mod to the one used in Additional item and see how the code is managed. Try to see if there are other mod with custom backpack and how they solve this issue ?

Link to comment
Share on other sites

What I figured out through the forum and myself: Often mods need additional code or implementation to work with caves.

Following things might help:

Add this to your modinfo.lua, makes the mod required by all clients and might solve a few issues.

all_clients_require_mod = true

 

Sometimes code in modmain.lua will work on a normal world, but not with caves. Adding this to the functions will solve some issues:

    if not GLOBAL.TheWorld.ismastersim then
        return inst
    end

Example:

local function example(inst)
    if not GLOBAL.TheWorld.ismastersim then
        return inst
    end
	--"Here comes the function, code, etc."
end

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...