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:
Jezithyr
2023-01-13 16:57:10 -08:00
committed by GitHub
parent 97e4c477bd
commit eeb5b17b34
148 changed files with 1517 additions and 1290 deletions

View File

@@ -1,8 +1,8 @@
using System.Threading;
using System.Threading.Tasks;
using Content.Server.NPC.Components;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Melee;
@@ -23,7 +23,7 @@ public sealed class MeleeOperator : HTNOperator
/// Minimum damage state that the target has to be in for us to consider attacking.
/// </summary>
[DataField("targetState")]
public DamageState TargetState = DamageState.Alive;
public MobState TargetState = MobState.Alive;
// Like movement we add a component and pass it off to the dedicated system.

View File

@@ -5,8 +5,8 @@ using Content.Server.NPC.Pathfinding;
using Content.Server.NPC.Systems;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Robust.Shared.Map;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
@@ -91,7 +91,7 @@ public abstract class NPCCombatOperator : HTNOperator
.GetNearbyHostiles(owner, radius))
{
if (mobQuery.TryGetComponent(target, out var mobState) &&
mobState.CurrentState > DamageState.Alive ||
mobState.CurrentState > MobState.Alive ||
target == existingTarget ||
target == owner)
{

View File

@@ -1,8 +1,8 @@
using System.Threading;
using System.Threading.Tasks;
using Content.Server.NPC.Components;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Robust.Shared.Audio;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Ranged;
@@ -21,7 +21,7 @@ public sealed class RangedOperator : HTNOperator
/// Minimum damage state that the target has to be in for us to consider attacking.
/// </summary>
[DataField("targetState")]
public DamageState TargetState = DamageState.Alive;
public MobState TargetState = MobState.Alive;
// Like movement we add a component and pass it off to the dedicated system.

View File

@@ -5,7 +5,7 @@ using Content.Server.NPC.Components;
using Content.Server.NPC.Pathfinding;
using Content.Shared.Damage;
using Content.Shared.Interaction;
using Content.Shared.MobState.Components;
using Content.Shared.Mobs.Components;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Specific;