Fix random bugs

This commit is contained in:
2021-02-22 01:44:55 +00:00
parent 1fe35c77fc
commit 743d002167
3 changed files with 20 additions and 13 deletions
+16 -12
View File
@@ -403,6 +403,7 @@ class GatherWoodStates:
print('Unable to get to tree', self.tree)
if self.tree not in self.good_trees:
self.bad_trees.append(self.tree)
print('Added to bad trees list')
self.state = self.cleanup
return
@@ -507,7 +508,6 @@ class GatherWoodStates:
# never gets ran, placeholder
return None
def __init__(self, global_state):
self.g = global_state
self.state = self.idle
@@ -1288,19 +1288,23 @@ class ClearLeavesStates:
return None
def init(self):
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 not self.g.chopped_tree:
print('Didnt chop tree, clearing leaves')
self.state = self.cleanup
return
if num_saplings > 8:
print('Aborting clearing leaves')
self.state = self.cleanup
return
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')
self.state = self.select_log
print('Clearing leaves...')
if num_saplings > 8:
print('Have enough saplings, aborting clearing leaves')
self.state = self.cleanup
return
self.state = self.select_log
print('Clearing leaves...')
def select_log(self):
# select a log to avoid using tools