]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Debug command to make you thirsty (#30562)
authorMervill <mervills.email@gmail.com>
Fri, 2 Aug 2024 15:49:08 +0000 (08:49 -0700)
committerGitHub <noreply@github.com>
Fri, 2 Aug 2024 15:49:08 +0000 (01:49 +1000)
* debug command to make you thirsty

* pr feedback

Content.Server/Nutrition/Thirsty.cs [new file with mode: 0644]
Resources/Locale/en-US/nutrition/nutrition-commands.ftl [new file with mode: 0644]

diff --git a/Content.Server/Nutrition/Thirsty.cs b/Content.Server/Nutrition/Thirsty.cs
new file mode 100644 (file)
index 0000000..8725a62
--- /dev/null
@@ -0,0 +1,38 @@
+using Content.Server.Administration;
+using Content.Shared.Administration;
+using Content.Shared.Nutrition.Components;
+using Content.Shared.Nutrition.EntitySystems;
+using Robust.Shared.Console;
+
+namespace Content.Server.Nutrition;
+
+[AdminCommand(AdminFlags.Debug)]
+public sealed class Thirsty : LocalizedEntityCommands
+{
+    public override string Command => "thirsty";
+
+    public override void Execute(IConsoleShell shell, string argStr, string[] args)
+    {
+        var player = shell.Player;
+        if (player == null)
+        {
+            shell.WriteError(Loc.GetString("cmd-nutrition-error-player"));
+            return;
+        }
+
+        if (player.AttachedEntity is not {Valid: true} playerEntity)
+        {
+            shell.WriteError(Loc.GetString("cmd-nutrition-error-entity"));
+            return;
+        }
+
+        if (!EntityManager.TryGetComponent(playerEntity, out ThirstComponent? thirst))
+        {
+            shell.WriteError(Loc.GetString("cmd-nutrition-error-component", ("comp", nameof(ThirstComponent))));
+            return;
+        }
+
+        var thirstyThreshold = thirst.ThirstThresholds[ThirstThreshold.Parched];
+        EntityManager.System<ThirstSystem>().SetThirst(playerEntity, thirst, thirstyThreshold);
+    }
+}
diff --git a/Resources/Locale/en-US/nutrition/nutrition-commands.ftl b/Resources/Locale/en-US/nutrition/nutrition-commands.ftl
new file mode 100644 (file)
index 0000000..8e6712c
--- /dev/null
@@ -0,0 +1,6 @@
+cmd-nutrition-error-player = You cannot use this command unless you are a player.
+cmd-nutrition-error-entity = You cannot use this command without an entity.
+cmd-nutrition-error-component = Your entity does not have a {$comp} component.
+
+cmd-thirsty-desc = makes you thirsty
+cmd-thirsty-help = sets your thirst level to partched