Fix AI radial on objects without access (#38444)
* init * review * Update SharedStationAiSystem.cs * bolt
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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!;
|
||||
|
||||
Reference in New Issue
Block a user