Mobstate Refactor (#13389)
Refactors mobstate and moves mob health thresholds to their own component Co-authored-by: DrSmugleaf <drsmugleaf@gmail.com>
This commit is contained in:
31
Content.Shared/Mobs/Components/MobThresholdsComponent.cs
Normal file
31
Content.Shared/Mobs/Components/MobThresholdsComponent.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user