|
|
|
@ -61,7 +61,7 @@ class GrabSuppliesStates: |
|
|
|
|
w = self.g.world |
|
|
|
|
p = utils.pint(self.g.pos) |
|
|
|
|
|
|
|
|
|
self.barrels = w.find_blocks_indexed(p, blocks.BARREL_IDS) |
|
|
|
|
self.barrels = w.find_blocks_indexed(p, blocks.BARREL_IDS, 80) |
|
|
|
|
print('Found:', self.barrels) |
|
|
|
|
self.state = self.choose_barrel |
|
|
|
|
|
|
|
|
@ -73,6 +73,7 @@ class GrabSuppliesStates: |
|
|
|
|
if barrel in self.bad_barrels: |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
print('Chose:', barrel) |
|
|
|
|
self.barrel = barrel |
|
|
|
|
self.state = self.path_to_barrel |
|
|
|
|
return |
|
|
|
@ -86,26 +87,20 @@ class GrabSuppliesStates: |
|
|
|
|
p = utils.pint(self.g.pos) |
|
|
|
|
c = self.g.chunks |
|
|
|
|
|
|
|
|
|
barrel = self.barrel |
|
|
|
|
|
|
|
|
|
tmp = c.get_block_at(*barrel) |
|
|
|
|
c.set_block_at(*barrel, blocks.AIR) |
|
|
|
|
navpath = w.path_to_place(p, barrel) |
|
|
|
|
c.set_block_at(*barrel, tmp) |
|
|
|
|
|
|
|
|
|
navpath = w.path_to_place_faked(p, self.barrel) |
|
|
|
|
print('navpath:', navpath) |
|
|
|
|
|
|
|
|
|
if navpath: |
|
|
|
|
self.g.path = navpath[:-1] |
|
|
|
|
self.opening = self.g.path[-1] |
|
|
|
|
self.checked_barrels.append(barrel) |
|
|
|
|
self.area = barrel |
|
|
|
|
self.checked_barrels.append(self.barrel) |
|
|
|
|
self.area = self.barrel |
|
|
|
|
self.state = self.going_to_barrel |
|
|
|
|
self.checked_supplies = [] |
|
|
|
|
return |
|
|
|
|
else: |
|
|
|
|
print('No path, blacklisting barrel') |
|
|
|
|
self.bad_barrels.append(barrel) |
|
|
|
|
self.bad_barrels.append(self.barrel) |
|
|
|
|
self.state = self.choose_barrel |
|
|
|
|
|
|
|
|
|
def going_to_barrel(self): |
|
|
|
|