Fix access mispredicts when having a remote in hand (#14451)
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
using Content.Shared.Access.Components;
|
|
||||||
using Content.Server.Access.Components;
|
using Content.Server.Access.Components;
|
||||||
using Content.Shared.Access.Systems;
|
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Server.UserInterface;
|
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;
|
using Robust.Server.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.Access.Systems
|
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);
|
_popupSystem.PopupEntity(Loc.GetString("agent-id-no-new", ("card", args.Target)), args.Target.Value, args.User);
|
||||||
return;
|
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);
|
_popupSystem.PopupEntity(Loc.GetString("agent-id-new-1", ("card", args.Target)), args.Target.Value, args.User);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_popupSystem.PopupEntity(Loc.GetString("agent-id-new", ("number", addedLength), ("card", args.Target)), args.Target.Value, args.User);
|
_popupSystem.PopupEntity(Loc.GetString("agent-id-new", ("number", addedLength), ("card", args.Target)), args.Target.Value, args.User);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Linq;
|
||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Kitchen.Components;
|
using Content.Server.Kitchen.Components;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
@@ -6,10 +7,8 @@ using Content.Shared.Access.Components;
|
|||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Shared.Player;
|
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Content.Server.Access.Systems
|
namespace Content.Server.Access.Systems
|
||||||
{
|
{
|
||||||
@@ -57,7 +56,10 @@ namespace Content.Server.Access.Systems
|
|||||||
if (randomPick <= 0.25f)
|
if (randomPick <= 0.25f)
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("id-card-component-microwave-bricked", ("id", uid)), uid);
|
_popupSystem.PopupEntity(Loc.GetString("id-card-component-microwave-bricked", ("id", uid)), uid);
|
||||||
|
|
||||||
access.Tags.Clear();
|
access.Tags.Clear();
|
||||||
|
Dirty(access);
|
||||||
|
|
||||||
_adminLogger.Add(LogType.Action, LogImpact.Medium,
|
_adminLogger.Add(LogType.Action, LogImpact.Medium,
|
||||||
$"{ToPrettyString(args.Microwave)} cleared access on {ToPrettyString(uid):entity}");
|
$"{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
|
// Give them a wonderful new access to compensate for everything
|
||||||
var random = _random.Pick(_prototypeManager.EnumeratePrototypes<AccessLevelPrototype>().ToArray());
|
var random = _random.Pick(_prototypeManager.EnumeratePrototypes<AccessLevelPrototype>().ToArray());
|
||||||
|
|
||||||
access.Tags.Add(random.ID);
|
access.Tags.Add(random.ID);
|
||||||
|
Dirty(access);
|
||||||
|
|
||||||
_adminLogger.Add(LogType.Action, LogImpact.Medium,
|
_adminLogger.Add(LogType.Action, LogImpact.Medium,
|
||||||
$"{ToPrettyString(args.Microwave)} added {random.ID} access to {ToPrettyString(uid):entity}");
|
$"{ToPrettyString(args.Microwave)} added {random.ID} access to {ToPrettyString(uid):entity}");
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ namespace Content.Shared.Access.Systems
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
component.Tags.UnionWith(proto.Tags);
|
component.Tags.UnionWith(proto.Tags);
|
||||||
|
Dirty(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +112,7 @@ namespace Content.Shared.Access.Systems
|
|||||||
|
|
||||||
access.Tags.Clear();
|
access.Tags.Clear();
|
||||||
access.Tags.UnionWith(prototype.Access);
|
access.Tags.UnionWith(prototype.Access);
|
||||||
|
Dirty(access);
|
||||||
|
|
||||||
TryAddGroups(uid, prototype.AccessGroups, access);
|
TryAddGroups(uid, prototype.AccessGroups, access);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user