]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix thirst errors in tests (#20481)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Mon, 25 Sep 2023 01:07:31 +0000 (11:07 +1000)
committerGitHub <noreply@github.com>
Mon, 25 Sep 2023 01:07:31 +0000 (18:07 -0700)
Content.IntegrationTests/Tests/Slipping/SlippingTest.cs
Content.Shared/Nutrition/Components/ThirstComponent.cs
Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs

index d64961b0becb73fc28399e8ddad432915009a229..7f77146f4552a03a9a3118bc27681569da34dc8f 100644 (file)
@@ -1,6 +1,7 @@
 #nullable enable
 using System.Collections.Generic;
 using Content.IntegrationTests.Tests.Interaction;
+using Content.Shared.Movement.Components;
 using Content.Shared.Slippery;
 using Content.Shared.Stunnable;
 using Robust.Shared.GameObjects;
@@ -31,6 +32,9 @@ public sealed class SlippingTest : MovementTest
         var sys = SEntMan.System<SlipTestSystem>();
         await SpawnTarget("TrashBananaPeel");
 
+        var modifier = Comp<MovementSpeedModifierComponent>(Player).SprintSpeedModifier;
+        Assert.That(modifier, Is.EqualTo(1), "Player is not moving at full speed.");
+
         // Player is to the left of the banana peel and has not slipped.
 #pragma warning disable NUnit2045
         Assert.That(Delta(), Is.GreaterThan(0.5f));
index e5604de57b3481ac841f06d95f3c4a42f188ff95..ec2ff10667b17555e9b5c7e48407aedb291c6a06 100644 (file)
@@ -19,13 +19,10 @@ public sealed partial class ThirstComponent : Component
     [AutoNetworkedField]
     public float ActualDecayRate;
 
-    // Thirst
-    [ViewVariables(VVAccess.ReadOnly)]
-    [AutoNetworkedField]
+    [DataField, AutoNetworkedField]
     public ThirstThreshold CurrentThirstThreshold;
 
-    [ViewVariables(VVAccess.ReadOnly)]
-    [AutoNetworkedField]
+    [DataField, AutoNetworkedField]
     public ThirstThreshold LastThirstThreshold;
 
     [ViewVariables(VVAccess.ReadWrite)]
@@ -38,13 +35,13 @@ public sealed partial class ThirstComponent : Component
     /// </summary>
     [DataField("nextUpdateTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
     [AutoNetworkedField]
-    public TimeSpan NextUpdateTime;
+    public TimeSpan NextUpdateTime = TimeSpan.MaxValue;
 
     /// <summary>
     /// The time between each update.
     /// </summary>
     [ViewVariables(VVAccess.ReadWrite)]
-    [AutoNetworkedField]
+    [DataField, AutoNetworkedField]
     public TimeSpan UpdateRate = TimeSpan.FromSeconds(1);
 
     [DataField("thresholds")]
index b75a6d1a0a518760491123c331c4d97c1b34ea52..05a2338768fc9e5680fe9548fc3d85fadcfd613d 100644 (file)
@@ -46,6 +46,9 @@ public sealed class ThirstSystem : EntitySystem
         component.LastThirstThreshold = ThirstThreshold.Okay; // TODO: Potentially change this -> Used Okay because no effects.
         // TODO: Check all thresholds make sense and throw if they don't.
         UpdateEffects(uid, component);
+
+        TryComp(uid, out MovementSpeedModifierComponent? moveMod);
+            _movement.RefreshMovementSpeedModifiers(uid, moveMod);
     }
 
     private void OnRefreshMovespeed(EntityUid uid, ThirstComponent component, RefreshMovementSpeedModifiersEvent args)
@@ -179,7 +182,6 @@ public sealed class ThirstSystem : EntitySystem
 
             thirst.CurrentThirstThreshold = calculatedThirstThreshold;
             UpdateEffects(uid, thirst);
-            Dirty(uid, thirst);
         }
     }