From b1a67ccb7bd35aa4049c728921fdef281716c4c5 Mon Sep 17 00:00:00 2001 From: SimpleStation14 <130339894+SimpleStation14@users.noreply.github.com> Date: Sat, 11 May 2024 10:20:47 -0700 Subject: [PATCH] Mirror: Restrict door remotes to only being able to manipulate doors relevant to their type (#315) ## Mirror of PR #26371: [Restrict door remotes to only being able to manipulate doors relevant to their type](https://github.com/space-wizards/space-station-14/pull/26371) from space-wizards [space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14) ###### `93e3aed26e30375058aa44482236410ff31484f0` PR opened by nikthechampiongr at 2024-03-24 00:28:39 UTC --- PR changed 1 files with 3 additions and 8 deletions. The PR had the following labels: ---

Original Body

> > > > ## About the PR > > This makes it so door remotes can no longer manipulate doors just because their user has access to them. > > ## Why / Balance > > Being able to bolt doors and put them on emergency access from a distance is extremely powerful. You should not be able to do it just because you have the access in your id card, it should be limited to the capabilities of the door remote. > > It also makes no sense. > > ## Technical details > > Relevant calls to check for access, and try open/bolt doors had their arguments changed to pass in the door remote instead of the user so now only the door remote's accesses are checked. > > ## Media > > > - [x] I have added screenshots/videos to this PR showcasing its changes ingame, **or** this PR does not require an ingame showcase > > ## Breaking changes > > > **Changelog** > > > > :cl: > - tweak: Door remotes can now only control doors specific to their type and do not use the access of their user.
Co-authored-by: SimpleStation14 --- Content.Server/Remotes/DoorRemoteSystem.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Content.Server/Remotes/DoorRemoteSystem.cs b/Content.Server/Remotes/DoorRemoteSystem.cs index 9be7e5e96b4..6403c41addf 100644 --- a/Content.Server/Remotes/DoorRemoteSystem.cs +++ b/Content.Server/Remotes/DoorRemoteSystem.cs @@ -80,10 +80,8 @@ private void OnBeforeInteract(EntityUid uid, DoorRemoteComponent component, Befo return; } - // Holding the door remote grants you access to the relevant doors IN ADDITION to what ever access you had. - // This access is enforced in _doorSystem.HasAccess when it calls _accessReaderSystem.IsAllowed if (TryComp(args.Target, out var accessComponent) - && !_doorSystem.HasAccess(args.Target.Value, args.User, doorComp, accessComponent)) + && !_doorSystem.HasAccess(args.Target.Value, args.Used, doorComp, accessComponent)) { _doorSystem.Deny(args.Target.Value, doorComp, args.User); ShowPopupToUser("door-remote-denied", args.User); @@ -93,10 +91,7 @@ private void OnBeforeInteract(EntityUid uid, DoorRemoteComponent component, Befo switch (component.Mode) { case OperatingMode.OpenClose: - // Note we provide args.User here to TryToggleDoor as the "user" - // This means that the door will look at all access items carryed by the player for access, including - // this remote, but also including anything else they are carrying such as a PDA or ID card. - if (_doorSystem.TryToggleDoor(args.Target.Value, doorComp, args.User)) + if (_doorSystem.TryToggleDoor(args.Target.Value, doorComp, args.Used)) _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(args.User):player} used {ToPrettyString(args.Used)} on {ToPrettyString(args.Target.Value)}: {doorComp.State}"); break; case OperatingMode.ToggleBolts: @@ -104,7 +99,7 @@ private void OnBeforeInteract(EntityUid uid, DoorRemoteComponent component, Befo { if (!boltsComp.BoltWireCut) { - _doorSystem.SetBoltsDown((args.Target.Value, boltsComp), !boltsComp.BoltsDown, args.User); + _doorSystem.SetBoltsDown((args.Target.Value, boltsComp), !boltsComp.BoltsDown, args.Used); _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"); } }