From 5e95c16e98a431b75b5f68ebec6fe1f3ddf50d16 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Sun, 29 Dec 2024 20:24:30 -0500 Subject: [PATCH 1/6] MobState Refactor Prep --- .../Mobs/Components/MobStateComponent.cs | 77 +++++++++++++++++- Content.Shared/Mobs/MobState.cs | 4 +- .../Systems/MobStateSystem.Subscribers.cs | 80 ++++++++++++++----- Content.Shared/Mobs/Systems/MobStateSystem.cs | 11 ++- 4 files changed, 150 insertions(+), 22 deletions(-) diff --git a/Content.Shared/Mobs/Components/MobStateComponent.cs b/Content.Shared/Mobs/Components/MobStateComponent.cs index 7cff0779cbe..92abb735687 100644 --- a/Content.Shared/Mobs/Components/MobStateComponent.cs +++ b/Content.Shared/Mobs/Components/MobStateComponent.cs @@ -1,7 +1,6 @@ using Content.Shared.Damage; using Content.Shared.Mobs.Systems; using Robust.Shared.GameStates; -using Robust.Shared.Serialization; namespace Content.Shared.Mobs.Components { @@ -17,6 +16,81 @@ namespace Content.Shared.Mobs.Components [Access(typeof(MobStateSystem), typeof(MobThresholdSystem))] public sealed partial class MobStateComponent : Component { + /// + /// Whether this mob will be allowed to issue movement commands when in the Critical MobState. + /// + [DataField] + public bool AllowMovementWhileCrit; + + /// + /// Whether this mob will be allowed to issue movement commands when in the Soft-Crit MobState. + /// + [DataField] + public bool AllowMovementWhileSoftCrit; + + /// + /// Whether this mob will be allowed to issue movement commands when in the Dead MobState. + /// This is provided for completeness sake, and *probably* shouldn't be used by default. + /// + [DataField] + public bool AllowMovementWhileDead; + + /// + /// Whether this mob will be allowed to talk while in the Critical MobState. + /// + [DataField] + public bool AllowTalkingWhileCrit = true; + + /// + /// Whether this mob will be allowed to talk while in the SoftCritical MobState. + /// + [DataField] + public bool AllowTalkingWhileSoftCrit = true; + + /// + /// Whether this mob will be allowed to talk while in the Dead MobState. + /// This is provided for completeness sake, and *probably* shouldn't be used by default. + /// + [DataField] + public bool AllowTalkingWhileDead; + + /// + /// Whether this mob is forced to be downed when entering the Critical MobState. + /// + [DataField] + public bool DownWhenCrit = true; + + /// + /// Whether this mob is forced to be downed when entering the SoftCritical MobState. + /// + [DataField] + public bool DownWhenSoftCrit = true; + + /// + /// Whether this mob is forced to be downed when entering the Dead MobState. + /// + [DataField] + public bool DownWhenDead = true; + + /// + /// Whether this mob is allowed to perform hand interactions while in the Critical MobState. + /// + [DataField] + public bool AllowHandInteractWhileCrit; + + /// + /// Whether this mob is allowed to perform hand interactions while in the SoftCritical MobState. + /// + [DataField] + public bool AllowHandInteractWhileSoftCrit; + + /// + /// Whether this mob is allowed to perform hand interactions while in the Dead MobState. + /// This is provided for completeness sake, and *probably* shouldn't be used by default. + /// + [DataField] + public bool AllowHandInteractWhileDead; + //default mobstate is always the lowest state level [AutoNetworkedField, ViewVariables] public MobState CurrentState { get; set; } = MobState.Alive; @@ -27,6 +101,7 @@ public sealed partial class MobStateComponent : Component { MobState.Alive, MobState.Critical, + MobState.SoftCritical, MobState.Dead }; } diff --git a/Content.Shared/Mobs/MobState.cs b/Content.Shared/Mobs/MobState.cs index 1846232f4e3..c36ccb04ac8 100644 --- a/Content.Shared/Mobs/MobState.cs +++ b/Content.Shared/Mobs/MobState.cs @@ -16,7 +16,9 @@ public enum MobState : byte Invalid = 0, Alive = 1, Critical = 2, - Dead = 3 + SoftCritical = 3, + Dead = 4, + } /// diff --git a/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs b/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs index 3728813406c..a467c893643 100644 --- a/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs +++ b/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs @@ -54,18 +54,32 @@ private void SubscribeEvents() private void OnDirectionAttempt(Entity ent, ref ChangeDirectionAttemptEvent args) { - if (ent.Comp.CurrentState is MobState.Critical && _configurationManager.GetCVar(CCVars.AllowMovementWhileCrit)) + if (ent.Comp.CurrentState is MobState.Alive + || ent.Comp.CurrentState is MobState.Critical + && ent.Comp.AllowMovementWhileCrit + && _configurationManager.GetCVar(CCVars.AllowMovementWhileCrit) + || ent.Comp.CurrentState is MobState.SoftCritical + && ent.Comp.AllowMovementWhileSoftCrit + || ent.Comp.CurrentState is MobState.Dead + && ent.Comp.AllowMovementWhileDead) return; - CheckAct(ent.Owner, ent.Comp, args); + args.Cancel(); } private void OnMoveAttempt(Entity ent, ref UpdateCanMoveEvent args) { - if (ent.Comp.CurrentState is MobState.Critical && _configurationManager.GetCVar(CCVars.AllowMovementWhileCrit)) + if (ent.Comp.CurrentState is MobState.Alive + || ent.Comp.CurrentState is MobState.Critical + && ent.Comp.AllowMovementWhileCrit + && _configurationManager.GetCVar(CCVars.AllowMovementWhileCrit) + || ent.Comp.CurrentState is MobState.SoftCritical + && ent.Comp.AllowMovementWhileSoftCrit + || ent.Comp.CurrentState is MobState.Dead + && ent.Comp.AllowMovementWhileDead) return; - CheckAct(ent.Owner, ent.Comp, args); + args.Cancel(); } @@ -85,15 +99,22 @@ private void OnStateExitSubscribers(EntityUid target, MobStateComponent componen //unused break; case MobState.Critical: + if (component.CurrentState is not MobState.Alive) + break; + _standing.Stand(target); + break; + case MobState.SoftCritical: + if (component.CurrentState is not MobState.Alive) + break; _standing.Stand(target); break; case MobState.Dead: RemComp(target); - _standing.Stand(target); + if (component.CurrentState is MobState.Alive) + _standing.Stand(target); + if (!_standing.IsDown(target) && TryComp(target, out var physics)) - { _physics.SetCanCollide(target, true, body: physics); - } break; case MobState.Invalid: @@ -119,17 +140,22 @@ private void OnStateEnteredSubscribers(EntityUid target, MobStateComponent compo _appearance.SetData(target, MobStateVisuals.State, MobState.Alive); break; case MobState.Critical: - _standing.Down(target); + if (component.DownWhenCrit) + _standing.Down(target); + _appearance.SetData(target, MobStateVisuals.State, MobState.Critical); + break; + case MobState.SoftCritical: + if (component.DownWhenSoftCrit) + _standing.Down(target); _appearance.SetData(target, MobStateVisuals.State, MobState.Critical); break; case MobState.Dead: EnsureComp(target); - _standing.Down(target); + if (component.DownWhenDead) + _standing.Down(target); if (_standing.IsDown(target) && TryComp(target, out var physics)) - { _physics.SetCanCollide(target, false, body: physics); - } _appearance.SetData(target, MobStateVisuals.State, MobState.Dead); break; @@ -145,8 +171,10 @@ private void OnStateEnteredSubscribers(EntityUid target, MobStateComponent compo private void OnSleepAttempt(EntityUid target, MobStateComponent component, ref TryingToSleepEvent args) { - if (IsDead(target, component)) - args.Cancelled = true; + if (component.CurrentState is MobState.Alive) + return; + + args.Cancelled = true; } private void OnGettingStripped(EntityUid target, MobStateComponent component, BeforeGettingStrippedEvent args) @@ -166,10 +194,17 @@ private void OnSpeakAttempt(EntityUid uid, MobStateComponent component, SpeakAtt return; } - if (component.CurrentState is MobState.Critical && _configurationManager.GetCVar(CCVars.AllowTalkingWhileCrit)) + if (component.CurrentState is MobState.Alive + || component.CurrentState is MobState.Critical + && component.AllowTalkingWhileCrit + && _configurationManager.GetCVar(CCVars.AllowTalkingWhileCrit) + || component.CurrentState is MobState.SoftCritical + && component.AllowTalkingWhileSoftCrit + || component.CurrentState is MobState.Dead + && component.AllowTalkingWhileDead) return; - CheckAct(uid, component, args); + args.Cancel(); } private void CheckAct(EntityUid target, MobStateComponent component, CancellableEntityEventArgs args) @@ -177,6 +212,7 @@ private void CheckAct(EntityUid target, MobStateComponent component, Cancellable switch (component.CurrentState) { case MobState.Dead: + case MobState.SoftCritical: case MobState.Critical: args.Cancel(); break; @@ -199,10 +235,16 @@ private void OnUnequipAttempt(EntityUid target, MobStateComponent component, IsU private void OnCombatModeShouldHandInteract(EntityUid uid, MobStateComponent component, ref CombatModeShouldHandInteractEvent args) { - // Disallow empty-hand-interacting in combat mode - // for non-dead mobs - if (!IsDead(uid, component)) - args.Cancelled = true; + if (component.CurrentState is MobState.Alive + || component.CurrentState is MobState.Critical + && component.AllowHandInteractWhileCrit + || component.CurrentState is MobState.SoftCritical + && component.AllowHandInteractWhileSoftCrit + || component.CurrentState is MobState.Dead + && component.AllowHandInteractWhileDead) + return; + + args.Cancelled = true; } private void OnAttemptPacifiedAttack(Entity ent, ref AttemptPacifiedAttackEvent args) diff --git a/Content.Shared/Mobs/Systems/MobStateSystem.cs b/Content.Shared/Mobs/Systems/MobStateSystem.cs index a3886dd42e1..65c9233c7ae 100644 --- a/Content.Shared/Mobs/Systems/MobStateSystem.cs +++ b/Content.Shared/Mobs/Systems/MobStateSystem.cs @@ -65,9 +65,18 @@ public bool IsDead(EntityUid target, MobStateComponent? component = null) { if (!Resolve(target, ref component, false)) return false; + return component.CurrentState == MobState.Dead; } + public bool IsSoftCritical(EntityUid target, MobStateComponent? component = null) + { + if (!Resolve(target, ref component, false)) + return false; + + return component.CurrentState == MobState.SoftCritical; + } + /// /// Check if a Mob is Critical or Dead /// @@ -78,7 +87,7 @@ public bool IsIncapacitated(EntityUid target, MobStateComponent? component = nul { if (!Resolve(target, ref component, false)) return false; - return component.CurrentState is MobState.Critical or MobState.Dead; + return component.CurrentState is MobState.Critical or MobState.Dead or MobState.SoftCritical; } /// From 5e9495efa860d22247f1703b716bea13ab131bb4 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Sun, 29 Dec 2024 20:28:35 -0500 Subject: [PATCH 2/6] More touching stuffs More touching stuffs --- Content.Server/Traits/TraitSystem.Functions.cs | 10 ++++++++++ .../Mobs/Components/MobThresholdsComponent.cs | 1 + 2 files changed, 11 insertions(+) diff --git a/Content.Server/Traits/TraitSystem.Functions.cs b/Content.Server/Traits/TraitSystem.Functions.cs index 57b508018a6..17fcc224315 100644 --- a/Content.Server/Traits/TraitSystem.Functions.cs +++ b/Content.Server/Traits/TraitSystem.Functions.cs @@ -347,6 +347,9 @@ public sealed partial class TraitModifyMobThresholds : TraitFunction [DataField, AlwaysPushInheritance] public int CritThresholdModifier; + [DataField, AlwaysPushInheritance] + public int SoftCritThresholdModifier; + [DataField, AlwaysPushInheritance] public int DeadThresholdModifier; @@ -366,6 +369,13 @@ public override void OnPlayerSpawn(EntityUid uid, thresholdSystem.SetMobStateThreshold(uid, critThreshold + CritThresholdModifier, MobState.Critical); } + if (SoftCritThresholdModifier != 0) + { + var softCritThreshold = thresholdSystem.GetThresholdForState(uid, MobState.SoftCritical, threshold); + if (softCritThreshold != 0) + thresholdSystem.SetMobStateThreshold(uid, softCritThreshold + SoftCritThresholdModifier, MobState.SoftCritical); + } + if (DeadThresholdModifier != 0) { var deadThreshold = thresholdSystem.GetThresholdForState(uid, MobState.Dead, threshold); diff --git a/Content.Shared/Mobs/Components/MobThresholdsComponent.cs b/Content.Shared/Mobs/Components/MobThresholdsComponent.cs index 0e37cf9b10e..883d38c0d2c 100644 --- a/Content.Shared/Mobs/Components/MobThresholdsComponent.cs +++ b/Content.Shared/Mobs/Components/MobThresholdsComponent.cs @@ -29,6 +29,7 @@ public sealed partial class MobThresholdsComponent : Component { {MobState.Alive, "HumanHealth"}, {MobState.Critical, "HumanCrit"}, + {MobState.SoftCritical, "HumanCrit"}, {MobState.Dead, "HumanDead"}, }; From 7fe078c09abe1786bb7c6192456c3ca143cf281f Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Sun, 29 Dec 2024 20:31:48 -0500 Subject: [PATCH 3/6] CLEANUP --- .../Mobs/Components/MobThresholdsComponent.cs | 12 ++++++------ Content.Shared/Mobs/Systems/MobStateSystem.cs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Content.Shared/Mobs/Components/MobThresholdsComponent.cs b/Content.Shared/Mobs/Components/MobThresholdsComponent.cs index 883d38c0d2c..fe435db4d80 100644 --- a/Content.Shared/Mobs/Components/MobThresholdsComponent.cs +++ b/Content.Shared/Mobs/Components/MobThresholdsComponent.cs @@ -11,20 +11,20 @@ namespace Content.Shared.Mobs.Components; [Access(typeof(MobThresholdSystem))] public sealed partial class MobThresholdsComponent : Component { - [DataField("thresholds", required: true)] + [DataField(required: true)] public SortedDictionary Thresholds = new(); - [DataField("triggersAlerts")] + [DataField] public bool TriggersAlerts = true; - [DataField("currentThresholdState")] + [DataField] public MobState CurrentThresholdState; /// /// The health alert that should be displayed for player controlled entities. /// Used for alternate health alerts (silicons, for example) /// - [DataField("stateAlertDict")] + [DataField] public Dictionary> StateAlertDict = new() { {MobState.Alive, "HumanHealth"}, @@ -39,13 +39,13 @@ public sealed partial class MobThresholdsComponent : Component /// /// Whether or not this entity should display damage overlays (robots don't feel pain, black out etc.) /// - [DataField("showOverlays")] + [DataField] public bool ShowOverlays = true; /// /// Whether or not this entity can be revived out of a dead state. /// - [DataField("allowRevives")] + [DataField] public bool AllowRevives; } diff --git a/Content.Shared/Mobs/Systems/MobStateSystem.cs b/Content.Shared/Mobs/Systems/MobStateSystem.cs index 65c9233c7ae..9cdd055c152 100644 --- a/Content.Shared/Mobs/Systems/MobStateSystem.cs +++ b/Content.Shared/Mobs/Systems/MobStateSystem.cs @@ -78,7 +78,7 @@ public bool IsSoftCritical(EntityUid target, MobStateComponent? component = null } /// - /// Check if a Mob is Critical or Dead + /// Check if a Mob is Critical or Dead or SoftCrit /// /// Target Entity /// The MobState component owned by the target From c764b0d28779e9888be62025c7e740bd1df13659 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Sun, 29 Dec 2024 20:56:33 -0500 Subject: [PATCH 4/6] three state booleans my beloved --- .../Traits/TraitSystem.Functions.cs | 85 +++++++++ .../Mobs/Components/MobStateComponent.cs | 173 +++++++++--------- 2 files changed, 170 insertions(+), 88 deletions(-) diff --git a/Content.Server/Traits/TraitSystem.Functions.cs b/Content.Server/Traits/TraitSystem.Functions.cs index 17fcc224315..9939256727b 100644 --- a/Content.Server/Traits/TraitSystem.Functions.cs +++ b/Content.Server/Traits/TraitSystem.Functions.cs @@ -385,6 +385,91 @@ public override void OnPlayerSpawn(EntityUid uid, } } +[UsedImplicitly] +public sealed partial class TraitModifyMobState : TraitFunction +{ + [DataField, AlwaysPushInheritance] + public bool? AllowMovementWhileCrit; + + [DataField, AlwaysPushInheritance] + public bool? AllowMovementWhileSoftCrit; + + [DataField, AlwaysPushInheritance] + public bool? AllowMovementWhileDead; + + [DataField, AlwaysPushInheritance] + public bool? AllowTalkingWhileCrit; + + [DataField, AlwaysPushInheritance] + public bool? AllowTalkingWhileSoftCrit; + + [DataField, AlwaysPushInheritance] + public bool? AllowTalkingWhileDead; + + [DataField, AlwaysPushInheritance] + public bool? DownWhenCrit; + + [DataField, AlwaysPushInheritance] + public bool? DownWhenSoftCrit; + + [DataField, AlwaysPushInheritance] + public bool? DownWhenDead; + + [DataField, AlwaysPushInheritance] + public bool? AllowHandInteractWhileCrit; + + [DataField, AlwaysPushInheritance] + public bool? AllowHandInteractWhileSoftCrit; + + [DataField, AlwaysPushInheritance] + public bool? AllowHandInteractWhileDead; + + public override void OnPlayerSpawn(EntityUid uid, + IComponentFactory factory, + IEntityManager entityManager, + ISerializationManager serializationManager) + { + if (!entityManager.TryGetComponent(uid, out var mobStateComponent)) + return; + + if (AllowMovementWhileCrit is not null) + mobStateComponent.AllowMovementWhileCrit = AllowMovementWhileCrit.Value; + + if (AllowMovementWhileSoftCrit is not null) + mobStateComponent.AllowHandInteractWhileSoftCrit = AllowMovementWhileSoftCrit.Value; + + if (AllowMovementWhileDead is not null) + mobStateComponent.AllowMovementWhileDead = AllowMovementWhileDead.Value; + + if (AllowTalkingWhileCrit is not null) + mobStateComponent.AllowTalkingWhileCrit = AllowTalkingWhileCrit.Value; + + if (AllowTalkingWhileSoftCrit is not null) + mobStateComponent.AllowTalkingWhileSoftCrit = AllowTalkingWhileSoftCrit.Value; + + if (AllowTalkingWhileDead is not null) + mobStateComponent.AllowTalkingWhileDead = AllowTalkingWhileDead.Value; + + if (DownWhenCrit is not null) + mobStateComponent.DownWhenCrit = DownWhenCrit.Value; + + if (DownWhenSoftCrit is not null) + mobStateComponent.DownWhenSoftCrit = DownWhenSoftCrit.Value; + + if (DownWhenDead is not null) + mobStateComponent.DownWhenDead = DownWhenDead.Value; + + if (AllowHandInteractWhileCrit is not null) + mobStateComponent.AllowHandInteractWhileCrit = AllowHandInteractWhileCrit.Value; + + if (AllowHandInteractWhileSoftCrit is not null) + mobStateComponent.AllowHandInteractWhileSoftCrit = AllowHandInteractWhileSoftCrit.Value; + + if (AllowHandInteractWhileDead is not null) + mobStateComponent.AllowHandInteractWhileDead = AllowHandInteractWhileDead.Value; + } +} + [UsedImplicitly] public sealed partial class TraitModifyStamina : TraitFunction { diff --git a/Content.Shared/Mobs/Components/MobStateComponent.cs b/Content.Shared/Mobs/Components/MobStateComponent.cs index 92abb735687..d767e77a369 100644 --- a/Content.Shared/Mobs/Components/MobStateComponent.cs +++ b/Content.Shared/Mobs/Components/MobStateComponent.cs @@ -1,108 +1,105 @@ using Content.Shared.Damage; -using Content.Shared.Mobs.Systems; using Robust.Shared.GameStates; -namespace Content.Shared.Mobs.Components +namespace Content.Shared.Mobs.Components; + +/// +/// When attached to an , +/// this component will handle critical and death behaviors for mobs. +/// Additionally, it handles sending effects to clients +/// (such as blur effect for unconsciousness) and managing the health HUD. +/// +[RegisterComponent] +[NetworkedComponent] +[AutoGenerateComponentState] +public sealed partial class MobStateComponent : Component { /// - /// When attached to an , - /// this component will handle critical and death behaviors for mobs. - /// Additionally, it handles sending effects to clients - /// (such as blur effect for unconsciousness) and managing the health HUD. + /// Whether this mob will be allowed to issue movement commands when in the Critical MobState. /// - [RegisterComponent] - [NetworkedComponent] - [AutoGenerateComponentState] - [Access(typeof(MobStateSystem), typeof(MobThresholdSystem))] - public sealed partial class MobStateComponent : Component - { - /// - /// Whether this mob will be allowed to issue movement commands when in the Critical MobState. - /// - [DataField] - public bool AllowMovementWhileCrit; + [DataField] + public bool AllowMovementWhileCrit; - /// - /// Whether this mob will be allowed to issue movement commands when in the Soft-Crit MobState. - /// - [DataField] - public bool AllowMovementWhileSoftCrit; + /// + /// Whether this mob will be allowed to issue movement commands when in the Soft-Crit MobState. + /// + [DataField] + public bool AllowMovementWhileSoftCrit; - /// - /// Whether this mob will be allowed to issue movement commands when in the Dead MobState. - /// This is provided for completeness sake, and *probably* shouldn't be used by default. - /// - [DataField] - public bool AllowMovementWhileDead; + /// + /// Whether this mob will be allowed to issue movement commands when in the Dead MobState. + /// This is provided for completeness sake, and *probably* shouldn't be used by default. + /// + [DataField] + public bool AllowMovementWhileDead; - /// - /// Whether this mob will be allowed to talk while in the Critical MobState. - /// - [DataField] - public bool AllowTalkingWhileCrit = true; + /// + /// Whether this mob will be allowed to talk while in the Critical MobState. + /// + [DataField] + public bool AllowTalkingWhileCrit = true; - /// - /// Whether this mob will be allowed to talk while in the SoftCritical MobState. - /// - [DataField] - public bool AllowTalkingWhileSoftCrit = true; + /// + /// Whether this mob will be allowed to talk while in the SoftCritical MobState. + /// + [DataField] + public bool AllowTalkingWhileSoftCrit = true; - /// - /// Whether this mob will be allowed to talk while in the Dead MobState. - /// This is provided for completeness sake, and *probably* shouldn't be used by default. - /// - [DataField] - public bool AllowTalkingWhileDead; + /// + /// Whether this mob will be allowed to talk while in the Dead MobState. + /// This is provided for completeness sake, and *probably* shouldn't be used by default. + /// + [DataField] + public bool AllowTalkingWhileDead; - /// - /// Whether this mob is forced to be downed when entering the Critical MobState. - /// - [DataField] - public bool DownWhenCrit = true; + /// + /// Whether this mob is forced to be downed when entering the Critical MobState. + /// + [DataField] + public bool DownWhenCrit = true; - /// - /// Whether this mob is forced to be downed when entering the SoftCritical MobState. - /// - [DataField] - public bool DownWhenSoftCrit = true; + /// + /// Whether this mob is forced to be downed when entering the SoftCritical MobState. + /// + [DataField] + public bool DownWhenSoftCrit = true; - /// - /// Whether this mob is forced to be downed when entering the Dead MobState. - /// - [DataField] - public bool DownWhenDead = true; + /// + /// Whether this mob is forced to be downed when entering the Dead MobState. + /// + [DataField] + public bool DownWhenDead = true; - /// - /// Whether this mob is allowed to perform hand interactions while in the Critical MobState. - /// - [DataField] - public bool AllowHandInteractWhileCrit; + /// + /// Whether this mob is allowed to perform hand interactions while in the Critical MobState. + /// + [DataField] + public bool AllowHandInteractWhileCrit; - /// - /// Whether this mob is allowed to perform hand interactions while in the SoftCritical MobState. - /// - [DataField] - public bool AllowHandInteractWhileSoftCrit; + /// + /// Whether this mob is allowed to perform hand interactions while in the SoftCritical MobState. + /// + [DataField] + public bool AllowHandInteractWhileSoftCrit; - /// - /// Whether this mob is allowed to perform hand interactions while in the Dead MobState. - /// This is provided for completeness sake, and *probably* shouldn't be used by default. - /// - [DataField] - public bool AllowHandInteractWhileDead; + /// + /// Whether this mob is allowed to perform hand interactions while in the Dead MobState. + /// This is provided for completeness sake, and *probably* shouldn't be used by default. + /// + [DataField] + public bool AllowHandInteractWhileDead; - //default mobstate is always the lowest state level - [AutoNetworkedField, ViewVariables] - public MobState CurrentState { get; set; } = MobState.Alive; + //default mobstate is always the lowest state level + [AutoNetworkedField, ViewVariables] + public MobState CurrentState { get; set; } = MobState.Alive; - [DataField] - [AutoNetworkedField] - public HashSet AllowedStates = new() - { - MobState.Alive, - MobState.Critical, - MobState.SoftCritical, - MobState.Dead - }; - } + [DataField] + [AutoNetworkedField] + public HashSet AllowedStates = new() + { + MobState.Alive, + MobState.Critical, + MobState.SoftCritical, + MobState.Dead + }; } From 9ccacacad59cbb709474de130ec4698d84200a6c Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Sun, 29 Dec 2024 20:58:21 -0500 Subject: [PATCH 5/6] Update TraitSystem.Functions.cs --- Content.Server/Traits/TraitSystem.Functions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Content.Server/Traits/TraitSystem.Functions.cs b/Content.Server/Traits/TraitSystem.Functions.cs index 9939256727b..667e69690a2 100644 --- a/Content.Server/Traits/TraitSystem.Functions.cs +++ b/Content.Server/Traits/TraitSystem.Functions.cs @@ -388,6 +388,9 @@ public override void OnPlayerSpawn(EntityUid uid, [UsedImplicitly] public sealed partial class TraitModifyMobState : TraitFunction { + // Three-State Booleans my beloved. + // :faridabirb.png: + [DataField, AlwaysPushInheritance] public bool? AllowMovementWhileCrit; From ebdbcaa37ae9033a0f379edd390ae0d2811e3dd7 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Thu, 2 Jan 2025 17:43:46 -0500 Subject: [PATCH 6/6] Update Content.Shared/Mobs/MobState.cs Co-authored-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com> Signed-off-by: VMSolidus --- Content.Shared/Mobs/MobState.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Content.Shared/Mobs/MobState.cs b/Content.Shared/Mobs/MobState.cs index c36ccb04ac8..3476651e4f0 100644 --- a/Content.Shared/Mobs/MobState.cs +++ b/Content.Shared/Mobs/MobState.cs @@ -18,7 +18,6 @@ public enum MobState : byte Critical = 2, SoftCritical = 3, Dead = 4, - } ///