Fix bugs and pause on zzz

This commit is contained in:
2020-12-18 04:15:09 +00:00
parent d108d7c817
commit cdd71d2610
4 changed files with 21 additions and 18 deletions
+13 -5
View File
@@ -364,6 +364,10 @@ class GatherWoodStates:
def init(self):
self.g.chopped_tree = False
self.state = self.select_axe
def select_axe(self):
self.g.game.select_item(items.AXE_IDS)
self.state = self.find_new_tree
def find_new_tree(self):
@@ -647,7 +651,7 @@ class GrabSandStates:
w = self.g.world
p = utils.pint(self.g.pos)
sand = w.find_objects(items.SAND_ID)
sand = w.find_objects([items.SAND_ID])
if not sand:
print('No sand objects found, aborting')
@@ -771,7 +775,7 @@ class SleepWithBedStates:
self.state = self.use_bed
def use_bed(self):
if self.g.time >= 12542:
if self.g.time > 12550:
print('Sleeping')
self.g.game.place_block(self.area, BlockFace.TOP)
if not self.silent:
@@ -798,7 +802,7 @@ class SleepWithBedStates:
def collect_bed(self):
if not self.g.breaking:
self.g.path = [utils.padd(self.area, utils.spiral(n)) for n in range(9)]
self.wait_time = 4
self.wait_time = 2
self.state = self.wait
def wait(self):
@@ -1101,7 +1105,7 @@ class GrabSuppliesStates:
self.state = self.going_to_barrel
return
else:
self.barrel.pop(0)
self.barrels.pop(0)
def going_to_barrel(self):
if utils.pint(self.g.pos) == self.opening:
@@ -1140,7 +1144,7 @@ class GrabSuppliesStates:
if slot.item_id not in self.target_items:
continue
if self.count >= self.maximum_items:
if self.maximum_items and self.count >= self.maximum_items:
break
self.count += 1
@@ -1743,6 +1747,7 @@ class JobStates:
def farm_sand(self):
machines = [
self.grab_supplies_states,
self.check_threats_states,
self.gather_sand_states,
self.grab_sand_states,
@@ -1751,6 +1756,9 @@ class JobStates:
]
self.sleep_with_bed_states.silent = True
self.cache_items_states.silent = True
self.grab_supplies_states.supplies = {
tuple(items.SHOVEL_IDS): 9
}
return machines
def cache_items(self):