Skip to content

Commit

Permalink
There is now an Iron Ions bar. Which gets filled up when you gather i…
Browse files Browse the repository at this point in the history
…ron.
  • Loading branch information
Untrustedlife authored and hhyyrylainen committed Feb 15, 2019
1 parent 0daad6c commit a803c90
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
7 changes: 7 additions & 0 deletions scripts/gui/microbe_hud.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
15 changes: 14 additions & 1 deletion scripts/gui/thrive_gui.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,20 @@
</div>
</div>
</div>


<!-- Iron -->
<div class="Bar">
<div class="BarBackground" id="microbeHUDPlayerIronBar">
<div class="BarForeground">
<div class="compoundIcon" id="IronIcon"></div>
<div class="BarTitle">Iron Ions</div>
<div class="BarValue">
<span id="microbeHUDPlayerIron">0</span> /
<span id="microbeHUDPlayerIronMax">0</span>
</div>
</div>
</div>
</div>
</div>


Expand Down
8 changes: 8 additions & 0 deletions scripts/gui/thrive_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
13 changes: 13 additions & 0 deletions scripts/microbe_stage/microbe_stage_hud.as
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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));
Expand All @@ -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
Expand Down Expand Up @@ -398,6 +408,9 @@ class MicrobeStageHudSystem : ScriptSystem{
CompoundId oxytoxyId;
float oxytoxyVolume;

CompoundId ironId;
float ironVolume;

}


Expand Down

0 comments on commit a803c90

Please sign in to comment.