pvs content (#5484)
Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user