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:
@@ -16,6 +16,7 @@ using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Content.Shared.Prying.Components;
|
||||
|
||||
namespace Content.Shared.Doors.Systems;
|
||||
|
||||
@@ -23,14 +24,14 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly IGameTiming GameTiming = default!;
|
||||
[Dependency] protected readonly SharedPhysicsSystem PhysicsSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly SharedStunSystem _stunSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly SharedStunSystem _stunSystem = default!;
|
||||
[Dependency] protected readonly TagSystem Tags = default!;
|
||||
[Dependency] protected readonly SharedAudioSystem Audio = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
|
||||
[Dependency] protected readonly SharedAppearanceSystem AppearanceSystem = default!;
|
||||
[Dependency] private readonly OccluderSystem _occluder = default!;
|
||||
[Dependency] private readonly AccessReaderSystem _accessReaderSystem = default!;
|
||||
[Dependency] private readonly OccluderSystem _occluder = default!;
|
||||
[Dependency] private readonly AccessReaderSystem _accessReaderSystem = default!;
|
||||
|
||||
/// <summary>
|
||||
/// A body must have an intersection percentage larger than this in order to be considered as colliding with a
|
||||
@@ -61,6 +62,8 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<DoorComponent, StartCollideEvent>(HandleCollide);
|
||||
SubscribeLocalEvent<DoorComponent, PreventCollideEvent>(PreventCollision);
|
||||
SubscribeLocalEvent<DoorComponent, GetPryTimeModifierEvent>(OnPryTimeModifier);
|
||||
|
||||
}
|
||||
|
||||
protected virtual void OnComponentInit(EntityUid uid, DoorComponent door, ComponentInit args)
|
||||
@@ -182,6 +185,11 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnPryTimeModifier(EntityUid uid, DoorComponent door, ref GetPryTimeModifierEvent args)
|
||||
{
|
||||
args.BaseTime = door.PryTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the door state/visuals and play an access denied sound when a user without access interacts with the
|
||||
/// door.
|
||||
@@ -206,6 +214,7 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
||||
PlaySound(uid, door.DenySound, AudioParams.Default.WithVolume(-3), user, predicted);
|
||||
}
|
||||
|
||||
|
||||
public bool TryToggleDoor(EntityUid uid, DoorComponent? door = null, EntityUid? user = null, bool predicted = false)
|
||||
{
|
||||
if (!Resolve(uid, ref door))
|
||||
@@ -246,7 +255,7 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
||||
if (door.State == DoorState.Welded)
|
||||
return false;
|
||||
|
||||
var ev = new BeforeDoorOpenedEvent(){User=user};
|
||||
var ev = new BeforeDoorOpenedEvent() { User = user };
|
||||
RaiseLocalEvent(uid, ev, false);
|
||||
if (ev.Cancelled)
|
||||
return false;
|
||||
@@ -261,6 +270,14 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Immediately start opening a door
|
||||
/// </summary>
|
||||
/// <param name="uid"> The uid of the door</param>
|
||||
/// <param name="door"> The doorcomponent of the door</param>
|
||||
/// <param name="user"> The user (if any) opening the door</param>
|
||||
/// <param name="predicted">Whether the interaction would have been
|
||||
/// predicted. See comments in the PlaySound method on the Server system for details</param>
|
||||
public virtual void StartOpening(EntityUid uid, DoorComponent? door = null, EntityUid? user = null, bool predicted = false)
|
||||
{
|
||||
if (!Resolve(uid, ref door))
|
||||
@@ -309,6 +326,14 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Immediately start closing a door
|
||||
/// </summary>
|
||||
/// <param name="uid"> The uid of the door</param>
|
||||
/// <param name="door"> The doorcomponent of the door</param>
|
||||
/// <param name="user"> The user (if any) opening the door</param>
|
||||
/// <param name="predicted">Whether the interaction would have been
|
||||
/// predicted. See comments in the PlaySound method on the Server system for details</param>
|
||||
public bool CanClose(EntityUid uid, DoorComponent? door = null, EntityUid? user = null, bool quiet = true)
|
||||
{
|
||||
if (!Resolve(uid, ref door))
|
||||
@@ -444,11 +469,11 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
||||
|
||||
//TODO: Make only shutters ignore these objects upon colliding instead of all airlocks
|
||||
// Excludes Glasslayer for windows, GlassAirlockLayer for windoors, TableLayer for tables
|
||||
if (!otherPhysics.CanCollide || otherPhysics.CollisionLayer == (int) CollisionGroup.GlassLayer || otherPhysics.CollisionLayer == (int) CollisionGroup.GlassAirlockLayer || otherPhysics.CollisionLayer == (int) CollisionGroup.TableLayer)
|
||||
if (!otherPhysics.CanCollide || otherPhysics.CollisionLayer == (int)CollisionGroup.GlassLayer || otherPhysics.CollisionLayer == (int)CollisionGroup.GlassAirlockLayer || otherPhysics.CollisionLayer == (int)CollisionGroup.TableLayer)
|
||||
continue;
|
||||
|
||||
//If the colliding entity is a slippable item ignore it by the airlock
|
||||
if (otherPhysics.CollisionLayer == (int) CollisionGroup.SlipLayer && otherPhysics.CollisionMask == (int) CollisionGroup.ItemMask)
|
||||
if (otherPhysics.CollisionLayer == (int)CollisionGroup.SlipLayer && otherPhysics.CollisionMask == (int)CollisionGroup.ItemMask)
|
||||
continue;
|
||||
|
||||
if ((physics.CollisionMask & otherPhysics.CollisionLayer) == 0 && (otherPhysics.CollisionMask & physics.CollisionLayer) == 0)
|
||||
@@ -598,7 +623,7 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void CheckDoorBump(DoorComponent component, PhysicsComponent body) {}
|
||||
protected virtual void CheckDoorBump(DoorComponent component, PhysicsComponent body) { }
|
||||
|
||||
/// <summary>
|
||||
/// Makes a door proceed to the next state (if applicable).
|
||||
@@ -659,9 +684,4 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
||||
#endregion
|
||||
|
||||
protected abstract void PlaySound(EntityUid uid, SoundSpecifier soundSpecifier, AudioParams audioParams, EntityUid? predictingPlayer, bool predicted);
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
protected sealed partial class DoorPryDoAfterEvent : SimpleDoAfterEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user