Birdskull Posted April 27, 2019 Share Posted April 27, 2019 (edited) 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 Could anyone tell me why this is happening? Edited April 27, 2019 by Birdskull Link to comment Share on other sites More sharing options...
. . . Posted April 27, 2019 Share Posted April 27, 2019 maybe this work and (v.components.pickable and v.components.pickable.caninteractwith == false) then Link to comment Share on other sites More sharing options...
Birdskull Posted April 27, 2019 Author Share Posted April 27, 2019 27 minutes ago, Warbucks said: maybe this work and (v.components.pickable and v.components.pickable.caninteractwith == false) then You're a godsend. Thank you so much! That fixed it! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now