From c032fad909fd623e9592052fd0c368d105c3a304 Mon Sep 17 00:00:00 2001 From: Brandon Hu <103440971+Brandon-Huu@users.noreply.github.com> Date: Sat, 11 Nov 2023 19:12:13 +0000 Subject: [PATCH] Stops plants from growing when they do not have enough resources (#21510) --- .../Botany/Systems/PlantHolderSystem.cs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Content.Server/Botany/Systems/PlantHolderSystem.cs b/Content.Server/Botany/Systems/PlantHolderSystem.cs index 9991edd230..817064c651 100644 --- a/Content.Server/Botany/Systems/PlantHolderSystem.cs +++ b/Content.Server/Botany/Systems/PlantHolderSystem.cs @@ -441,12 +441,14 @@ public sealed class PlantHolderSystem : EntitySystem component.Health -= 6 * healthMod; } - // Make sure the plant is not starving. - if (_random.Prob(0.35f)) + // Prevents the plant from aging when lacking resources. + // Limits the effect on aging so that when resources are added, the plant starts growing in a reasonable amount of time. + if (component.SkipAging < 10) { + // Make sure the plant is not starving. if (component.NutritionLevel > 5) { - component.Health += healthMod; + component.Health += Convert.ToInt32(_random.Prob(0.35f)) * healthMod; } else { @@ -454,16 +456,10 @@ public sealed class PlantHolderSystem : EntitySystem component.Health -= healthMod; } - if (component.DrawWarnings) - component.UpdateSpriteAfterUpdate = true; - } - - // Make sure the plant is not thirsty. - if (_random.Prob(0.35f)) - { + // Make sure the plant is not thirsty. if (component.WaterLevel > 10) { - component.Health += healthMod; + component.Health += Convert.ToInt32(_random.Prob(0.35f)) * healthMod; } else { -- 2.51.2