Optimize walking and add custom starting condition
This commit is contained in:
@ -1,16 +1,19 @@
|
||||
package io.reisub.dreambot.cagility;
|
||||
|
||||
import io.reisub.dreambot.util.Util;
|
||||
import org.dreambot.api.methods.interactive.GameObjects;
|
||||
import org.dreambot.api.methods.interactive.Players;
|
||||
import org.dreambot.api.methods.map.Area;
|
||||
import org.dreambot.api.methods.map.Tile;
|
||||
import org.dreambot.api.methods.walking.path.impl.LocalPath;
|
||||
import org.dreambot.api.utilities.impl.Condition;
|
||||
import org.dreambot.api.wrappers.interactive.GameObject;
|
||||
|
||||
public class Obstacle {
|
||||
private final int id;
|
||||
private final Area area;
|
||||
private final LocalPath<Tile> path;
|
||||
private Condition startCondition;
|
||||
private Obstacle next;
|
||||
|
||||
public Obstacle(int id, Area area, Tile... walkingTiles) {
|
||||
@ -18,6 +21,14 @@ public class Obstacle {
|
||||
this.area = area;
|
||||
path = new LocalPath<>();
|
||||
path.addAll(walkingTiles);
|
||||
|
||||
startCondition = Util::playerIsIdle;
|
||||
}
|
||||
|
||||
public Obstacle(int id, Area area, Condition startCondition, Tile... walkingTiles) {
|
||||
this(id, area, walkingTiles);
|
||||
|
||||
this.startCondition = startCondition;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
@ -43,4 +54,8 @@ public class Obstacle {
|
||||
public LocalPath<Tile> getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public boolean canStart() {
|
||||
return startCondition.verify();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user