Fix uses of private internal stage variable, damage plants sitting atop container while unpowered

This commit is contained in:
2023-07-18 00:31:29 -05:00
parent d2a019997c
commit 6cc3d59f8d

View File

@@ -180,17 +180,20 @@ namespace HydroponicsExpanded {
public override void TickRare() { public override void TickRare() {
// Tick the current stage. // Tick the current stage.
HydroponicsStage initialStage = _stage; HydroponicsStage initialStage = Stage;
TickStage(_stage); TickStage(Stage);
// If the stage changed, re-run the next tick. This can allow for instant Grow -> Harvest transition. // If the stage changed, re-run the next tick. This can allow for instant Grow -> Harvest transition.
if (_stage != initialStage) if (_stage != initialStage)
TickStage(_stage); TickStage(Stage);
// Apply rotting damage to all plants while power is cut. // Apply rotting damage to all plants while power is cut.
if (!base.CanAcceptSowNow()) if (!base.CanAcceptSowNow()) {
foreach (Thing thing in _innerContainer) foreach (Thing thing in _innerContainer)
((Plant)thing).TakeDamage(new DamageInfo(DamageDefOf.Rotting, 1f)); ((Plant)thing).TakeDamage(new DamageInfo(DamageDefOf.Rotting, 1f));
foreach (Plant plant in PlantsOnMe)
plant.TakeDamage(new DamageInfo(DamageDefOf.Rotting, 1f));
}
} }
private static readonly Material HydroponicPoweredFillMaterial = private static readonly Material HydroponicPoweredFillMaterial =