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; 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) 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) 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); Popup.PopupEntity(Loc.GetString("door-remote-denied"), args.User, args.User);
return; return;
} }
@@ -63,7 +71,7 @@ namespace Content.Shared.Remotes
switch (entity.Comp.Mode) switch (entity.Comp.Mode)
{ {
case OperatingMode.OpenClose: case OperatingMode.OpenClose:
if (_doorSystem.TryToggleDoor(args.Target.Value, doorComp, args.Used)) if (_doorSystem.TryToggleDoor(args.Target.Value, doorComp, accessTarget))
_adminLogger.Add(LogType.Action, _adminLogger.Add(LogType.Action,
LogImpact.Medium, LogImpact.Medium,
$"{ToPrettyString(args.User):player} used {ToPrettyString(args.Used)} on {ToPrettyString(args.Target.Value)}: {doorComp.State}"); $"{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) 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, _adminLogger.Add(LogType.Action,
LogImpact.Medium, LogImpact.Medium,
$"{ToPrettyString(args.User):player} used {ToPrettyString(args.Used)} on {ToPrettyString(args.Target.Value)} to {(boltsComp.BoltsDown ? "" : "un")}bolt it"); $"{ToPrettyString(args.User):player} used {ToPrettyString(args.Used)} on {ToPrettyString(args.Target.Value)} to {(boltsComp.BoltsDown ? "" : "un")}bolt it");

View File

@@ -8,6 +8,13 @@ public sealed partial class DoorRemoteComponent : Component
[AutoNetworkedField] [AutoNetworkedField]
[DataField] [DataField]
public OperatingMode Mode = OperatingMode.OpenClose; 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 public enum OperatingMode : byte

View File

@@ -43,7 +43,7 @@
- id: ClothingHeadsetAltCommand - id: ClothingHeadsetAltCommand
- id: ClothingOuterArmorCaptainCarapace - id: ClothingOuterArmorCaptainCarapace
- id: CommsComputerCircuitboard - id: CommsComputerCircuitboard
- id: DoorRemoteCommand - id: DoorRemoteCustom
- id: MedalCase - id: MedalCase
- id: NukeDisk - id: NukeDisk
- id: PinpointerNuclear - id: PinpointerNuclear

View File

@@ -29,6 +29,24 @@
- type: Access - type: Access
groups: groups:
- Command - 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 - type: entity
parent: [DoorRemoteDefault, BaseCommandContraband] parent: [DoorRemoteDefault, BaseCommandContraband]
@@ -155,6 +173,8 @@
color: "#2eba22" color: "#2eba22"
- state: door_remotescreencolour - state: door_remotescreencolour
color: "#22871a" color: "#22871a"
- type: DoorRemote
includeUserAccess: true
- type: Access - type: Access
groups: groups:
- AllAccess - AllAccess