mirror of
https://github.com/Xevion/RimWorld-Hydroponics-Expanded.git
synced 2025-12-06 01:16:10 -06:00
feat: resting indicator in inspect string, common IsResting func
This commit is contained in:
@@ -6,4 +6,5 @@
|
|||||||
<HydroponicsExpanded.HarvestStage>Waiting for all plants to be harvested.</HydroponicsExpanded.HarvestStage>
|
<HydroponicsExpanded.HarvestStage>Waiting for all plants to be harvested.</HydroponicsExpanded.HarvestStage>
|
||||||
<HydroponicsExpanded.OccupiedBays>Occupied Plant Bays</HydroponicsExpanded.OccupiedBays>
|
<HydroponicsExpanded.OccupiedBays>Occupied Plant Bays</HydroponicsExpanded.OccupiedBays>
|
||||||
<HydroponicsExpanded.Growth>Growth</HydroponicsExpanded.Growth>
|
<HydroponicsExpanded.Growth>Growth</HydroponicsExpanded.Growth>
|
||||||
|
<HydroponicsExpanded.Resting>resting</HydroponicsExpanded.Resting>
|
||||||
</LanguageData>
|
</LanguageData>
|
||||||
@@ -114,8 +114,7 @@ namespace HydroponicsExpanded {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Temperature & time of day check.
|
// Temperature & time of day check.
|
||||||
float temperature = Position.GetTemperature(Map);
|
if (IsResting()) {
|
||||||
if (temperature.Between(10f, 42f) && GenLocalDate.DayPercent(this).Between(0.25f, 0.8f)) {
|
|
||||||
float growthAmount = 1f / (60_000f * growthTrackingPlant.def.plant.growDays) * 250f;
|
float growthAmount = 1f / (60_000f * growthTrackingPlant.def.plant.growDays) * 250f;
|
||||||
|
|
||||||
// Debug gizmo can set growth to 100%, thus Math.min check here.
|
// Debug gizmo can set growth to 100%, thus Math.min check here.
|
||||||
@@ -129,8 +128,16 @@ namespace HydroponicsExpanded {
|
|||||||
Stage = HydroponicsStage.Harvest;
|
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.
|
// Try to place every plant in the container in any cell.
|
||||||
foreach (Thing nextInnerThing in _innerContainer) {
|
foreach (Thing nextInnerThing in _innerContainer) {
|
||||||
var nextPlant = (Plant)nextInnerThing;
|
var nextPlant = (Plant)nextInnerThing;
|
||||||
@@ -289,6 +296,10 @@ namespace HydroponicsExpanded {
|
|||||||
if (_innerContainer.Count > 0) {
|
if (_innerContainer.Count > 0) {
|
||||||
inspectString += "\n";
|
inspectString += "\n";
|
||||||
inspectString += "HydroponicsExpanded.Growth".Translate() + $": {_highestGrowth * 100f:#0}%";
|
inspectString += "HydroponicsExpanded.Growth".Translate() + $": {_highestGrowth * 100f:#0}%";
|
||||||
|
|
||||||
|
if (IsResting()) {
|
||||||
|
inspectString += " (" + "HydroponicsExpanded.Resting".Translate() + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return inspectString;
|
return inspectString;
|
||||||
|
|||||||
Reference in New Issue
Block a user