Improve searching for crops

This commit is contained in:
2021-04-23 01:25:44 +00:00
parent 9874e23aa6
commit 23891066c0
5 changed files with 69 additions and 54 deletions
+4 -2
View File
@@ -35,8 +35,7 @@ class GatherCropStates:
blocks.MATURE_BEETROOT_ID,
]
for crop in w.find_blocks_3d(p, mature_crops, 50, 20):
print('Found crop:', crop)
for crop in w.find_blocks_3d(p, mature_crops, 50, 20, True):
if crop not in self.bad_crops:
break
else: # for
@@ -44,6 +43,7 @@ class GatherCropStates:
self.state = self.cleanup
return
print('Found crop:', crop)
self.crop = crop
self.type_id = w.block_at(*crop)
self.state = self.nav_to_crop
@@ -55,10 +55,12 @@ class GatherCropStates:
navpath = w.path_to_place(p, self.crop)
if navpath:
print('Going to crop', self.crop)
self.g.path = navpath
self.g.look_at = utils.padd(self.crop, path.BLOCK_BELOW)
self.state = self.going_to_crop
else:
print('Cant get to it, blacklisting')
self.bad_crops.append(self.crop)
self.wait_time = 0.5
self.state = self.wait_to_restart