Fix access mispredicts when having a remote in hand (#14451)

This commit is contained in:
DrSmugleaf
2023-03-06 11:10:35 -08:00
committed by GitHub
parent c9e70d8ea0
commit f4ccfc5e35
3 changed files with 16 additions and 7 deletions

View 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}");