Jump to content

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

    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
 

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

  • Like 1

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