EasyPry airlocks for arrivals. Now also prying refactor I guess (#19394)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Content.Server.DeviceLinking.Events;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Content.Server.Wires;
|
||||
using Content.Shared.Doors;
|
||||
using Content.Shared.Doors.Components;
|
||||
@@ -9,6 +8,7 @@ using Content.Shared.Doors.Systems;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Server.GameObjects;
|
||||
using Content.Shared.Wires;
|
||||
using Content.Shared.Prying.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Doors.Systems;
|
||||
@@ -31,9 +31,9 @@ public sealed class AirlockSystem : SharedAirlockSystem
|
||||
SubscribeLocalEvent<AirlockComponent, DoorStateChangedEvent>(OnStateChanged);
|
||||
SubscribeLocalEvent<AirlockComponent, BeforeDoorOpenedEvent>(OnBeforeDoorOpened);
|
||||
SubscribeLocalEvent<AirlockComponent, BeforeDoorDeniedEvent>(OnBeforeDoorDenied);
|
||||
SubscribeLocalEvent<AirlockComponent, ActivateInWorldEvent>(OnActivate, before: new [] {typeof(DoorSystem)});
|
||||
SubscribeLocalEvent<AirlockComponent, DoorGetPryTimeModifierEvent>(OnGetPryMod);
|
||||
SubscribeLocalEvent<AirlockComponent, BeforeDoorPryEvent>(OnDoorPry);
|
||||
SubscribeLocalEvent<AirlockComponent, ActivateInWorldEvent>(OnActivate, before: new[] { typeof(DoorSystem) });
|
||||
SubscribeLocalEvent<AirlockComponent, GetPryTimeModifierEvent>(OnGetPryMod);
|
||||
SubscribeLocalEvent<AirlockComponent, BeforePryEvent>(OnBeforePry);
|
||||
|
||||
}
|
||||
|
||||
@@ -169,20 +169,18 @@ public sealed class AirlockSystem : SharedAirlockSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGetPryMod(EntityUid uid, AirlockComponent component, DoorGetPryTimeModifierEvent args)
|
||||
private void OnGetPryMod(EntityUid uid, AirlockComponent component, ref GetPryTimeModifierEvent args)
|
||||
{
|
||||
if (_power.IsPowered(uid))
|
||||
args.PryTimeModifier *= component.PoweredPryModifier;
|
||||
}
|
||||
|
||||
private void OnDoorPry(EntityUid uid, AirlockComponent component, BeforeDoorPryEvent args)
|
||||
private void OnBeforePry(EntityUid uid, AirlockComponent component, ref BeforePryEvent args)
|
||||
{
|
||||
if (this.IsPowered(uid, EntityManager))
|
||||
if (this.IsPowered(uid, EntityManager) && !args.PryPowered)
|
||||
{
|
||||
if (HasComp<ToolForcePoweredComponent>(args.Tool))
|
||||
return;
|
||||
Popup.PopupEntity(Loc.GetString("airlock-component-cannot-pry-is-powered-message"), uid, args.User);
|
||||
args.Cancel();
|
||||
Popup.PopupClient(Loc.GetString("airlock-component-cannot-pry-is-powered-message"), uid, args.User);
|
||||
args.Cancelled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user