fix: fix some bugs with keyhole system (#120)
This commit is contained in:
@@ -10,6 +10,9 @@ using Robust.Shared.Random;
|
|||||||
|
|
||||||
namespace Content.Server._White.Keyhole;
|
namespace Content.Server._White.Keyhole;
|
||||||
|
|
||||||
|
// TODO: Исправить, что дверь на замке можно разобрать через ее id: DoorGraph
|
||||||
|
// TODO: Исправить, что при прерывании закрытия девственной двери форма замка принимает форму ключа, хотя закрытия не произошло
|
||||||
|
|
||||||
public sealed partial class KeyholeSystem : EntitySystem
|
public sealed partial class KeyholeSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -66,7 +69,7 @@ public sealed partial class KeyholeSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnDoAfter(EntityUid uid, KeyholeComponent component, KeyInsertDoAfterEvent args)
|
private void OnDoAfter(EntityUid uid, KeyholeComponent component, KeyInsertDoAfterEvent args)
|
||||||
{
|
{
|
||||||
if (args.Handled || args.Cancelled)
|
if (args.Handled || args.Cancelled || IsStateChanging(uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Lock(uid, component, args.User);
|
Lock(uid, component, args.User);
|
||||||
@@ -74,6 +77,12 @@ public sealed partial class KeyholeSystem : EntitySystem
|
|||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsStateChanging(EntityUid uid)
|
||||||
|
{
|
||||||
|
return TryComp<DoorComponent>(uid, out var doorComponent) &&
|
||||||
|
(doorComponent.State == DoorState.Closing || doorComponent.State == DoorState.Opening);
|
||||||
|
}
|
||||||
|
|
||||||
private void Lock(EntityUid uid, KeyholeComponent component, EntityUid user)
|
private void Lock(EntityUid uid, KeyholeComponent component, EntityUid user)
|
||||||
{
|
{
|
||||||
var sound = component.Locked ? component.UnlockSound : component.LockSound;
|
var sound = component.Locked ? component.UnlockSound : component.LockSound;
|
||||||
|
|||||||
@@ -178,10 +178,11 @@ public abstract class SharedDoorSystem : EntitySystem
|
|||||||
args.BaseTime = door.PryTime;
|
args.BaseTime = door.PryTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBeforePry(EntityUid uid, DoorComponent door, ref BeforePryEvent args)
|
private void OnBeforePry(EntityUid uid, DoorComponent door, ref BeforePryEvent args) // WD edit
|
||||||
{
|
{
|
||||||
if (door.State == DoorState.Welded || !door.CanPry)
|
args.Cancelled = door.State == DoorState.Welded ||
|
||||||
args.Cancelled = true;
|
!door.CanPry ||
|
||||||
|
TryComp<KeyholeComponent>(uid, out var keyholeComponent) && keyholeComponent.Locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -57,7 +57,6 @@
|
|||||||
mode: NoSprite
|
mode: NoSprite
|
||||||
- type: Occluder
|
- type: Occluder
|
||||||
- type: ReflectAspectMark
|
- type: ReflectAspectMark
|
||||||
- type: Keyhole
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: BaseMaterialDoor
|
parent: BaseMaterialDoor
|
||||||
@@ -65,6 +64,7 @@
|
|||||||
abstract: true
|
abstract: true
|
||||||
components:
|
components:
|
||||||
- type: NavMapDoor
|
- type: NavMapDoor
|
||||||
|
- type: Keyhole
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: MetalDoor
|
id: MetalDoor
|
||||||
|
|||||||
Reference in New Issue
Block a user