Jump to content

[solved] Waking sleeping mushrooms


Recommended Posts

Hello.

I have a function on my character mod, Wort, which causes mushrooms to pop out of the ground when he gets near regardless of time of day.

It works just fine until a mushroom farm is brought into the mix, and then it will crash the game. I've bolded line 172:

 

    if TUNING.MUSHROOMS == 1 then
    --Thanks to ItsDieter for allowing the use of this function from Pennywise!!
    inst:DoPeriodicTask(2, function()
        local v = ""
        local x, y, z = inst.Transform:GetWorldPosition()
        local FoundEnts = TheSim:FindEntities(x, y, z, 2)
        for k, v in pairs(FoundEnts) do
            if v.name == nil then v.name = "" end
            if string.find(v.name, "Mushroom")
            and v.components.pickable.caninteractwith == false then
                v.AnimState:PlayAnimation("open_inground")
                v.AnimState:PushAnimation("open_"..v.data.animname)
                v.AnimState:PushAnimation(v.data.animname, false)
                v.SoundEmitter:PlaySound("dontstarve/common/mushroom_up")
                v.growtask = nil
                if v.components.pickable ~= nil then
                    v.components.pickable.caninteractwith = true
                end
            end
        end
    end)
    end

image.png.2b5719ccce4b66ae83ff98aa967605d6.png

Could anyone tell me why this is happening?

 

Edited by Birdskull
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...