Jump to content

HELP!!! My prefab invisible when it on the shelf


Recommended Posts

i spent all day and only found maybe the problem is in the 'DLC003/scripts/prefabs/shelf.lua' line114

but idk how to fix it,

local function SetImage(inst, ent, slot)
    local src = ent
    local image = nil
 
    if ent.shelfart then
        image = ent.shelfart..".tex"
    elseif src ~= nil and src.components.inventoryitem ~= nil then
        image = ent.components.inventoryitem:GetImage()
    end
 
    if image ~= nil then
        inst.AnimState:OverrideSymbol(slot, GetInventoryItemAtlas(image), image)   --maybe here?
        --inst.AnimState:OverrideSymbol("SWAP_SIGN", "store_items", image)
        inst.imagename = src ~=nil or ""
    else
        inst.imagename = ""
        inst.AnimState:ClearOverrideSymbol(slot)
    end
end
Link to comment
Share on other sites

    env.RegisterInventoryItemAtlas = function(atlas, prefabname)
        --[[
            Associate an atlas with a prefab, so the atlas will be used in the inventory item image.

            The texture within the atlas and the prefab name must be the same for it to work correctly.

            You will need an ATLAS_BUILD asset loaded if you want your images to appear on mini signs and shelves.
                E.g.: Asset("ATLAS_BUILD", "images/inventoryimages.xml", 256)

            Parameters:
                - atlas (string): the atlas path. E.g.: "images/inventoryimages.xml"
                - prefabname (string): the texture and prefab name. E.g.: "axe.tex"
        ]]
        initprint("RegisterInventoryItemAtlas", atlas, prefabname)
        RegisterInventoryItemAtlas(resolvefilepath(atlas), prefabname)
    end
 

Link to comment
Share on other sites

59 minutes ago, KXWl1 said:

    env.RegisterInventoryItemAtlas = function(atlas, prefabname)
        --[[
            Associate an atlas with a prefab, so the atlas will be used in the inventory item image.

            The texture within the atlas and the prefab name must be the same for it to work correctly.

            You will need an ATLAS_BUILD asset loaded if you want your images to appear on mini signs and shelves.
                E.g.: Asset("ATLAS_BUILD", "images/inventoryimages.xml", 256)

            Parameters:
                - atlas (string): the atlas path. E.g.: "images/inventoryimages.xml"
                - prefabname (string): the texture and prefab name. E.g.: "axe.tex"
        ]]
        initprint("RegisterInventoryItemAtlas", atlas, prefabname)
        RegisterInventoryItemAtlas(resolvefilepath(atlas), prefabname)
    end
 

i knew the function but idk how to use it.But after ur explain, it works, thank you so much

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