Jump to content

Please help with MakeSnowCovered function


Recommended Posts

Hello,

I'm currently making a structure (a lamp) and I wanted to add a function to make my structure covered in snow when it's Winter. However, I have no idea about the function command that I've found, so now I am sad and need help. 

-----------------------

Here the three functions I suppose I need? I don't know where these "snow" are from but I guess I have to make a new Spriter animation to override? and if so, what do I name the file and the animation name (BUILD? or BUILD_SNOW? or...)

local function OnSnowCoveredChanged(src, show)
    if show then
        TheSim:ShowAnimOnEntitiesWithTag("SnowCovered", "snow")
    else
        TheSim:HideAnimOnEntitiesWithTag("SnowCovered", "snow")
    end
    SetVariable("issnowcovered", show)

local function MakeSnowCoveredPristine(inst)
    inst.AnimState:OverrideSymbol("snow", "snow", "snow")
    inst:AddTag("SnowCovered")

    inst.AnimState:Hide("snow")
end

local function MakeSnowCovered(inst)
    if not inst:HasTag("SnowCovered") then
        MakeSnowCoveredPristine(inst)
    end

    if TheWorld.state.issnowcovered then
        inst.AnimState:Show("snow")
    else
        inst.AnimState:Hide("snow")
    end
end

So far I have created a new Spriter file name "snow_small_pathway_light" with a snow animation "snow" and my structure "small_pathway_light" to inst.AnimState:OverrideSymbol("small_pathway_light", "snow_small_pathway_light", "snow") and no snow happened... /cry

This is my whole script for now small_pathway_light.lua. Every other function works fine and the game was not crashed. Please help : ( and btw sorry about my English.

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