Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup total dna counter functions #461

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions src/open_samus_returns_rando/files/custom/guilib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,19 @@ function GUILib.UpdateDNACounter(currentDNA, maxDNA)
end
end

function GUILib.GetTotalDNACounter()
return GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.LowerComposition.LowerInfoComposition.DNACounter")
end

function GUILib.UpdateTotalDNAColor()
if Game.GetItemAmount(Game.GetPlayerName(), "ITEM_ADN") < 39 then
local dnaCounter = GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.LowerComposition.LowerInfoComposition.DNACounter")
local dnaCounter = GUILib.GetTotalDNACounter()
if Blackboard.GetProp("GAME", "OBJECTIVE_COMPLETE") then
GUI.SetProperties(dnaCounter, {
ColorR = "0.60392",
ColorG = "0.61569",
ColorB = "0.04314",
})
else
GUI.SetProperties(dnaCounter, {
ColorR = "0.68000",
ColorG = "0.83000",
Expand All @@ -75,6 +85,21 @@ function GUILib.UpdateTotalDNAColor()
end
end

function GUILib.BlinkTotalDNACounter()
local dnaCounter = GUILib.GetTotalDNACounter()
GUI.SetProperties(dnaCounter, {
ColorR = "0.60392",
ColorG = "0.61569",
ColorB = "0.04314",
Blink = "1.00000",
})
end

function GUILib.DisableBlinkTotalDNACounter()
local dnaCounter = GUILib.GetTotalDNACounter()
GUI.SetProperties(dnaCounter, { Blink = "0.00000" })
end

function GUILib.AddMessageBox()
local randoUI = GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.USSEF.Outer")
if randoUI ~= nil then
Expand Down
9 changes: 1 addition & 8 deletions src/open_samus_returns_rando/files/custom/scenario.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,7 @@ function Scenario.UpdateDNACounter()
local maxDNA = Init.tDNAPerArea[scenario] or 0
local currentDNA = Blackboard.GetProp("GAME", scenario .."_acquired_dna") or 0
GUILib.UpdateDNACounter(currentDNA, maxDNA)
if Blackboard.GetProp("GAME", "OBJECTIVE_COMPLETE") then
local dnaCounter = GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.LowerComposition.LowerInfoComposition.DNACounter")
GUI.SetProperties(dnaCounter, {
ColorR = "0.60392",
ColorG = "0.61569",
ColorB = "0.04314",
})
end
GUILib.UpdateTotalDNAColor()
end

local original_init = Scenario.InitScenario
Expand Down
20 changes: 4 additions & 16 deletions src/open_samus_returns_rando/files/templates/randomizerpowerup.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Game.ImportLibrary("system/scripts/guilib.lua", false)

RandomizerPowerup = RandomizerPowerup or {}
function RandomizerPowerup.main()
end
Expand Down Expand Up @@ -204,8 +206,8 @@ function RandomizerPowerup.ObjectiveComplete()
if RandomizerPowerup.GetItemAmount("ITEM_ADN") == required_dna then
Blackboard.SetProp("GAME", "OBJECTIVE_COMPLETE", "b", true)
Game.HUDIdleScreenLeave()
RandomizerPowerup.UpdateDNACounter()
Game.AddGUISF(3, "RandomizerPowerup.DisableBlink", "")
GUILib.BlinkTotalDNACounter()
Game.AddGUISF(3, "GUILib.DisableBlinkTotalDNACounter", "")

-- Assign boss names and areas to each boss
local boss = Init.sFinalBoss
Expand Down Expand Up @@ -241,20 +243,6 @@ function RandomizerPowerup.ObjectiveComplete()
end
end

function RandomizerPowerup.UpdateDNACounter()
local dnaCounter = GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.LowerComposition.LowerInfoComposition.DNACounter")
GUI.SetProperties(dnaCounter, {
ColorR = "0.60392",
ColorG = "0.61569",
ColorB = "0.04314",
Blink = "1.00000",
})
end

function RandomizerPowerup.DisableBlink()
local dnaCounter = GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.LowerComposition.LowerInfoComposition.DNACounter")
GUI.SetProperties(dnaCounter, { Blink = "0.00000" })
end

function RandomizerPowerup.IncreaseMissileCheckValue()
-- Update the min missile reserve tank refill value (capped by config)
Expand Down