Jump to content

Spider Queens Might Not Spawn


PuffinBy
  • Fixed

In spiderden.lua line 255-304 AttemptMakeQueen, there are 2 places calling "inst.components.growable:StartGrowing" which will get over written in "growable:DoGrowth" making them not work. Result in spider queen not spawning if a tier 3 den's first attempt to spawn a queen failed.

Spoiler

local function AttemptMakeQueen(inst)
    if inst.components.growable == nil then
        return
    end

    if not TUNING.SPAWN_SPIDERQUEEN then
        SetLarge(inst)
        return
    end

    if inst.data.stage == nil or inst.data.stage ~= 3 then
        SetLarge(inst)
    end

    if inst:HasTag("bedazzled") then
        return
    end

    if inst.components.sleepingbag and inst.components.sleepingbag:InUse() then
        return
    end

    if not inst:IsNearPlayer(30) then
        inst.components.growable:StartGrowing(60 + math.random(60)) -- line 280
        return
    end

    local check_range = TUNING.SPIDERDEN_QUEEN_RANGE_CHECK
    local cap = TUNING.SPIDERDEN_QUEEN_CAP
    local x, y, z = inst.Transform:GetWorldPosition()
    local ents = TheSim:FindEntities(x, y, z, check_range, nil, nil, DENCHECK_ONEOF_TAGS)
    local num_dens = #ents

    inst.components.growable:SetStage(1)
    RemoveSleepingBag(inst)

    inst.AnimState:PlayAnimation("cocoon_large_burst")
    inst.AnimState:PushAnimation("cocoon_large_burst_pst")
    inst.AnimState:PushAnimation("cocoon_small", true)

    PlayLegBurstSound(inst)
    inst:DoTaskInTime(5 * FRAMES, PlayLegBurstSound)
    inst:DoTaskInTime(15 * FRAMES, PlayLegBurstSound)
    inst:DoTaskInTime(35 * FRAMES, SpawnQueen, num_dens < cap)

    inst.components.growable:StartGrowing(60) -- line 302
    return true
end

 

Growable.lua 77-106

Spoiler

function Growable:DoGrowth()
    if self.targettime == nil and self.pausedremaining == nil then
        return false
    end

    local stage = self:GetNextStage()

    if self.stages[stage] ~= nil and self.stages[stage].pregrowfn ~= nil then
        self.stages[stage].pregrowfn(self.inst, stage)
    end

    if not self.growonly then
        self:SetStage(stage) -- "AttemptMakeQueen" is called here, where "StartGrowing" is called.
    end

	if self.inst:IsValid() then
		if self.stages[stage] ~= nil and self.stages[stage].growfn ~= nil then
			self.stages[stage].growfn(self.inst)
		end

		if self.stage < #self.stages or self.loopstages then -- self.stage is 4 if failed to spawn queen so "StopGrowing" overwrite line 280 in spiderden.lua;  
      -- and self.stage is 1 if successfully spawned a queen, so "StartGrowing" will overwrite line 302 in spiderden.lua
			self:StartGrowing()
		else
			self:StopGrowing()
		end
	end

	return true
end

 

 


Steps to Reproduce

Run offscreen during the tier 3 den's target time to grow, get back and find out it stops growing completely.

  • Like 2



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.


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