Turn interaction related attempt events into structs (#29168)

* Turn InteractionAttemptEvent into a struct event

* readonly

* GettingInteractedWithAttemptEvent

* ConsciousAttemptEvent
This commit is contained in:
Leon Friedrich
2024-06-19 02:30:41 +12:00
committed by GitHub
parent db30b5e040
commit ee2c115e5b
13 changed files with 80 additions and 37 deletions

View File

@@ -17,7 +17,7 @@ public sealed partial class ReplaySpectatorSystem
SubscribeLocalEvent<ReplaySpectatorComponent, UseAttemptEvent>(OnAttempt);
SubscribeLocalEvent<ReplaySpectatorComponent, PickupAttemptEvent>(OnAttempt);
SubscribeLocalEvent<ReplaySpectatorComponent, ThrowAttemptEvent>(OnAttempt);
SubscribeLocalEvent<ReplaySpectatorComponent, InteractionAttemptEvent>(OnAttempt);
SubscribeLocalEvent<ReplaySpectatorComponent, InteractionAttemptEvent>(OnInteractAttempt);
SubscribeLocalEvent<ReplaySpectatorComponent, AttackAttemptEvent>(OnAttempt);
SubscribeLocalEvent<ReplaySpectatorComponent, DropAttemptEvent>(OnAttempt);
SubscribeLocalEvent<ReplaySpectatorComponent, IsEquippingAttemptEvent>(OnAttempt);
@@ -27,6 +27,11 @@ public sealed partial class ReplaySpectatorSystem
SubscribeLocalEvent<ReplaySpectatorComponent, PullAttemptEvent>(OnPullAttempt);
}
private void OnInteractAttempt(Entity<ReplaySpectatorComponent> ent, ref InteractionAttemptEvent args)
{
args.Cancelled = true;
}
private void OnAttempt(EntityUid uid, ReplaySpectatorComponent component, CancellableEntityEventArgs args)
{
args.Cancel();