Files
tbd-station-14/Content.Shared/Mobs/Components/MobThresholdsComponent.cs
Jezithyr eeb5b17b34 Mobstate Refactor (#13389)
Refactors mobstate and moves mob health thresholds to their own component

Co-authored-by: DrSmugleaf <drsmugleaf@gmail.com>
2023-01-13 16:57:10 -08:00

32 lines
969 B
C#

using Content.Shared.FixedPoint;
using Content.Shared.Mobs.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Mobs.Components;
[RegisterComponent, NetworkedComponent]
[Access(typeof(MobThresholdSystem))]
public sealed class MobThresholdsComponent : Component
{
[DataField("thresholds", required:true)]public SortedDictionary<FixedPoint2, MobState> Thresholds = new();
[DataField("triggersAlerts")] public bool TriggersAlerts = true;
public MobState CurrentThresholdState;
}
[Serializable, NetSerializable]
public sealed class MobThresholdComponentState : ComponentState
{
public Dictionary<FixedPoint2, MobState> Thresholds;
public MobState CurrentThresholdState;
public MobThresholdComponentState(MobState currentThresholdState,
Dictionary<FixedPoint2, MobState> thresholds)
{
CurrentThresholdState = currentThresholdState;
Thresholds = thresholds;
}
}