Fix random bugs
This commit is contained in:
parent
1fe35c77fc
commit
743d002167
3
bot.py
3
bot.py
|
@ -206,6 +206,7 @@ def init(global_state):
|
|||
g.command_lock = False
|
||||
|
||||
g.window = None
|
||||
g.trades = []
|
||||
|
||||
g.job = jobs.JobStates(g)
|
||||
g.chopped_tree = False
|
||||
|
@ -246,7 +247,7 @@ def bot(global_state):
|
|||
time.sleep(utils.TICK)
|
||||
print('Player loaded.')
|
||||
|
||||
while not g.chunks.check_loaded(g.pos, 529):
|
||||
while not g.chunks.check_loaded(g.pos, 288):
|
||||
time.sleep(utils.TICK)
|
||||
print('Chunks loaded.')
|
||||
|
||||
|
|
2
game.py
2
game.py
|
@ -922,7 +922,9 @@ class Game:
|
|||
def select_next_item(self):
|
||||
# select the next item slot that has an item
|
||||
for slot, item in self.g.inv.items():
|
||||
if slot < 9: continue # skip armour slots
|
||||
if item.present:
|
||||
print('slot:', slot, 'item:', item)
|
||||
self.g.game.choose_slot(slot)
|
||||
self.g.holding = item.item_id
|
||||
return True
|
||||
|
|
28
jobs.py
28
jobs.py
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user