diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs index ca2d593dbe..2bf1ddc3bf 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs @@ -4,10 +4,9 @@ using Content.Shared.Electrocution; namespace Content.Shared.Silicons.StationAi; +// Handles airlock radial public abstract partial class SharedStationAiSystem { - // Handles airlock radial - private void InitializeAirlock() { SubscribeLocalEvent(OnAirlockBolt); @@ -20,12 +19,18 @@ public abstract partial class SharedStationAiSystem /// private void OnAirlockBolt(EntityUid ent, DoorBoltComponent component, StationAiBoltEvent args) { - if (component.BoltWireCut) + if (component.BoltWireCut || !PowerReceiver.IsPowered(ent)) { ShowDeviceNotRespondingPopup(args.User); return; } + if (!_access.IsAllowed(args.User, ent)) + { + ShowDeviceNoAccessPopup(args.User); + return; + } + var setResult = _doors.TrySetBoltDown((ent, component), args.Bolted, args.User, predicted: true); if (!setResult) { @@ -44,6 +49,12 @@ public abstract partial class SharedStationAiSystem return; } + if (!_access.IsAllowed(args.User, ent)) + { + ShowDeviceNoAccessPopup(args.User); + return; + } + _airlocks.SetEmergencyAccess((ent, component), args.EmergencyAccess, args.User, predicted: true); } @@ -52,15 +63,18 @@ public abstract partial class SharedStationAiSystem /// private void OnElectrified(EntityUid ent, ElectrifiedComponent component, StationAiElectrifiedEvent args) { - if ( - component.IsWireCut - || !PowerReceiver.IsPowered(ent) - ) + if (component.IsWireCut || !PowerReceiver.IsPowered(ent)) { ShowDeviceNotRespondingPopup(args.User); return; } + if (!_access.IsAllowed(args.User, ent)) + { + ShowDeviceNoAccessPopup(args.User); + return; + } + _electrify.SetElectrified((ent, component), args.Electrified); var soundToPlay = component.Enabled ? component.AirlockElectrifyDisabled diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs index c82e92b451..91dd61d334 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs @@ -206,6 +206,11 @@ public abstract partial class SharedStationAiSystem { _popup.PopupClient(Loc.GetString("ai-device-not-responding"), toEntity, PopupType.MediumCaution); } + + private void ShowDeviceNoAccessPopup(EntityUid toEntity) + { + _popup.PopupClient(Loc.GetString("ai-device-no-access"), toEntity, PopupType.MediumCaution); + } } /// diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs index e9b2575e40..fde4952f86 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared.Access.Systems; using Content.Shared.ActionBlocker; using Content.Shared.Actions; using Content.Shared.Administration.Managers; @@ -42,6 +43,7 @@ public abstract partial class SharedStationAiSystem : EntitySystem [Dependency] private readonly INetManager _net = default!; [Dependency] private readonly ItemSlotsSystem _slots = default!; [Dependency] private readonly ItemToggleSystem _toggles = default!; + [Dependency] private readonly AccessReaderSystem _access = default!; [Dependency] private readonly ActionBlockerSystem _blocker = default!; [Dependency] private readonly MetaDataSystem _metadata = default!; [Dependency] private readonly SharedAirlockSystem _airlocks = default!; diff --git a/Resources/Locale/en-US/silicons/station-ai.ftl b/Resources/Locale/en-US/silicons/station-ai.ftl index 11c51ddea4..e3451452e4 100644 --- a/Resources/Locale/en-US/silicons/station-ai.ftl +++ b/Resources/Locale/en-US/silicons/station-ai.ftl @@ -25,6 +25,7 @@ electrify-door-off = Disable overcharge toggle-light = Toggle light ai-device-not-responding = Device is not responding +ai-device-no-access = You have no access to this device ai-consciousness-download-warning = Your consciousness is being downloaded. @@ -48,4 +49,4 @@ station-ai-hologram-female = Female appearance station-ai-hologram-male = Male appearance station-ai-hologram-face = Disembodied head station-ai-hologram-cat = Cat form -station-ai-hologram-dog = Corgi form \ No newline at end of file +station-ai-hologram-dog = Corgi form