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
+12 -2
View File
@@ -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):