Jump to content

Items not showing up for some clients


Recommended Posts

For some reason it seems some people joining servers don't get custom items to show up in the skill bar. Anyone have ideas for what could be the cause?

http://steamcommunity.com/workshop/filedetails/discussion/360319890/619574421569721115/?tscn=1420667705

 

Below: example of custom items in my mod.

 

local assets =

{
  Asset( "ANIM", "anim/smallblood.zip" ),
  Asset( "ANIM", "anim/plantblood.zip" ),
  Asset( "ANIM", "anim/monsterblood.zip" ),
  Asset( "ANIM", "anim/largeblood.zip" ),
  Asset ("ATLAS", "images/inventoryimages/smallblood.xml"),
  Asset ("ATLAS", "images/inventoryimages/largeblood.xml"),
  Asset ("ATLAS", "images/inventoryimages/monsterblood.xml"),
  Asset ("ATLAS", "images/inventoryimages/plantblood.xml"),
  
}
 
local prefabs = {
    "smallblood",
    "largeblood",
    "monsterblood",
    "plantblood",
}
 
local function common(bank, build, anim, tag)
    local inst = CreateEntity()
 
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()
    
    MakeInventoryPhysics(inst)
 
    inst.AnimState:SetBank(bank)
    inst.AnimState:SetBuild(build)
    inst.AnimState:PlayAnimation(anim)
 
    inst:AddTag("blood")
    if tag ~= nil then
        inst:AddTag(tag)
    end
 
    if not TheWorld.ismastersim then
        return inst
    end
 
    inst.entity:SetPristine()
 
    inst:AddComponent("edible")
    inst.components.edible.ismeat = true    
    inst.components.edible.foodtype = FOODTYPE.BLOOD   --change to BLOOD later
 
    inst:AddComponent("inspectable")
 
    inst:AddComponent("inventoryitem")
    inst:AddComponent("stackable")
 
    inst:AddComponent("perishable")
    inst.components.perishable:SetPerishTime(TUNING.PERISH_SLOW)
    inst.components.perishable:StartPerishing()
    inst.components.perishable.onperishreplacement = "spoiled_food"
 
    MakeHauntableLaunchAndPerish(inst)
    inst:ListenForEvent("spawnedfromhaunt", function(inst, data)
        Launch(inst, data.haunter, TUNING.LAUNCH_SPEED_SMALL)
    end)
 
    return inst
end
 
-- small bloodbag
local function smallblood()
  local inst = common("deerclops_eyeball", "smallblood", "idle")
 
    if not TheWorld.ismastersim then
        return inst
    end
    
    inst.components.edible.healthvalue = TUNING.HEALING_MEDSMALL * 2
    inst.components.edible.hungervalue = TUNING.CALORIES_SMALL * 2.5
    inst.components.edible.sanityvalue = TUNING.SANITY_TINY * 1
    inst.components.inventoryitem.atlasname = "images/inventoryimages/smallblood.xml"
 
    inst.components.perishable:SetPerishTime(TUNING.PERISH_PRESERVED)
 
    inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM
 
    return inst
end
 
-- large bloodbag
local function largeblood()
  local inst = common("deerclops_eyeball", "largeblood", "idle")
 
    if not TheWorld.ismastersim then
        return inst
    end
    
    inst.components.edible.healthvalue = TUNING.HEALING_MED * 2
    inst.components.edible.hungervalue = TUNING.CALORIES_MED * 2.5
    inst.components.edible.sanityvalue = TUNING.SANITY_SMALL * 1
    inst.components.perishable:SetPerishTime(TUNING.PERISH_PRESERVED)
    inst.components.inventoryitem.atlasname = "images/inventoryimages/largeblood.xml"
 
    return inst
end
 
-- monster bloodbag
local function monsterblood()
  local inst = common("deerclops_eyeball", "monsterblood", "idle")
 
    if not TheWorld.ismastersim then
        return inst
    end
    
    inst.components.edible.healthvalue = TUNING.HEALING_SMALL * 1
    inst.components.edible.hungervalue = TUNING.CALORIES_MEDSMALL * 2.5
    inst.components.edible.sanityvalue = -TUNING.SANITY_SMALL * 1
    inst.components.perishable:SetPerishTime(TUNING.PERISH_PRESERVED)
    inst.components.inventoryitem.atlasname = "images/inventoryimages/monsterblood.xml"
 
    return inst
end
 
-- plant bloodbag
local function plantblood()
  local inst = common("deerclops_eyeball", "plantblood", "idle")
 
    if not TheWorld.ismastersim then
        return inst
    end
    
    inst.components.edible.healthvalue = TUNING.HEALING_MEDLARGE * 1
    inst.components.edible.hungervalue = TUNING.CALORIES_MED * 1.25
    inst.components.edible.sanityvalue = -TUNING.SANITY_MED
    inst.components.perishable:SetPerishTime(TUNING.PERISH_PRESERVED)
    inst.components.inventoryitem.atlasname = "images/inventoryimages/plantblood.xml"
 
    return inst
end
 
 
return  Prefab("common/inventory/smallblood", smallblood, assets),
        Prefab("common/inventory/largeblood", largeblood, assets),
        Prefab("common/inventory/monsterblood", monsterblood, assets),
        Prefab("common/inventory/plantblood", plantblood, assets)

 

Link to comment
Share on other sites

@RedMattis, does your modinfo.lua have the following line in it?

 

all_clients_require_mod = true
 

 

Custom items and characters should have that line in order for all clients to download the mod. I also see something missing from your particular mod that isn't missing from the one I ported (which does show up in clients inventories (Diggable Reeds).

 

inst.components.inventoryitem.imagename = "dug_reeds"

 

Try setting the imagename and see if it will show up in their inventory afterwards.

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...