Begin port to 26.3: movement
This commit is contained in:
+4
-5
@@ -121,7 +121,7 @@ class Pathfinder(AStar):
|
||||
def __init__(self, g):
|
||||
self.g = g
|
||||
self.chunks = g.chunks
|
||||
self.start_time = time.time()
|
||||
self.start_time = time.monotonic()
|
||||
|
||||
@functools.lru_cache(maxsize=BLOCK_CACHE_SIZE)
|
||||
def bair(self, p):
|
||||
@@ -267,6 +267,9 @@ class Pathfinder(AStar):
|
||||
return True
|
||||
|
||||
def neighbors(self, node):
|
||||
if time.monotonic() - self.start_time > 2.0:
|
||||
raise AStarTimeout
|
||||
|
||||
results = []
|
||||
|
||||
if self.g.crawling:
|
||||
@@ -296,10 +299,6 @@ class Pathfinder(AStar):
|
||||
if self.check_parkour(node, offset):
|
||||
results.append(utils.padd(node, offset))
|
||||
|
||||
if not results:
|
||||
if time.time() - self.start_time > 2.0:
|
||||
raise(AStarTimeout)
|
||||
|
||||
return results
|
||||
|
||||
def distance_between(self, n1, n2):
|
||||
|
||||
Reference in New Issue
Block a user