]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix AI radial on objects without access (#38444)
authorScarKy0 <106310278+ScarKy0@users.noreply.github.com>
Mon, 13 Oct 2025 20:42:21 +0000 (22:42 +0200)
committerGitHub <noreply@github.com>
Mon, 13 Oct 2025 20:42:21 +0000 (20:42 +0000)
* init

* review

* Update SharedStationAiSystem.cs

* bolt

Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs
Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs
Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs
Resources/Locale/en-US/silicons/station-ai.ftl

index ca2d593dbe1c0995dc4f1fd9df390bff82609410..2bf1ddc3bf8bcc3424b4d59d50a2084b89da44af 100644 (file)
@@ -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<DoorBoltComponent, StationAiBoltEvent>(OnAirlockBolt);
@@ -20,12 +19,18 @@ public abstract partial class SharedStationAiSystem
     /// </summary>
     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
     /// </summary>
     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
index c82e92b4510456d022b2e73f9371b744e7b38ffa..91dd61d33405f470ad8ab15250909623d2613be0 100644 (file)
@@ -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);
+    }
 }
 
 /// <summary>
index e9b2575e40670c7e9b0c1c0415b5d90998fab2cc..fde4952f8680d3f00021b66ad8eb89e7b5d4f767 100644 (file)
@@ -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!;
index 11c51ddea402bbe9859c04eda0467cb7f1cdc9e4..e3451452e465482c3918c06d5b73522362dfc042 100644 (file)
@@ -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