Fix more sand bugs

This commit is contained in:
Tanner Collin 2020-09-17 00:01:10 -06:00
parent 5c21634d16
commit ce22946023
2 changed files with 9 additions and 8 deletions

View File

@ -93,7 +93,7 @@ class MCWorld:
try:
s = maze_solver.astar(start, place)
return list(s) if s else None
except AStarTimeout:
except path.AStarTimeout:
return None
def find_bed_areas(self, center, distance):
@ -131,7 +131,7 @@ class MCWorld:
sand = []
for i in range(10):
check = utils.padd(center, utils.alternate(i, 1))
sand.extend(self.find_blocks(check, distance, [66], 20))
sand.extend(self.find_blocks(check, distance, [blocks.SAND], 20))
safe_sand = []
for s in sand:
@ -195,7 +195,7 @@ class Game:
if solution:
solution = list(solution)
self.g.path = solution
#g.jobstate.state = self.g.jobstate.stop
self.g.job.state = self.g.job.stop
print(len(solution))
print(solution)
print(round(time.time() - start, 3), 'seconds')
@ -284,7 +284,6 @@ class Game:
self.g.job.state = self.g.job.stop
reply = 'ok'
if command == 'inv':
for i in self.g.inv.values():
if i.present:

10
jobs.py
View File

@ -180,12 +180,14 @@ class GatherSandStates:
w = self.g.world
p = utils.pint(self.g.pos)
sand = w.find_sand(p, 150, self.origin)
sand = w.find_sand(p, 50, self.origin)
print('Found sand:', sand)
while sand[0] in self.bad_sand:
sand.pop(0)
self.sand = sand[0]
for check in sand:
if check in self.bad_sand:
continue
self.sand = check
break
self.state = self.nav_to_sand