Add combat job with safe target filtering
This commit is contained in:
1 parent
2ecaa9a30a
commit
1b9f973db3
12 files changed
+486
-7
No files matched your search
+4
-2
@@ -116,11 +116,13 @@ HALF_PARKOUR = {
|
||||
|
||||
# larger started being slower
|
||||
BLOCK_CACHE_SIZE = 2**14
|
||||
DEFAULT_PATH_TIMEOUT = 2.0
|
||||
|
||||
class Pathfinder(AStar):
|
||||
def __init__(self, g):
|
||||
def __init__(self, g, timeout=DEFAULT_PATH_TIMEOUT):
|
||||
self.g = g
|
||||
self.chunks = g.chunks
|
||||
self.timeout = max(0.0, float(timeout))
|
||||
self.start_time = time.monotonic()
|
||||
|
||||
@functools.lru_cache(maxsize=BLOCK_CACHE_SIZE)
|
||||
@@ -322,7 +324,7 @@ class Pathfinder(AStar):
|
||||
return True, None
|
||||
|
||||
def neighbors(self, node):
|
||||
if time.monotonic() - self.start_time > 2.0:
|
||||
if time.monotonic() - self.start_time > self.timeout:
|
||||
raise AStarTimeout
|
||||
|
||||
results = []
|
||||
|
||||
Reference in new issue
Block a user