Allow the Command & Super door remotes to use the access of their user. (Re-creation of PR due to changes to game balance) (#35536)

This commit is contained in:
BramvanZijp
2025-06-29 18:21:14 +02:00
committed by GitHub
parent 5d191d7b87
commit 7951db15ca
4 changed files with 40 additions and 5 deletions

View File

@@ -51,11 +51,19 @@ namespace Content.Shared.Remotes
return;
}
var accessTarget = args.Used;
// This covers the accesses the REMOTE has, and is not effected by the user's ID card.
if (entity.Comp.IncludeUserAccess) // Allows some door remotes to inherit the user's access.
{
accessTarget = args.User;
// This covers the accesses the USER has, which always includes the remote's access since holding a remote acts like holding an ID card.
}
if (TryComp<AccessReaderComponent>(args.Target, out var accessComponent)
&& !_doorSystem.HasAccess(args.Target.Value, args.Used, doorComp, accessComponent))
&& !_doorSystem.HasAccess(args.Target.Value, accessTarget, doorComp, accessComponent))
{
if (isAirlock)
_doorSystem.Deny(args.Target.Value, doorComp, args.User);
_doorSystem.Deny(args.Target.Value, doorComp, accessTarget);
Popup.PopupEntity(Loc.GetString("door-remote-denied"), args.User, args.User);
return;
}
@@ -63,7 +71,7 @@ namespace Content.Shared.Remotes
switch (entity.Comp.Mode)
{
case OperatingMode.OpenClose:
if (_doorSystem.TryToggleDoor(args.Target.Value, doorComp, args.Used))
if (_doorSystem.TryToggleDoor(args.Target.Value, doorComp, accessTarget))
_adminLogger.Add(LogType.Action,
LogImpact.Medium,
$"{ToPrettyString(args.User):player} used {ToPrettyString(args.Used)} on {ToPrettyString(args.Target.Value)}: {doorComp.State}");
@@ -73,7 +81,7 @@ namespace Content.Shared.Remotes
{
if (!boltsComp.BoltWireCut)
{
_doorSystem.SetBoltsDown((args.Target.Value, boltsComp), !boltsComp.BoltsDown, args.Used);
_doorSystem.SetBoltsDown((args.Target.Value, boltsComp), !boltsComp.BoltsDown, accessTarget);
_adminLogger.Add(LogType.Action,
LogImpact.Medium,
$"{ToPrettyString(args.User):player} used {ToPrettyString(args.Used)} on {ToPrettyString(args.Target.Value)} to {(boltsComp.BoltsDown ? "" : "un")}bolt it");