CatStation/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/JukeOperator.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

31 lines
1 KiB
C#

using Content.Server.NPC.Components;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Combat;
public sealed partial class JukeOperator : HTNOperator, IHtnConditionalShutdown
{
[Dependency] private IEntityManager _entManager = default!;
[DataField("jukeType")]
public JukeType JukeType = JukeType.AdjacentTile;
[DataField("shutdownState")]
public HTNPlanState ShutdownState { get; private set; } = HTNPlanState.PlanFinished;
public override void Startup(NPCBlackboard blackboard)
{
base.Startup(blackboard);
var juke = _entManager.EnsureComponent<NPCJukeComponent>(blackboard.GetValue<EntityUid>(NPCBlackboard.Owner));
juke.JukeType = JukeType;
}
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
{
return HTNOperatorStatus.Finished;
}
public void ConditionalShutdown(NPCBlackboard blackboard)
{
_entManager.RemoveComponent<NPCJukeComponent>(blackboard.GetValue<EntityUid>(NPCBlackboard.Owner));
}
}