]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix access mispredicts when having a remote in hand (#14451)
authorDrSmugleaf <DrSmugleaf@users.noreply.github.com>
Mon, 6 Mar 2023 19:10:35 +0000 (11:10 -0800)
committerGitHub <noreply@github.com>
Mon, 6 Mar 2023 19:10:35 +0000 (11:10 -0800)
Content.Server/Access/Systems/AgentIDCardSystem.cs
Content.Server/Access/Systems/IdCardSystem.cs
Content.Shared/Access/Systems/SharedAccessSystem.cs

index bf70cd75cc5946621c6080803422c08aad206a76..118a29ba87d6258080dfda3c24419b796d91a6fc 100644 (file)
@@ -1,10 +1,9 @@
-using Content.Shared.Access.Components;
 using Content.Server.Access.Components;
-using Content.Shared.Access.Systems;
-using Content.Shared.Interaction;
 using Content.Server.Popups;
 using Content.Server.UserInterface;
-using Robust.Shared.Player;
+using Content.Shared.Access.Components;
+using Content.Shared.Access.Systems;
+using Content.Shared.Interaction;
 using Robust.Server.GameObjects;
 
 namespace Content.Server.Access.Systems
@@ -42,11 +41,15 @@ namespace Content.Server.Access.Systems
                 _popupSystem.PopupEntity(Loc.GetString("agent-id-no-new", ("card", args.Target)), args.Target.Value, args.User);
                 return;
             }
-            else if (addedLength == 1)
+
+            Dirty(access);
+
+            if (addedLength == 1)
             {
                 _popupSystem.PopupEntity(Loc.GetString("agent-id-new-1", ("card", args.Target)), args.Target.Value, args.User);
                 return;
             }
+
             _popupSystem.PopupEntity(Loc.GetString("agent-id-new", ("number", addedLength), ("card", args.Target)), args.Target.Value, args.User);
         }
 
index de8f707ccf6d0beefab1a36551771045a3a137dc..cebc23aca2613d2d955dbb404865d17748045854 100644 (file)
@@ -1,3 +1,4 @@
+using System.Linq;
 using Content.Server.Administration.Logs;
 using Content.Server.Kitchen.Components;
 using Content.Server.Popups;
@@ -6,10 +7,8 @@ using Content.Shared.Access.Components;
 using Content.Shared.Access.Systems;
 using Content.Shared.Database;
 using Content.Shared.Popups;
-using Robust.Shared.Player;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Random;
-using System.Linq;
 
 namespace Content.Server.Access.Systems
 {
@@ -57,7 +56,10 @@ namespace Content.Server.Access.Systems
                 if (randomPick <= 0.25f)
                 {
                     _popupSystem.PopupEntity(Loc.GetString("id-card-component-microwave-bricked", ("id", uid)), uid);
+
                     access.Tags.Clear();
+                    Dirty(access);
+
                     _adminLogger.Add(LogType.Action, LogImpact.Medium,
                         $"{ToPrettyString(args.Microwave)} cleared access on {ToPrettyString(uid):entity}");
                 }
@@ -68,7 +70,9 @@ namespace Content.Server.Access.Systems
 
                 // Give them a wonderful new access to compensate for everything
                 var random = _random.Pick(_prototypeManager.EnumeratePrototypes<AccessLevelPrototype>().ToArray());
+
                 access.Tags.Add(random.ID);
+                Dirty(access);
 
                 _adminLogger.Add(LogType.Action, LogImpact.Medium,
                         $"{ToPrettyString(args.Microwave)} added {random.ID} access to {ToPrettyString(uid):entity}");
index efa062692a42437e92d3c09260e9f88d8745a7da..85b1cbe37c5a4d96f3c772b009f45a2051879426 100644 (file)
@@ -48,6 +48,7 @@ namespace Content.Shared.Access.Systems
                     continue;
 
                 component.Tags.UnionWith(proto.Tags);
+                Dirty(component);
             }
         }
 
@@ -111,6 +112,7 @@ namespace Content.Shared.Access.Systems
 
             access.Tags.Clear();
             access.Tags.UnionWith(prototype.Access);
+            Dirty(access);
 
             TryAddGroups(uid, prototype.AccessGroups, access);