From d2a019997c0aa383ca0ee1ec6f35504d97db0233 Mon Sep 17 00:00:00 2001 From: Xevion Date: Tue, 18 Jul 2023 00:30:36 -0500 Subject: [PATCH] Add bodge fix re-harvestable plants not being destroyed properly --- .../Buildings/Building_DenseHydroponicsBasin.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/HydroponicsExpanded/Buildings/Building_DenseHydroponicsBasin.cs b/Source/HydroponicsExpanded/Buildings/Building_DenseHydroponicsBasin.cs index 267a334..7bc36fc 100644 --- a/Source/HydroponicsExpanded/Buildings/Building_DenseHydroponicsBasin.cs +++ b/Source/HydroponicsExpanded/Buildings/Building_DenseHydroponicsBasin.cs @@ -145,6 +145,17 @@ namespace HydroponicsExpanded { break; } + // Re-harvestable plants will be destroyed if we think they've been harvested recently. + foreach (Plant plant in PlantsOnMe) { + if (plant.def.plant.HarvestDestroys) continue; + + // Only consider re-harvestable plants eligible if they're still within 20% of their harvest growth level, + // up to 90%. This may need tuning if there are harvestable plants that go to 90% growth. + var minGrowth = plant.def.plant.harvestAfterGrowth; + if (plant.Growth.Between(minGrowth, Math.Min(0.9f, minGrowth + 0.2f), inclusive: true)) + plant.Destroy(); + } + // All plants have been harvested. Switch back to sowing stage. if (_innerContainer.Count == 0) Stage = HydroponicsStage.Sowing;