]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Stops plants from growing when they do not have enough resources (#21510)
authorBrandon Hu <103440971+Brandon-Huu@users.noreply.github.com>
Sat, 11 Nov 2023 19:12:13 +0000 (19:12 +0000)
committerGitHub <noreply@github.com>
Sat, 11 Nov 2023 19:12:13 +0000 (11:12 -0800)
Content.Server/Botany/Systems/PlantHolderSystem.cs

index 9991edd230e6dad754837a55d78c922bb03d91f6..817064c6519ccfd3d413ca182ed1786d5b328016 100644 (file)
@@ -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
             {