From a803c9032126b0e2a29e903f52b936b55853f3e6 Mon Sep 17 00:00:00 2001 From: Untrustedlife Date: Sun, 27 Jan 2019 16:55:37 -0600 Subject: [PATCH] There is now an Iron Ions bar. Which gets filled up when you gather iron. --- scripts/gui/microbe_hud.mjs | 7 +++++++ scripts/gui/thrive_gui.html | 15 ++++++++++++++- scripts/gui/thrive_style.css | 8 ++++++++ scripts/microbe_stage/microbe_stage_hud.as | 13 +++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/scripts/gui/microbe_hud.mjs b/scripts/gui/microbe_hud.mjs index 3c5d4da71ea..9893c011d82 100644 --- a/scripts/gui/microbe_hud.mjs +++ b/scripts/gui/microbe_hud.mjs @@ -493,4 +493,11 @@ function updateMicrobeHUDBars(values){ document.getElementById("microbeHUDPlayerHydrogenSulfideBar").style.width = common.barHelper(values.compoundHydrogenSulfide, values.HydrogenSulfideMax); + document.getElementById("microbeHUDPlayerIron").textContent = + values.compoundIron.toFixed(1); + document.getElementById("microbeHUDPlayerIronMax").textContent = + values.IronMax; + document.getElementById("microbeHUDPlayerIronBar").style.width = + common.barHelper(values.compoundIron, values.IronMax); + } diff --git a/scripts/gui/thrive_gui.html b/scripts/gui/thrive_gui.html index 615fbfe7992..265a11e29fc 100644 --- a/scripts/gui/thrive_gui.html +++ b/scripts/gui/thrive_gui.html @@ -251,7 +251,20 @@ - + + +
+
+
+
+
Iron Ions
+
+ 0 / + 0 +
+
+
+
diff --git a/scripts/gui/thrive_style.css b/scripts/gui/thrive_style.css index be1a60e5c95..5bd06bb9487 100644 --- a/scripts/gui/thrive_style.css +++ b/scripts/gui/thrive_style.css @@ -476,6 +476,14 @@ video { background-color: #a02355; } +#IronIcon { + background-image: url("../../Textures/gui/bevel/Iron.png"); +} + +#microbeHUDPlayerIronBar { + background-color: #b7410e; +} + #HealthIcon { background-image: url("../../Textures/gui/bevel/Hitpoints.png"); } diff --git a/scripts/microbe_stage/microbe_stage_hud.as b/scripts/microbe_stage/microbe_stage_hud.as index 5564f1c7efe..552f88b3d82 100644 --- a/scripts/microbe_stage/microbe_stage_hud.as +++ b/scripts/microbe_stage/microbe_stage_hud.as @@ -74,6 +74,10 @@ class MicrobeStageHudSystem : ScriptSystem{ this.hydrogenSulfideVolume = SimulationParameters::compoundRegistry().getTypeData( this.hydrogenSulfideId).volume; + this.ironId = SimulationParameters::compoundRegistry().getTypeId("iron"); + this.ironVolume = SimulationParameters::compoundRegistry().getTypeData( + this.ironId).volume; + } void handleAmbientSound() @@ -160,6 +164,9 @@ class MicrobeStageHudSystem : ScriptSystem{ const auto oxytoxyAmount = bag.getCompoundAmount(oxytoxyId); const auto maxOxytoxy = microbeComponent.capacity; + const auto ironAmount = bag.getCompoundAmount(ironId); + const auto maxIron = microbeComponent.capacity; + // Write data vars.AddValue(ScriptSafeVariableBlock("compoundPhosphate", phosphateAmount)); vars.AddValue(ScriptSafeVariableBlock("PhosphateMax", maxPhosphate)); @@ -178,6 +185,9 @@ class MicrobeStageHudSystem : ScriptSystem{ vars.AddValue(ScriptSafeVariableBlock("compoundOxytoxy", oxytoxyAmount)); vars.AddValue(ScriptSafeVariableBlock("OxytoxyMax", maxOxytoxy)); + + vars.AddValue(ScriptSafeVariableBlock("compoundIron", ironAmount)); + vars.AddValue(ScriptSafeVariableBlock("IronMax", maxIron)); } // Fire it off so that the GUI scripts will get it and update the GUI state @@ -398,6 +408,9 @@ class MicrobeStageHudSystem : ScriptSystem{ CompoundId oxytoxyId; float oxytoxyVolume; + CompoundId ironId; + float ironVolume; + }