Mini Signs are incompatible with MOD items


Mobbstar
  • Known Issue

The Mini Signs do not use the inventoryitem.atlasname property when getting drawn on. Therefore, all items with custom atlas (i.e. all mod items) do not display by default.

Partial solution:

Spoiler

 

This is the original function:


local function OnDrawnFn(inst, image, src)
    if image ~= nil then
        inst.AnimState:OverrideSymbol("SWAP_SIGN", "images/inventoryimages.xml", image..".tex")
        if inst:HasTag("sign") then
            inst.components.drawable:SetCanDraw(false)
            inst._imagename:set(src ~= nil and (src.drawnameoverride or src:GetBasicDisplayName()) or "")
            if src ~= nil then
                inst.SoundEmitter:PlaySound("dontstarve/common/together/draw")
            end
        end
    else
        inst.AnimState:ClearOverrideSymbol("SWAP_SIGN")
        if inst:HasTag("sign") then
            if not (inst.components.burnable ~= nil and inst.components.burnable:IsBurning()) then
                inst.components.drawable:SetCanDraw(true)
            end
            inst._imagename:set("")
        end
    end
end

Without changing any function parameters, this tweak fixes the bug:


local function OnDrawnFn(inst, image, src)
    if image ~= nil then
    	local atlas = (src and src.components.inventoryitem and src.components.inventoryitem.atlasname) or "images/inventoryimages.xml"
        inst.AnimState:OverrideSymbol("SWAP_SIGN", atlas, image..".tex")
        if inst:HasTag("sign") then
        	--[...]

 

 

 

You might need to add a second netvar for the atlas. Nevertheless, it is a rather easy issue, hopefully you fix it soon. Thanks for reading and stay awesome Klei!  ^_^


Steps to Reproduce
1) Plant a minisign 2) Place a mod item (with custom image) nearby 3) Use a Feather Pencil on the sign

Status: Known Issue

We are aware of this issue and have it logged internally but either we do not have a fix ready yet or we are not planning on addressing the issue in the immediate future.


  Report Bug


User Feedback


....

It's actually a little more complex because the atlas is being used an as anim build instead of a regular atlas, which is denoted by this asset that the minisign prefab references ( Asset("ATLAS_BUILD", "images/inventoryimages.xml", 256), )
 

There's a slight difference from what you posted, it also needs to resolve the filepath. I'll be adding this functionality, but it'll still rely on the modder to create an ATLAS_BUILD for their inventory image at this time.

local atlas = (src and src.components.inventoryitem and src.components.inventoryitem.atlasname and resolvefilepath(src.components.inventoryitem.atlasname) ) or "images/inventoryimages.xml"

So for mod icons to appear on minisigns they'll need to a link to their inventory atlas, like this for the Opal Amulet mod.

Asset("ATLAS_BUILD", "images/inventoryimages/opalamulet.xml", 256),

Ideally this would be done automatically, but I don't see a clean way right now to identify at asset loading time which atlases need to be converted into builds to be used by the minisign.

  • Like 1

Share this comment


Link to comment
Share on other sites
.... ....

Out of curiosity, what exactly does the parameter (256) mean? The purchasable skins use a different parameter for their ATLAS_BUILD (for opening the chest I suppose).

Share this comment


Link to comment
Share on other sites
....
On 10/6/2018 at 1:57 AM, Mobbstar said:

Out of curiosity, what exactly does the parameter (256) mean? The purchasable skins use a different parameter for their ATLAS_BUILD (for opening the chest I suppose).

That parameter is scale of the build. It's used for creating the vertex data for the symbols in the build. The build is what determines how large something in an animation is, so need to specify how large these override symbols are going to be.

  • Like 1
  • Thanks 1

Share this comment


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