|
|
|
@ -259,6 +259,9 @@ class GatherWoodStates: |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
self.tree = tree |
|
|
|
|
self.type = blocks.BLOCKS[w.block_at(*tree)].replace('_log', '') |
|
|
|
|
print('Type:', self.type) |
|
|
|
|
|
|
|
|
|
self.state = self.find_openings |
|
|
|
|
|
|
|
|
|
def find_openings(self): |
|
|
|
@ -360,7 +363,7 @@ class GatherWoodStates: |
|
|
|
|
if self.wait_time > 0: |
|
|
|
|
self.wait_time -= utils.TICK |
|
|
|
|
else: |
|
|
|
|
self.g.chopped_tree = True |
|
|
|
|
self.g.chopped_tree = self.type |
|
|
|
|
self.good_trees.append(self.tree) |
|
|
|
|
self.state = self.check_pos |
|
|
|
|
|
|
|
|
@ -386,6 +389,7 @@ class GatherWoodStates: |
|
|
|
|
self.state = self.idle |
|
|
|
|
|
|
|
|
|
self.tree = None |
|
|
|
|
self.type = None |
|
|
|
|
self.openings = [] |
|
|
|
|
self.bad_trees = [] |
|
|
|
|
self.good_trees = [] |
|
|
|
@ -766,7 +770,7 @@ class CacheItemsStates: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def select_chest(self): |
|
|
|
|
if self.g.game.select_item(items.CHEST_ID): |
|
|
|
|
if self.g.game.select_item([items.CHEST_ID]): |
|
|
|
|
self.state = self.find_cache_spot |
|
|
|
|
else: |
|
|
|
|
print('No chest, aborting') |
|
|
|
@ -931,13 +935,15 @@ class PlantTreeStates: |
|
|
|
|
|
|
|
|
|
def select_sapling(self): |
|
|
|
|
p = utils.pint(self.g.pos) |
|
|
|
|
sapling_type = self.g.chopped_tree + '_sapling' |
|
|
|
|
sapling_item = items.get_id(sapling_type) |
|
|
|
|
|
|
|
|
|
if self.g.game.select_random_item(items.SAPLING_IDS): |
|
|
|
|
if self.g.game.select_item([sapling_item]): |
|
|
|
|
self.g.look_at = utils.padd(p, path.BLOCK_BELOW) |
|
|
|
|
self.state = self.wait_select |
|
|
|
|
self.wait_time = 1 |
|
|
|
|
else: |
|
|
|
|
print('Aborting planting, no saplings') |
|
|
|
|
print('Aborting planting, no', sapling_type) |
|
|
|
|
self.state = self.cleanup |
|
|
|
|
|
|
|
|
|
def wait_select(self): |
|
|
|
@ -1005,14 +1011,19 @@ class ClearLeavesStates: |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
def init(self): |
|
|
|
|
num_saplings = self.g.game.count_items(items.SAPLING_IDS) |
|
|
|
|
print('Have', num_saplings, 'saplings in inventory') |
|
|
|
|
if num_saplings < 8: |
|
|
|
|
self.state = self.find_leaves |
|
|
|
|
print('Clearing leaves...') |
|
|
|
|
else: |
|
|
|
|
print('Aborting clearing leaves') |
|
|
|
|
self.state = self.cleanup |
|
|
|
|
if self.g.chopped_tree: |
|
|
|
|
sapling_type = self.g.chopped_tree + '_sapling' |
|
|
|
|
sapling_item = items.get_id(sapling_type) |
|
|
|
|
num_saplings = self.g.game.count_items([sapling_item]) |
|
|
|
|
print('Have', num_saplings, sapling_type, 'in inventory') |
|
|
|
|
|
|
|
|
|
if num_saplings > 8: |
|
|
|
|
print('Aborting clearing leaves') |
|
|
|
|
self.state = self.cleanup |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
self.state = self.find_leaves |
|
|
|
|
print('Clearing leaves...') |
|
|
|
|
|
|
|
|
|
def find_leaves(self): |
|
|
|
|
w = self.g.world |
|
|
|
|