* Update RobustToolbox * Transition direct type usages * More updates * Fix invalid use of to map * Update RobustToolbox * Fix dropping items * Rename name usages of "GridCoordinates" to "EntityCoordinates" * Revert "Update RobustToolbox" This reverts commit 9f334a17c5908ded0043a63158bb671e4aa3f346. * Revert "Update RobustToolbox" This reverts commit 3a9c8cfa3606fa501aa84407796d2ad920853a09. # Conflicts: # RobustToolbox * Fix cursed IMapGrid method usage. * GridTileLookupTest now uses EntityCoordinates Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
22 lines
767 B
C#
22 lines
767 B
C#
using Content.Server.AI.WorldState;
|
|
using Content.Server.AI.WorldState.States;
|
|
|
|
namespace Content.Server.AI.Utility.Considerations.Movement
|
|
{
|
|
public sealed class TargetDistanceCon : Consideration
|
|
{
|
|
protected override float GetScore(Blackboard context)
|
|
{
|
|
var self = context.GetState<SelfState>().GetValue();
|
|
var target = context.GetState<TargetEntityState>().GetValue();
|
|
if (target == null || target.Deleted || target.Transform.GridID != self.Transform.GridID)
|
|
{
|
|
return 0.0f;
|
|
}
|
|
|
|
// Anything further than 100 tiles gets clamped
|
|
return (target.Transform.Coordinates.Position - self.Transform.Coordinates.Position).Length / 100;
|
|
}
|
|
}
|
|
}
|