Package mindustry.ai

Class Pathfinder.Flowfield

java.lang.Object
mindustry.ai.Pathfinder.Flowfield
Direct Known Subclasses:
Pathfinder.EnemyCoreField, Pathfinder.PositionTarget
Enclosing class:
Pathfinder

public abstract static class Pathfinder.Flowfield extends Object
Data for a flow field to some set of destinations. Concrete subclasses must specify a way to fetch costs and destinations.
  • Field Details

    • refreshRate

      protected int refreshRate
      Refresh rate in milliseconds. Return any number <= 0 to disable.
    • team

      protected Team team
      Team this path is for. Set before using.
    • cost

      protected Pathfinder.PathCost cost
      Function for calculating path cost. Set before using.
    • hasComplete

      protected volatile boolean hasComplete
      Whether there are valid weights in the complete array.
    • dirty

      protected boolean dirty
      If 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[] weights
      costs of getting to a specific tile
    • searches

      public int[] searches
      search IDs of each position - the highest, most recent search is prioritized and overwritten
    • completeWeights

      public int[] completeWeights
      the 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

      protected abstract void getPositions(IntSeq out)
      Gets targets to pathfind towards. This must run on the main thread.