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