]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Restrict door remotes to only being able to manipulate doors relevant to their type...
authornikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com>
Sun, 24 Mar 2024 00:48:16 +0000 (02:48 +0200)
committerGitHub <noreply@github.com>
Sun, 24 Mar 2024 00:48:16 +0000 (01:48 +0100)
Restrict door remotes to only being able to manipulate doors relevant to
their type.

Content.Server/Remotes/DoorRemoteSystem.cs

index 57ca0988d94530785a46b537ecbcee0af06034a2..67160650871d4fe5b2aa59ab03e156a74e481049 100644 (file)
@@ -47,10 +47,8 @@ namespace Content.Shared.Remotes
                 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<AccessReaderComponent>(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);
                 Popup.PopupEntity(Loc.GetString("door-remote-denied"), args.User, args.User);
@@ -60,10 +58,7 @@ namespace Content.Shared.Remotes
             switch (entity.Comp.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:
@@ -71,7 +66,7 @@ namespace Content.Shared.Remotes
                     {
                         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");
                         }
                     }