Content changes for session specific entity states (#11235)

This commit is contained in:
Leon Friedrich
2022-09-14 21:40:05 +12:00
committed by GitHub
parent 7cd0677708
commit 2908cd994c
12 changed files with 10 additions and 118 deletions

View File

@@ -39,32 +39,6 @@ namespace Content.Server.Flash
SubscribeLocalEvent<InventoryComponent, FlashAttemptEvent>(OnInventoryFlashAttempt);
SubscribeLocalEvent<FlashImmunityComponent, FlashAttemptEvent>(OnFlashImmunityFlashAttempt);
SubscribeLocalEvent<FlashableComponent, ComponentStartup>(OnFlashableStartup);
SubscribeLocalEvent<FlashableComponent, ComponentShutdown>(OnFlashableShutdown);
SubscribeLocalEvent<FlashableComponent, MetaFlagRemoveAttemptEvent>(OnMetaFlagRemoval);
SubscribeLocalEvent<FlashableComponent, PlayerAttachedEvent>(OnPlayerAttached);
}
private void OnPlayerAttached(EntityUid uid, FlashableComponent component, PlayerAttachedEvent args)
{
Dirty(component);
}
private void OnMetaFlagRemoval(EntityUid uid, FlashableComponent component, ref MetaFlagRemoveAttemptEvent args)
{
if (component.LifeStage == ComponentLifeStage.Running)
args.ToRemove &= ~MetaDataFlags.EntitySpecific;
}
private void OnFlashableStartup(EntityUid uid, FlashableComponent component, ComponentStartup args)
{
_metaSystem.AddFlag(uid, MetaDataFlags.EntitySpecific);
}
private void OnFlashableShutdown(EntityUid uid, FlashableComponent component, ComponentShutdown args)
{
_metaSystem.RemoveFlag(uid, MetaDataFlags.EntitySpecific);
}
private void OnFlashMeleeHit(EntityUid uid, FlashComponent comp, MeleeHitEvent args)