Jump to content

Having trouble with transformation in cave


Recommended Posts

Hello. Can someone tell me what I'm doing wrong, here?

I'm working on a character who has a different build and features for day/dusk/night. I'd like for him to behave as if it is night while he is in the cave, but I can't for the life of me get anything I try to work. Here's my current iteration of failure. What am I missing? 

Spoiler

local function phasecolor(inst, WorldState)
    if TheWorld.state.phase == "day" then
        inst.AnimState:SetBuild("wort")
        inst:AddTag("daywort")
        inst:RemoveTag("eveningwort")
        inst:RemoveTag("nightwort")
        inst:AddComponent("sanityaura")
        inst.components.sanityaura.aura = TUNING.SANITYAURA_TINY
    local light = inst.entity:AddLight()
    inst.Light:Enable(false)
    elseif TheWorld.state.phase == "dusk" then
        inst.AnimState:SetBuild("eveningwort")
        inst:AddTag("eveningwort")
        inst:RemoveTag("daywort")
        inst:RemoveTag("nightwort")
        inst:RemoveComponent("sanityaura")
    local light = inst.entity:AddLight()
    inst.Light:Enable(true)
    inst.Light:SetFalloff(.5)
    inst.Light:SetIntensity(.9)
    inst.Light:SetRadius(1)
    inst.Light:SetColour(66/255, 105/255, 76/255)
    elseif TheWorld.state.phase == "night" or TheWorld.state.phase == "cavenight" or TheWorld.state.phase == "caveday" or TheWorld.state.phase == "cavedusk" then
        inst.AnimState:SetBuild("nightwort")
        inst:AddTag("nightwort")
        inst:RemoveTag("daywort")
        inst:RemoveTag("eveningwort")
        inst:AddComponent("sanityaura")
        inst.components.sanityaura.aura = -(TUNING.SANITYAURA_TINY * 50)
    local light = inst.entity:AddLight()
    inst.Light:Enable(true)
    inst.Light:SetFalloff(.5)
    inst.Light:SetIntensity(.9)
    inst.Light:SetRadius(1)
    inst.Light:SetColour(95/255, 151/255, 167/255)
end
    end

 

Wort TESTER.rar

Link to comment
Share on other sites

Thank you. I still haven't figured out why I couldn't get the build to change, but I was at least able to recognize that the other changes were being applied so the issue was all just visual. I fixed the problem by going into the x_none.lua and changing his normal_skin from the day to the night build.

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