make jaws of life not awful (#10770)
This commit is contained in:
@@ -36,6 +36,14 @@ namespace Content.Server.Doors.Components
|
||||
[DataField("powerWiresTimeout")]
|
||||
public float PowerWiresTimeout = 5.0f;
|
||||
|
||||
/// <summary>
|
||||
/// Pry modifier for a powered airlock.
|
||||
/// Most anything that can pry powered has a pry speed bonus,
|
||||
/// so this default is closer to 6 effectively on e.g. jaws (9 seconds when applied to other default.)
|
||||
/// </summary>
|
||||
[DataField("poweredPryModifier")]
|
||||
public readonly float PoweredPryModifier = 9f;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the maintenance panel should be visible even if the airlock is opened.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Server.Doors.Components;
|
||||
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;
|
||||
@@ -13,6 +15,7 @@ namespace Content.Server.Doors.Systems
|
||||
public sealed class AirlockSystem : SharedAirlockSystem
|
||||
{
|
||||
[Dependency] private readonly WiresSystem _wiresSystem = default!;
|
||||
[Dependency] private readonly PowerReceiverSystem _power = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -23,6 +26,7 @@ namespace Content.Server.Doors.Systems
|
||||
SubscribeLocalEvent<AirlockComponent, BeforeDoorOpenedEvent>(OnBeforeDoorOpened);
|
||||
SubscribeLocalEvent<AirlockComponent, BeforeDoorDeniedEvent>(OnBeforeDoorDenied);
|
||||
SubscribeLocalEvent<AirlockComponent, ActivateInWorldEvent>(OnActivate, before: new [] {typeof(DoorSystem)});
|
||||
SubscribeLocalEvent<AirlockComponent, DoorGetPryTimeModifierEvent>(OnGetPryMod);
|
||||
SubscribeLocalEvent<AirlockComponent, BeforeDoorPryEvent>(OnDoorPry);
|
||||
}
|
||||
|
||||
@@ -132,6 +136,12 @@ namespace Content.Server.Doors.Systems
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGetPryMod(EntityUid uid, AirlockComponent component, DoorGetPryTimeModifierEvent args)
|
||||
{
|
||||
if (_power.IsPowered(uid))
|
||||
args.PryTimeModifier *= component.PoweredPryModifier;
|
||||
}
|
||||
|
||||
private void OnDoorPry(EntityUid uid, AirlockComponent component, BeforeDoorPryEvent args)
|
||||
{
|
||||
if (component.IsBolted())
|
||||
@@ -141,6 +151,8 @@ namespace Content.Server.Doors.Systems
|
||||
}
|
||||
if (component.IsPowered())
|
||||
{
|
||||
if (HasComp<ToolForcePoweredComponent>(args.Tool))
|
||||
return;
|
||||
component.Owner.PopupMessage(args.User, Loc.GetString("airlock-component-cannot-pry-is-powered-message"));
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
@@ -174,6 +174,7 @@ public sealed class DoorSystem : SharedDoorSystem
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Pry open a door. This does not check if the user is holding the required tool.
|
||||
/// </summary>
|
||||
@@ -187,7 +188,7 @@ public sealed class DoorSystem : SharedDoorSystem
|
||||
|
||||
if (!force)
|
||||
{
|
||||
var canEv = new BeforeDoorPryEvent(user);
|
||||
var canEv = new BeforeDoorPryEvent(user, tool);
|
||||
RaiseLocalEvent(target, canEv, false);
|
||||
|
||||
if (canEv.Cancelled)
|
||||
|
||||
@@ -78,10 +78,12 @@ namespace Content.Shared.Doors
|
||||
public sealed class BeforeDoorPryEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public readonly EntityUid User;
|
||||
public readonly EntityUid Tool;
|
||||
|
||||
public BeforeDoorPryEvent(EntityUid user)
|
||||
public BeforeDoorPryEvent(EntityUid user, EntityUid tool)
|
||||
{
|
||||
User = user;
|
||||
Tool = tool;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
Content.Shared/Tools/Components/ToolForcePoweredComponent.cs
Normal file
10
Content.Shared/Tools/Components/ToolForcePoweredComponent.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Content.Shared.Tools.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Tag component to let a tool ignore restrictions on whether devices are powered
|
||||
/// or not to work.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class ToolForcePoweredComponent : Component
|
||||
{}
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
qualities:
|
||||
- Prying
|
||||
speed: 1.5
|
||||
- type: ToolForcePowered
|
||||
- type: MultipleTool
|
||||
statusShowBehavior: true
|
||||
entries:
|
||||
|
||||
Reference in New Issue
Block a user