]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Allow the Command & Super door remotes to use the access of their user. (Re-creation...
authorBramvanZijp <56019239+BramvanZijp@users.noreply.github.com>
Sun, 29 Jun 2025 16:21:14 +0000 (18:21 +0200)
committerGitHub <noreply@github.com>
Sun, 29 Jun 2025 16:21:14 +0000 (18:21 +0200)
Content.Server/Remotes/DoorRemoteSystem.cs
Content.Shared/Remotes/Components/DoorRemoteComponent.cs
Resources/Prototypes/Catalog/Fills/Lockers/heads.yml
Resources/Prototypes/Entities/Objects/Devices/door_remote.yml

index 27df5ef34d20f4ec7a375c902313a68fa320b043..c3425f347ae46a11ec1cb3db8c4d052d7e584f82 100644 (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");
index b157596e3b950996c54268e9cdc3d1c3d63672a4..64977596c2829abc94fee3825291c002208362cb 100644 (file)
@@ -8,6 +8,13 @@ public sealed partial class DoorRemoteComponent : Component
     [AutoNetworkedField]
     [DataField]
     public OperatingMode Mode = OperatingMode.OpenClose;
+
+    /// <summary>
+    /// Does the remote allow the user to manipulate doors that they have access to, even if the remote itself does not?
+    /// </summary>
+    [AutoNetworkedField]
+    [DataField]
+    public bool IncludeUserAccess = false;
 }
 
 public enum OperatingMode : byte
index 2a15014ce26d07a13698cb2a65d68493ca43753b..6b1efddad1aef0d9d4c76d5b76b22661a42c355f 100644 (file)
@@ -43,7 +43,7 @@
     - id: ClothingHeadsetAltCommand
     - id: ClothingOuterArmorCaptainCarapace
     - id: CommsComputerCircuitboard
-    - id: DoorRemoteCommand
+    - id: DoorRemoteCustom
     - id: MedalCase
     - id: NukeDisk
     - id: PinpointerNuclear
index 45689958cfb45ee5f3c71720de27af3fb8986a46..8f7f6957b201a1c47b670d55b04ea53b5ad5d415 100644 (file)
   - type: Access
     groups:
     - Command
+  - type: DoorRemote
+
+- type: entity
+  parent: [DoorRemoteDefault, BaseCommandContraband]
+  id: DoorRemoteCustom
+  name: custom door remote
+  description: A gadget which can open and bolt doors remotely. This advanced variant does not have built-in access, instead inheriting the ID access of the user.
+  components:
+  - type: Sprite
+    layers:
+    - state: door_remotebase
+    - state: door_remotelightscolour
+      color: "#0077FF"
+    - state: door_remotescreencolour
+      color: "#0033EE"
+  - type: Access
+  - type: DoorRemote
+    includeUserAccess: true
 
 - type: entity
   parent: [DoorRemoteDefault, BaseCommandContraband]
       color: "#2eba22"
     - state: door_remotescreencolour
       color: "#22871a"
+  - type: DoorRemote
+    includeUserAccess: true
   - type: Access
     groups:
     - AllAccess