Jump to content

Mod incompatible with caves


falk_

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.

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

Link to comment
Share on other sites

The mod creators didn't take into account if the thing using the prefab is a client or server, which have their cases to handle.

 

Mostly it's due to components not existing on clients that only exist on the server, or replicated components not being handled properly.

Link to comment
Share on other sites

And how would that be fixed?

Here is the backpack function fn()

Spoiler

 


local function fn()
	local inst = CreateEntity()
    
	inst.entity:AddTransform()
	inst.entity:AddAnimState()
	inst.entity:AddSoundEmitter()
    inst.entity:AddMiniMapEntity()
    inst.entity:AddNetwork()
	
	MakeInventoryPhysics(inst)
	
    inst.AnimState:SetBank("wool_sack")
    inst.AnimState:SetBuild("swap_wool_sack")
    inst.AnimState:PlayAnimation("anim")
	
	inst.MiniMapEntity:SetIcon("minimap_wool_sack.tex")
	
	inst:AddTag("backpack")
    inst:AddTag("waterproofer")
	
	inst.foleysound = "dontstarve/movement/foley/backpack"

	inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end
    
    inst:AddComponent("inspectable")

    inst:AddComponent("inventoryitem")
	inst.components.inventoryitem.atlasname = "images/inventoryimages/wool_sack.xml"
    inst.components.inventoryitem.cangoincontainer = false
	
	inst:AddComponent("equippable")
	if EQUIPSLOTS["BACK"] then
		inst.components.equippable.equipslot = EQUIPSLOTS.BACK
	elseif EQUIPSLOTS["PACK"] then
		inst.components.equippable.equipslot = EQUIPSLOTS.PACK
	else
		inst.components.equippable.equipslot = EQUIPSLOTS.BODY
	end
	
	inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)
	
    inst:AddComponent("waterproofer")
    inst.components.waterproofer:SetEffectiveness(0)
	
	inst:AddComponent("container")
	containers.widgetsetup = mywidgetsetup        
	inst.components.container:WidgetSetup("wool_sack")	
	containers.widgetsetup = prev_widgetsetup
	
	MakeSmallBurnable(inst)
    MakeSmallPropagator(inst)
    inst.components.burnable:SetOnBurntFn(onburnt)
	
    MakeHauntableLaunchAndDropFirstItem(inst)
		
    return inst
end

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...