Improve searching for crops
This commit is contained in:
@@ -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
|
||||
|
@@ -29,8 +29,7 @@ class GatherWartStates:
|
||||
p = utils.pint(self.g.pos)
|
||||
|
||||
mature_wart = max(blocks.NETHERWART_IDS)
|
||||
for wart in w.find_blocks_3d(p, [mature_wart], 50, 20):
|
||||
print('Found wart:', wart)
|
||||
for wart in w.find_blocks_3d(p, [mature_wart], 50, 20, True):
|
||||
if wart not in self.bad_warts:
|
||||
break
|
||||
else: # for
|
||||
@@ -38,6 +37,7 @@ class GatherWartStates:
|
||||
self.state = self.cleanup
|
||||
return
|
||||
|
||||
print('Found wart:', wart)
|
||||
self.wart = wart
|
||||
self.state = self.nav_to_wart
|
||||
|
||||
@@ -48,11 +48,21 @@ class GatherWartStates:
|
||||
navpath = w.path_to_place(p, self.wart)
|
||||
|
||||
if navpath:
|
||||
print('Going to wart', self.crop)
|
||||
self.g.path = navpath
|
||||
self.g.look_at = utils.padd(self.wart, path.BLOCK_BELOW)
|
||||
self.state = self.going_to_wart
|
||||
else:
|
||||
print('Cant get to it, blacklisting')
|
||||
self.bad_warts.append(wart)
|
||||
self.wait_time = 0.5
|
||||
self.state = self.wait_to_restart
|
||||
|
||||
def wait_to_restart(self):
|
||||
# prevent timeouts
|
||||
if self.wait_time > 0:
|
||||
self.wait_time -= utils.TICK
|
||||
else:
|
||||
self.state = self.find_new_wart
|
||||
|
||||
def going_to_wart(self):
|
||||
|
Reference in New Issue
Block a user