Jump to content

Weeds lacking the "crop_bloomed" animation make the saves broken and failed to load


Littlefat1213
  • Pending
-- in weed_plants.lua Line 182:
local GROWTH_STAGES =
{
	......
    {
        name = "bolting",
		pregrowfn = function(inst)
			ConsumeNutrients(inst)
		end,
		fn = function(inst, stage, stage_data)
            MakePickable(inst, false)
			MakeFull(inst, true)
			UpdateSpreading(inst, stage_data)
			inst.components.farmplanttendable:SetTendable(false)

			inst:UpdateResearchStage(stage)

			inst.components.growable:StopGrowing()
			inst.components.growable.magicgrowable = false
			PlayStageAnim(inst, "bloomed")

            inst.mature = true
        end,
		dig_fx = "dirt_puff",
		inspect_str = "FULL_WEED",
    },
}

local function PlayStageAnim(inst, anim, custom_pre)
	if POPULATING or inst:IsAsleep() then
		inst.AnimState:PlayAnimation("crop_"..anim, true)
		inst.AnimState:SetTime(math.random() * inst.AnimState:GetCurrentAnimationLength())
	elseif custom_pre ~= nil then
		inst.AnimState:PlayAnimation(custom_pre, false)
		inst.AnimState:PushAnimation("crop_"..anim, true)
	else
		inst.AnimState:PlayAnimation("grow_"..anim, false)
		inst.AnimState:PushAnimation("crop_"..anim, true)
	end
end

image.png.b99175ccb9272a53c82fa2eb85e646f3.png

weed_firenettle、weed_tillweed、weed_ivy lack the animation of“crop_bloomed”,when they are in bolt stage and alseep,AnimState:GetCurrentAnimationLength() return -1 and causes a crash about math.random


Steps to Reproduce

As Above




User Feedback


There are no comments to display.



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

×
  • Create New...