Files
wwdpublic/Content.Shared/Mobs/MobState.cs
VMSolidus 1631333035 Some MobState Refactoring (#1382)
# Description

This PR does *some* refactoring of MobState in preparation for adding a
more in-depth SoftCritical system, mostly adding code support for the
new threshold existing in the first place. Additionally, the
MobStateComponent now also includes several DataFields that allow more
precise fine tuning of what all mobs are allowed to do in each state, as
opposed to hardcoding a majority of these interactions.

The actual SoftCritical state isn't currently used by anything, and so
is a largely vestigial feature. It would have to be added individually
to mobs, such as the BaseMobSpeciesOrganic when the time comes to
actually add this feature.

# Changelog

🆑
- add: Lots of refactoring of the Mob State Systerm in preparation for
implementing a much more detailed Soft Critical state.

---------

Signed-off-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com>

(cherry picked from commit 1e9cb1ce0bc70d76379e86ff311070c01cb9da06)
2025-01-14 00:37:03 +03:00

45 lines
1.3 KiB
C#

using Content.Shared.Mobs.Components;
using Robust.Shared.Serialization;
namespace Content.Shared.Mobs;
/// <summary>
/// Defines what state an <see cref="Robust.Shared.GameObjects.EntityUid"/> is in.
///
/// Ordered from most alive to least alive.
/// To enumerate them in this way see
/// <see cref="MobStateHelpers.AliveToDead"/>.
/// </summary>
[Serializable, NetSerializable]
public enum MobState : byte
{
Invalid = 0,
Alive = 1,
Critical = 2,
SoftCritical = 3,
Dead = 4,
}
/// <summary>
/// Event that is raised whenever a MobState changes on an entity
/// </summary>
/// <param name="Target">The Entity whose MobState is changing</param>
/// <param name="Component">The MobState Component owned by the Target entity</param>
/// <param name="OldMobState">The previous MobState</param>
/// <param name="NewMobState">The new MobState</param>
/// <param name="Origin">The Entity that caused this state change</param>
public record struct MobStateChangedEvent(EntityUid Target, MobStateComponent Component, MobState OldMobState,
MobState NewMobState, EntityUid? Origin = null);
public static class A
{
//^.^
}
//This is dumb and I hate it but I don't feel like refactoring this garbage
[Serializable, NetSerializable]
public enum MobStateVisuals : byte
{
State
}