New Traits (#13763)

This commit is contained in:
Scribbles0
2023-03-04 19:44:13 -08:00
committed by GitHub
parent 224dd1e515
commit 46e89c07c8
11 changed files with 305 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
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;
}
}