@@ -18,8 +18,12 @@ using Robust.Shared.Containers;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Player;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Content.Server.Tools.Systems;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Sound;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
namespace Content.Server.Doors.Systems;
|
||||
|
||||
@@ -37,6 +41,9 @@ public sealed class DoorSystem : SharedDoorSystem
|
||||
SubscribeLocalEvent<DoorComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<DoorComponent, InteractUsingEvent>(OnInteractUsing, after: new[] { typeof(ConstructionSystem) });
|
||||
|
||||
// Mob prying doors
|
||||
SubscribeLocalEvent<DoorComponent, GetVerbsEvent<AlternativeVerb>>(OnDoorAltVerb);
|
||||
|
||||
SubscribeLocalEvent<DoorComponent, PryFinishedEvent>(OnPryFinished);
|
||||
SubscribeLocalEvent<DoorComponent, PryCancelledEvent>(OnPryCancelled);
|
||||
SubscribeLocalEvent<DoorComponent, WeldableAttemptEvent>(OnWeldAttempt);
|
||||
@@ -152,14 +159,30 @@ public sealed class DoorSystem : SharedDoorSystem
|
||||
SetState(uid, DoorState.Closed, component);
|
||||
}
|
||||
|
||||
private void OnDoorAltVerb(EntityUid uid, DoorComponent component, GetVerbsEvent<AlternativeVerb> args)
|
||||
{
|
||||
if (!args.CanInteract || !TryComp<ToolComponent>(args.User, out var tool) || !tool.Qualities.Contains(component.PryingQuality)) return;
|
||||
|
||||
args.Verbs.Add(new AlternativeVerb()
|
||||
{
|
||||
Text = "Pry door",
|
||||
Impact = LogImpact.Low,
|
||||
Act = () => TryPryDoor(uid, args.User, args.User, component, true),
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pry open a door. This does not check if the user is holding the required tool.
|
||||
/// </summary>
|
||||
private bool TryPryDoor(EntityUid target, EntityUid tool, EntityUid user, DoorComponent door)
|
||||
private bool TryPryDoor(EntityUid target, EntityUid tool, EntityUid user, DoorComponent door, bool force = false)
|
||||
{
|
||||
if (door.BeingPried) return false;
|
||||
|
||||
if (door.State == DoorState.Welded)
|
||||
return false;
|
||||
|
||||
if (!force)
|
||||
{
|
||||
var canEv = new BeforeDoorPryEvent(user);
|
||||
RaiseLocalEvent(target, canEv, false);
|
||||
|
||||
@@ -167,10 +190,12 @@ public sealed class DoorSystem : SharedDoorSystem
|
||||
// mark handled, as airlock component will cancel after generating a pop-up & you don't want to pry a tile
|
||||
// under a windoor.
|
||||
return true;
|
||||
}
|
||||
|
||||
var modEv = new DoorGetPryTimeModifierEvent();
|
||||
RaiseLocalEvent(target, modEv, false);
|
||||
|
||||
door.BeingPried = true;
|
||||
_toolSystem.UseTool(tool, user, target, 0f, modEv.PryTimeModifier * door.PryTime, door.PryingQuality,
|
||||
new PryFinishedEvent(), new PryCancelledEvent(), target);
|
||||
|
||||
|
||||
@@ -4,7 +4,9 @@ using Content.Server.Tools.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Tools;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Threading;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Sound;
|
||||
using Content.Shared.Tools;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -11,6 +11,8 @@ using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Timing;
|
||||
using System.Linq;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
namespace Content.Shared.Doors.Systems;
|
||||
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
behaviorSets:
|
||||
- Idle
|
||||
- UnarmedAttackHostiles
|
||||
- type: Tool
|
||||
speed: 0.3
|
||||
qualities:
|
||||
- Prying
|
||||
useSound:
|
||||
path: /Audio/Items/crowbar.ogg
|
||||
- type: Reactive
|
||||
groups:
|
||||
Flammable: [Touch]
|
||||
|
||||
Reference in New Issue
Block a user