Jump to content

Problem with custom equip slot

Recommended Posts



I am trying to make an equip slot for backpacks, fairly simple. It works flawlessly for the host, however, for the client, the inventory and the crafting tab simply... don't appear at all. The log doesn't show anything wrong, though. 


I suspect it may be linked to the Close() method of the inventory component, as it does the exact same thing, but I am not sure. I looked through the code, tried to use the Open() method, with no success.  :???:


I am not terribly familiar with the changes of the mod API on DST... 


Here is my modmain:

Assets = {Asset("ATLAS", "images/backpack.xml")}local require = GLOBAL.requireGLOBAL.CHEATS_ENABLED = trueGLOBAL.require('debugkeys')GLOBAL.EQUIPSLOTS.PACK = "pack"-- Changes the equipslot of all backpack itemsAddPrefabPostInitAny(function(inst)	if inst.components.container and inst.components.container.type == "pack" then		inst.components.equippable.equipslot = GLOBAL.EQUIPSLOTS.PACK	endend)AddClassPostConstruct("widgets/inventorybar", function(inst)	inst:AddEquipSlot(GLOBAL.EQUIPSLOTS.PACK, "images/backpack.xml", "backpack.tex")	inst.bg:SetScale(1.21,1.04,1)	inst.bgcover:SetScale(1.21,1.04,1)end)


Link to comment
Share on other sites

@rezecib: I tried your port, and unfortunatly it does the same thing for clients!  Thanks, though, I'll try to pinpoint where the bug happens.


I got one more question: I don't really understand the purpose of replicas; when should I use a replica instead of a component? Do I have to worry about them if the mod is client only?

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

  • Create New...