Mass hallucinations event (#17321)

* paracusia component auto comp state

* it works

* rule component config
This commit is contained in:
Slava0135
2023-06-15 09:45:50 +03:00
committed by GitHub
parent d0195fe2b5
commit 34bdb773f9
7 changed files with 130 additions and 47 deletions

View File

@@ -1,30 +1,5 @@
using Content.Shared.GameTicking;
using Robust.Shared.GameStates;
namespace Content.Shared.Traits.Assorted;
public abstract class SharedParacusiaSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ParacusiaComponent, ComponentGetState>(GetCompState);
SubscribeLocalEvent<ParacusiaComponent, ComponentHandleState>(HandleCompState);
}
private void GetCompState(EntityUid uid, ParacusiaComponent component, ref ComponentGetState args)
{
args.State = new ParacusiaComponentState(component.MaxTimeBetweenIncidents, component.MinTimeBetweenIncidents, component.MaxSoundDistance, component.Sounds);
}
private void HandleCompState(EntityUid uid, ParacusiaComponent component, ref ComponentHandleState args)
{
if (args.Current is not ParacusiaComponentState state)
return;
component.MaxTimeBetweenIncidents = state.MaxTimeBetweenIncidents;
component.MinTimeBetweenIncidents = state.MinTimeBetweenIncidents;
component.MaxSoundDistance = state.MaxSoundDistance;
component.Sounds = state.Sounds;
}
}