Package mindustry.ai
Class Pathfinder.Flowfield
java.lang.Object
mindustry.ai.Pathfinder.Flowfield
- Direct Known Subclasses:
Pathfinder.EnemyCoreField
,Pathfinder.PositionTarget
- Enclosing class:
- Pathfinder
Data for a flow field to some set of destinations.
Concrete subclasses must specify a way to fetch costs and destinations.
-
Field Summary
Modifier and TypeFieldDescriptionint[]
the last "complete" weights of this tilemap.protected Pathfinder.PathCost
Function for calculating path cost.protected boolean
If true, this flow field needs updating.protected boolean
Whether there are valid weights in the complete array.protected int
Refresh rate in milliseconds.int[]
search IDs of each position - the highest, most recent search is prioritized and overwrittenprotected Team
Team this path is for.int[]
costs of getting to a specific tile -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
getPositions
(IntSeq out) Gets targets to pathfind towards.boolean
protected boolean
passable
(int pos) void
-
Field Details
-
refreshRate
protected int refreshRateRefresh rate in milliseconds. Return any number <= 0 to disable. -
team
Team this path is for. Set before using. -
cost
Function for calculating path cost. Set before using. -
hasComplete
protected volatile boolean hasCompleteWhether there are valid weights in the complete array. -
dirty
protected boolean dirtyIf true, this flow field needs updating. This flag is only set to false once the flow field finishes and the weights are copied over. -
weights
public int[] weightscosts of getting to a specific tile -
searches
public int[] searchessearch IDs of each position - the highest, most recent search is prioritized and overwritten -
completeWeights
public int[] completeWeightsthe last "complete" weights of this tilemap.
-
-
Constructor Details
-
Flowfield
public Flowfield()
-
-
Method Details
-
hasCompleteWeights
public boolean hasCompleteWeights() -
updateTargetPositions
public void updateTargetPositions() -
passable
protected boolean passable(int pos) -
getPositions
Gets targets to pathfind towards. This must run on the main thread.
-