Door opening tweaks (#16799)

This commit is contained in:
metalgearsloth
2023-06-13 20:30:04 +10:00
committed by GitHub
parent 8fd8b878bf
commit c24c6e93ec
5 changed files with 20 additions and 14 deletions

View File

@@ -46,16 +46,6 @@ public sealed class DoorSystem : SharedDoorSystem
SubscribeLocalEvent<DoorComponent, GotEmaggedEvent>(OnEmagged); SubscribeLocalEvent<DoorComponent, GotEmaggedEvent>(OnEmagged);
} }
protected override void OnActivate(EntityUid uid, DoorComponent door, ActivateInWorldEvent args)
{
// TODO once access permissions are shared, move this back to shared.
if (args.Handled || !door.ClickOpen)
return;
TryToggleDoor(uid, door, args.User);
args.Handled = true;
}
protected override void SetCollidable( protected override void SetCollidable(
EntityUid uid, EntityUid uid,
bool collidable, bool collidable,

View File

@@ -57,6 +57,7 @@ public abstract class SharedDoorSystem : EntitySystem
SubscribeLocalEvent<DoorComponent, ComponentGetState>(OnGetState); SubscribeLocalEvent<DoorComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<DoorComponent, ComponentHandleState>(OnHandleState); SubscribeLocalEvent<DoorComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<DoorComponent, InteractedNoHandEvent>(OnInteractedNoHand);
SubscribeLocalEvent<DoorComponent, ActivateInWorldEvent>(OnActivate); SubscribeLocalEvent<DoorComponent, ActivateInWorldEvent>(OnActivate);
SubscribeLocalEvent<DoorComponent, StartCollideEvent>(HandleCollide); SubscribeLocalEvent<DoorComponent, StartCollideEvent>(HandleCollide);
@@ -179,9 +180,22 @@ public abstract class SharedDoorSystem : EntitySystem
#endregion #endregion
#region Interactions #region Interactions
protected virtual void OnActivate(EntityUid uid, DoorComponent door, ActivateInWorldEvent args)
private void OnInteractedNoHand(EntityUid uid, DoorComponent component, InteractedNoHandEvent args)
{ {
// avoid client-mispredicts, as the server will definitely handle this event if (args.Handled || !component.ClickOpen || !Tags.HasTag(args.User, "DoorBumpOpener"))
return;
TryToggleDoor(uid, component, args.User, predicted: true);
args.Handled = true;
}
public void OnActivate(EntityUid uid, DoorComponent door, ActivateInWorldEvent args)
{
if (args.Handled || !door.ClickOpen)
return;
TryToggleDoor(uid, door, args.User, predicted: true);
args.Handled = true; args.Handled = true;
} }

View File

@@ -2122,9 +2122,9 @@
accent: mouse accent: mouse
- type: Tag - type: Tag
tags: tags:
- Trash
- CannotSuicide
- Hamster - Hamster
- CannotSuicide
- Trash
- type: Respirator - type: Respirator
damage: damage:
types: types:

View File

@@ -6,6 +6,7 @@
components: components:
- type: Tag - type: Tag
tags: tags:
- DoorBumpOpener
- FootstepSound - FootstepSound
- type: InputMover - type: InputMover
- type: MobMover - type: MobMover

View File

@@ -41,6 +41,7 @@
volume: 3 volume: 3
- type: Tag - type: Tag
tags: tags:
- DoorBumpOpener
- FootstepSound - FootstepSound
- type: Butcherable - type: Butcherable
butcheringType: Knife butcheringType: Knife