add: funny keys that can lock doors (#113)

This commit is contained in:
ThereDrD0
2024-02-23 22:10:38 +03:00
committed by GitHub
parent 26cb9ac1c2
commit 9d31a42880
32 changed files with 386 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
using System.Linq;
using Content.Shared._White.Keyhole.Components;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
using Content.Shared.Damage;
@@ -6,6 +7,7 @@ using Content.Shared.Doors.Components;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Physics;
using Content.Shared.Popups;
using Content.Shared.Prying.Components;
using Content.Shared.Stunnable;
using Content.Shared.Tag;
@@ -30,6 +32,7 @@ public abstract class SharedDoorSystem : EntitySystem
[Dependency] protected readonly SharedAppearanceSystem AppearanceSystem = default!;
[Dependency] private readonly OccluderSystem _occluder = default!;
[Dependency] private readonly AccessReaderSystem _accessReaderSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!; //WD edit
/// <summary>
/// A body must have an intersection percentage larger than this in order to be considered as colliding with a
@@ -211,6 +214,19 @@ public abstract class SharedDoorSystem : EntitySystem
if (!Resolve(uid, ref door))
return false;
// WD edit start
if (TryComp<KeyholeComponent>(uid, out var keyholeComponent))
{
if (keyholeComponent.Locked)
{
PlaySound(uid, keyholeComponent.DoorLockedSound, AudioParams.Default.WithVolume(-3), uid, true);
_popupSystem.PopupEntity(Loc.GetString("door-locked-via-key", ("door", uid)), uid);
return false;
}
}
// WD edit end
if (door.State is DoorState.Closed or DoorState.Denying)
{
return TryOpen(uid, door, user, predicted, quiet: door.State == DoorState.Denying);