Add sand safety inspection command
This commit is contained in:
1 parent
c3a045d17a
commit
142381d40f
5 files changed
+103
-51
No files matched your search
@@ -67,19 +67,7 @@ class GatherSandStates:
|
||||
self.state = self.find_new_slice
|
||||
|
||||
def _sand_is_safe(self, position):
|
||||
world = self.g.world
|
||||
if world.block_at(*position) != blocks.SAND:
|
||||
return False
|
||||
|
||||
below = world.block_at(*utils.padd(position, (0, -1, 0)))
|
||||
below_two = world.block_at(*utils.padd(position, (0, -2, 0)))
|
||||
above = world.block_at(*utils.padd(position, (0, 1, 0)))
|
||||
if (below is None or below_two is None or above is None or
|
||||
below in blocks.NON_SOLID_IDS or
|
||||
below_two in blocks.NON_SOLID_IDS or
|
||||
above not in blocks.NON_SOLID_IDS):
|
||||
return False
|
||||
return world.sand_adjacent_safe(position)
|
||||
return self.g.world.sand_safety(position)[0]
|
||||
|
||||
def find_new_slice(self):
|
||||
print('Finding a new 3x3x1 sand slice...')
|
||||
@@ -110,8 +98,9 @@ class GatherSandStates:
|
||||
self.state = self.nav_to_sand
|
||||
return
|
||||
|
||||
print('No more eligible sand in slice', self.sand_slice)
|
||||
self.state = self.find_new_slice
|
||||
print('Finished sand slice', self.sand_slice,
|
||||
'; running pickup and maintenance')
|
||||
self.state = self.cleanup
|
||||
|
||||
def _sand_openings(self):
|
||||
world = self.g.world
|
||||
|
||||
Reference in new issue
Block a user