Skip to content

Commit

Permalink
Re-enable SpecialEnergyCloud for powerups (#403)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
dyceron authored Jul 10, 2024
1 parent e6035ca commit b0d826f
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/open_samus_returns_rando/files/templates/randomizerpowerup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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()
Expand Down

0 comments on commit b0d826f

Please sign in to comment.