feat: resting indicator in inspect string, common IsResting func

This commit is contained in:
2024-05-08 23:27:42 -05:00
parent 26565b05dc
commit f80d87dc6d
2 changed files with 15 additions and 3 deletions

View File

@@ -6,4 +6,5 @@
<HydroponicsExpanded.HarvestStage>Waiting for all plants to be harvested.</HydroponicsExpanded.HarvestStage>
<HydroponicsExpanded.OccupiedBays>Occupied Plant Bays</HydroponicsExpanded.OccupiedBays>
<HydroponicsExpanded.Growth>Growth</HydroponicsExpanded.Growth>
<HydroponicsExpanded.Resting>resting</HydroponicsExpanded.Resting>
</LanguageData>

View File

@@ -114,8 +114,7 @@ namespace HydroponicsExpanded {
}
// Temperature & time of day check.
float temperature = Position.GetTemperature(Map);
if (temperature.Between(10f, 42f) && GenLocalDate.DayPercent(this).Between(0.25f, 0.8f)) {
if (IsResting()) {
float growthAmount = 1f / (60_000f * growthTrackingPlant.def.plant.growDays) * 250f;
// Debug gizmo can set growth to 100%, thus Math.min check here.
@@ -129,8 +128,16 @@ namespace HydroponicsExpanded {
Stage = HydroponicsStage.Harvest;
}
private void HarvestTick() {
/// <summary>
/// Determines whether the hydroponics basin is in a resting state.
/// </summary>
/// <returns><c>true</c> if the hydroponics basin is in a resting state; otherwise, <c>false</c>.</returns>
private bool IsResting() {
float temperature = Position.GetTemperature(Map);
return temperature.Between(10f, 42f) && GenLocalDate.DayPercent(this).Between(0.25f, 0.8f);
}
private void HarvestTick() {
// Try to place every plant in the container in any cell.
foreach (Thing nextInnerThing in _innerContainer) {
var nextPlant = (Plant)nextInnerThing;
@@ -289,6 +296,10 @@ namespace HydroponicsExpanded {
if (_innerContainer.Count > 0) {
inspectString += "\n";
inspectString += "HydroponicsExpanded.Growth".Translate() + $": {_highestGrowth * 100f:#0}%";
if (IsResting()) {
inspectString += " (" + "HydroponicsExpanded.Resting".Translate() + ")";
}
}
return inspectString;