pvs content (#5484)

Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
This commit is contained in:
Paul Ritter
2021-11-30 15:20:38 +01:00
committed by GitHub
parent d0efe50e83
commit fbcb53dcc0
63 changed files with 72 additions and 68 deletions

View File

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