From b0d826f7bb3759807cd048b80935ffb26106fec3 Mon Sep 17 00:00:00 2001 From: dyceron <38679103+dyceron@users.noreply.github.com> Date: Wed, 10 Jul 2024 01:26:47 -0400 Subject: [PATCH] Re-enable SpecialEnergyCloud for powerups (#403) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Re-enable SpecialEnergyCloud for powerups * Only activate if trigger exists and fix Aeion Ability triggers activating * Simplify and remove redundancies * Refactor actororname check * Simplify aeion conditionals * Remove more redundant checks and rename function * Better nameā„¢ (please can we be done :p) * Readd check for aeion --- .../files/templates/randomizerpowerup.lua | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua index d907020..e6dc793 100644 --- a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua +++ b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua @@ -51,7 +51,7 @@ function RandomizerPowerup.OnPickedUp(resources, actorOrName) Scenario.UpdateProgressiveItemModels() if actorOrName ~= nil then - RandomizerPowerup.MarkLocationCollected(actorOrName) + RandomizerPowerup.PostCollectionAdjustments(actorOrName) end RandomizerPowerup.IncrementInventoryIndex() RL.UpdateRDVClient(false) @@ -71,7 +71,7 @@ function RandomizerPowerup.PropertyForLocation(actorOrName) return "c_" .. actorOrName end -function RandomizerPowerup.MarkLocationCollected(actorOrName) +function RandomizerPowerup.PostCollectionAdjustments(actorOrName) local name -- normal pickups if actorOrName.sName ~= nil then @@ -84,6 +84,11 @@ function RandomizerPowerup.MarkLocationCollected(actorOrName) if name == nil then return end + RandomizerPowerup.MarkLocationCollected(name) + RandomizerPowerup.ActivateSpecialEnergy(name) +end + +function RandomizerPowerup.MarkLocationCollected(name) local playerSection = Game.GetPlayerBlackboardSectionName() local currentScenario = Scenario.CurrentScenarioID local propScenario = currentScenario @@ -96,6 +101,22 @@ function RandomizerPowerup.MarkLocationCollected(actorOrName) Blackboard.SetProp(playerSection, propName, "b", true) end +function RandomizerPowerup.ActivateSpecialEnergy(name) + local cloud = "TG_SpecialEnergyCloud" + + -- Powerups + if string.sub(name, 0, 7) == "LE_Powe" then + local powerup = string.find(name, "_", 4) + local trigger = cloud .. string.sub(name, powerup) + if Game.GetEntity(trigger) ~= nil then + SpecialEnergyCloud.ActivateSpecialEnergy(trigger) + end + -- Aeion abilities + elseif string.sub(name, 0, 17) == "LE_SpecialAbility" then + SpecialEnergyCloud.ActivateSpecialEnergy(cloud) + end +end + function RandomizerPowerup.ObjectiveComplete() if Game.GetItemAmount(Game.GetPlayerName(), "ITEM_ADN") == 39 then Game.HUDIdleScreenLeave()