Flashable cangetstate ref (#6441)

This commit is contained in:
metalgearsloth
2022-02-04 12:43:58 +11:00
committed by GitHub
parent 3a4a296574
commit 1de18f2821

View File

@@ -13,14 +13,14 @@ namespace Content.Shared.Flash
SubscribeLocalEvent<SharedFlashableComponent, ComponentGetStateAttemptEvent>(OnGetStateAttempt); SubscribeLocalEvent<SharedFlashableComponent, ComponentGetStateAttemptEvent>(OnGetStateAttempt);
} }
private void OnGetStateAttempt(EntityUid uid, SharedFlashableComponent component, ComponentGetStateAttemptEvent args) private static void OnGetStateAttempt(EntityUid uid, SharedFlashableComponent component, ref ComponentGetStateAttemptEvent args)
{ {
// Only send state to the player attached to the entity. // Only send state to the player attached to the entity.
if (args.Player.AttachedEntity != uid) if (args.Player.AttachedEntity != uid)
args.Cancel(); args.Cancelled = true;
} }
private void OnFlashableGetState(EntityUid uid, SharedFlashableComponent component, ref ComponentGetState args) private static void OnFlashableGetState(EntityUid uid, SharedFlashableComponent component, ref ComponentGetState args)
{ {
args.State = new FlashableComponentState(component.Duration, component.LastFlash); args.State = new FlashableComponentState(component.Duration, component.LastFlash);
} }