]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fixed PaperSystem bugs (#22896)
authorLordCarve <27449516+LordCarve@users.noreply.github.com>
Sun, 24 Dec 2023 08:58:00 +0000 (09:58 +0100)
committerGitHub <noreply@github.com>
Sun, 24 Dec 2023 08:58:00 +0000 (19:58 +1100)
Content.Client/Paper/UI/PaperBoundUserInterface.cs
Content.Server/Paper/PaperSystem.cs

index e047fdf84bcba592a0dc7435f6c9784d0257c911..30f1502779ec71693efb21ae5554937808262585 100644 (file)
@@ -1,5 +1,4 @@
 using JetBrains.Annotations;
-using Robust.Client.GameObjects;
 using Robust.Client.UserInterface.Controls;
 using Robust.Shared.Input;
 using Robust.Shared.Utility;
@@ -49,15 +48,12 @@ public sealed class PaperBoundUserInterface : BoundUserInterface
 
     private void Input_OnTextEntered(string text)
     {
-        if (!string.IsNullOrEmpty(text))
-        {
-            SendMessage(new PaperInputTextMessage(text));
+        SendMessage(new PaperInputTextMessage(text));
 
-            if (_window != null)
-            {
-                _window.Input.TextRope = Rope.Leaf.Empty;
-                _window.Input.CursorPosition = new TextEdit.CursorPos(0, TextEdit.LineBreakBias.Top);
-            }
+        if (_window != null)
+        {
+            _window.Input.TextRope = Rope.Leaf.Empty;
+            _window.Input.CursorPosition = new TextEdit.CursorPos(0, TextEdit.LineBreakBias.Top);
         }
     }
 
index 304507bdeb6794b1637a9510f1cb62e6c39dac2f..22f39cd35b8aa4e82aa08793cadd863c1549c7cc 100644 (file)
@@ -9,8 +9,6 @@ using Content.Shared.Paper;
 using Content.Shared.Tag;
 using Robust.Server.GameObjects;
 using Robust.Shared.Player;
-using Robust.Shared.Utility;
-using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
 using static Content.Shared.Paper.SharedPaperComponent;
 
@@ -134,9 +132,10 @@ namespace Content.Server.Paper
             }
         }
 
-        private StampDisplayInfo GetStampInfo(StampComponent stamp)
+        private static StampDisplayInfo GetStampInfo(StampComponent stamp)
         {
-            return new StampDisplayInfo {
+            return new StampDisplayInfo
+            {
                 StampedName = stamp.StampedName,
                 StampedColor = stamp.StampedColor
             };
@@ -144,21 +143,20 @@ namespace Content.Server.Paper
 
         private void OnInputTextMessage(EntityUid uid, PaperComponent paperComp, PaperInputTextMessage args)
         {
-            if (string.IsNullOrEmpty(args.Text))
-                return;
-
-            if (args.Text.Length + paperComp.Content.Length <= paperComp.ContentSize)
+            if (args.Text.Length <= paperComp.ContentSize)
+            {
                 paperComp.Content = args.Text;
 
-            if (TryComp<AppearanceComponent>(uid, out var appearance))
-                _appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance);
+                if (TryComp<AppearanceComponent>(uid, out var appearance))
+                    _appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance);
 
-            if (TryComp<MetaDataComponent>(uid, out var meta))
-                _metaSystem.SetEntityDescription(uid, "", meta);
+                if (TryComp<MetaDataComponent>(uid, out var meta))
+                    _metaSystem.SetEntityDescription(uid, "", meta);
 
-            if (args.Session.AttachedEntity != null)
-                _adminLogger.Add(LogType.Chat, LogImpact.Low,
-                    $"{ToPrettyString(args.Session.AttachedEntity.Value):player} has written on {ToPrettyString(uid):entity} the following text: {args.Text}");
+                if (args.Session.AttachedEntity != null)
+                    _adminLogger.Add(LogType.Chat, LogImpact.Low,
+                        $"{ToPrettyString(args.Session.AttachedEntity.Value):player} has written on {ToPrettyString(uid):entity} the following text: {args.Text}");
+            }
 
             paperComp.Mode = PaperAction.Read;
             UpdateUserInterface(uid, paperComp);