It specifically only triggers through the stategraph from the Incursive Gestalt, meaning that when entities are asleep (offscreen), this won't be able to trigger.
FrameEvent(19, function(inst) inst.persists = false -- lunarthrall_plant_gestalt handler. if inst.plant_target and inst.plant_target:IsValid() then TheWorld.components.lunarthrall_plantspawner:SpawnPlant(inst.plant_target) -- corpse_gestalt handler. elseif inst.sg.statemem.corpse ~= nil and inst.sg.statemem.corpse:IsValid() then inst.sg.statemem.corpse:StartLunarRiftMutation() if TheWorld.components.lunarthrall_plantspawner ~= nil and not inst.sg.statemem.corpse:HasTag("small_corpse") then TheWorld.components.lunarthrall_plantspawner:RemoveWave() end end end),
This should probably not be there and instead be in the StartLunarRiftMutation function itself from corpses.lua, but I have a suggestion further below.
There's also another stategraph state in there that, normally shouldn't be used to infest corpses, but still has logic for it, except for the wave removal. But like with the previous case, I have a better suggestion than just adding the checks there.
The corpses.lua file also a few cases of just replacing the corpse prefab with the mutated prefab when asleep (offscreen), through tasks from OnEntitySleep. This also needs to be accounted for.
To consolidate all of these into a more consistent approach, you could make it so the lunarthrall_plantspawner component listens for an event. The event listener function can then check the corpse entity sent to it like in the block of code above (including if it's small or not, or any other potential new checks in the future, let any sort of verification be handled here, as it's relevant to this component).
You can then fire this listener from any case of a lunar rift mutation starting (except from loading), whether it's happening normally or if it's an instant prefab replacement offscreen.
Slightly related, I always found it weird how the Incursive Gestalts that infest corpses don't come out of the lunar rift if a player is close to them (along with the corpse). I know it'd take some extra work, but it'd be really cool, especially if seeing the Gestalt return to the rift if it failed to mutate the corpse.
EDIT: in one of the comments below, I pointed out something I realized when explaining something there.
Mutations starting before the rift has reached its final stage will result in no effect to the upcoming waves, this should probably be accounted for by keeping track of it with a separate variable (if the value exceeds the determined amount of waves, you could immediately run the code to start the rift closing process). Just make sure that the value persists between saving and loading.
Also, the following values in lunarthrall_plantspawner could be made to be TUNING values, they're currently hard-coded into the functions:
-- the base value and variance value could be TUNING values -- (you don't need two values for the latter, it can just be a math.random(variance) call, 1 is implicit then) self.waves_to_release = 3 + math.random(1,3) -- 3 not being a TUNING value means the whole function would need to be overridden to change that while #plants > 0 and number_spawned < 3 do
- Kill Bearger or Deerclops or a Varg with the lunar rifts open.
- Go away or teleport, far away enough for entity sleep distance, before the mutation starts.
- Return and find the mutated creature boss.
- Verify that the amount of Brightshade waves haven't decreased by 1 as intended.
-
1
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