2022-09-30 14:39:48 +10:00
|
|
|
using JetBrains.Annotations;
|
2022-09-06 00:28:23 +10:00
|
|
|
|
|
|
|
|
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Ranged;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Selects a target for ranged combat.
|
|
|
|
|
/// </summary>
|
2022-09-30 14:39:48 +10:00
|
|
|
[UsedImplicitly]
|
2022-09-06 00:28:23 +10:00
|
|
|
public sealed class PickRangedTargetOperator : NPCCombatOperator
|
|
|
|
|
{
|
2022-12-02 02:02:01 +11:00
|
|
|
protected override bool IsRanged => true;
|
|
|
|
|
|
2022-09-30 14:39:48 +10:00
|
|
|
protected override float GetRating(NPCBlackboard blackboard, EntityUid uid, EntityUid existingTarget, float distance, bool canMove, EntityQuery<TransformComponent> xformQuery)
|
2022-09-06 00:28:23 +10:00
|
|
|
{
|
|
|
|
|
// Yeah look I just came up with values that seemed okay but they will need a lot of tweaking.
|
|
|
|
|
// Having a debug overlay just to project these would be very useful when finetuning in future.
|
|
|
|
|
var rating = 0f;
|
|
|
|
|
|
|
|
|
|
if (existingTarget == uid)
|
|
|
|
|
{
|
|
|
|
|
rating += 2f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rating += 1f / distance * 4f;
|
|
|
|
|
return rating;
|
|
|
|
|
}
|
|
|
|
|
}
|