NPC Steering refactor (#10190)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -68,6 +68,13 @@ namespace Content.Server.AI.Operators.Combat.Melee
|
||||
|
||||
public override Outcome Execute(float frameTime)
|
||||
{
|
||||
if (_unarmedCombat == null ||
|
||||
!_entMan.GetComponent<TransformComponent>(_target).Coordinates.TryDistance(_entMan, _entMan.GetComponent<TransformComponent>(_owner).Coordinates, out var distance) || distance >
|
||||
_unarmedCombat.Range)
|
||||
{
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
if (_burstTime <= _elapsedTime)
|
||||
{
|
||||
return Outcome.Success;
|
||||
@@ -78,12 +85,6 @@ namespace Content.Server.AI.Operators.Combat.Melee
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
if ((_entMan.GetComponent<TransformComponent>(_target).Coordinates.Position - _entMan.GetComponent<TransformComponent>(_owner).Coordinates.Position).Length >
|
||||
_unarmedCombat.Range)
|
||||
{
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
||||
interactionSystem.AiUseInteraction(_owner, _entMan.GetComponent<TransformComponent>(_target).Coordinates, _target);
|
||||
_elapsedTime += frameTime;
|
||||
|
||||
Reference in New Issue
Block a user