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.command_lock = False
|
||||||
|
|
||||||
g.window = None
|
g.window = None
|
||||||
|
g.trades = []
|
||||||
|
|
||||||
g.job = jobs.JobStates(g)
|
g.job = jobs.JobStates(g)
|
||||||
g.chopped_tree = False
|
g.chopped_tree = False
|
||||||
|
@ -246,7 +247,7 @@ def bot(global_state):
|
||||||
time.sleep(utils.TICK)
|
time.sleep(utils.TICK)
|
||||||
print('Player loaded.')
|
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)
|
time.sleep(utils.TICK)
|
||||||
print('Chunks loaded.')
|
print('Chunks loaded.')
|
||||||
|
|
||||||
|
|
2
game.py
2
game.py
|
@ -922,7 +922,9 @@ class Game:
|
||||||
def select_next_item(self):
|
def select_next_item(self):
|
||||||
# select the next item slot that has an item
|
# select the next item slot that has an item
|
||||||
for slot, item in self.g.inv.items():
|
for slot, item in self.g.inv.items():
|
||||||
|
if slot < 9: continue # skip armour slots
|
||||||
if item.present:
|
if item.present:
|
||||||
|
print('slot:', slot, 'item:', item)
|
||||||
self.g.game.choose_slot(slot)
|
self.g.game.choose_slot(slot)
|
||||||
self.g.holding = item.item_id
|
self.g.holding = item.item_id
|
||||||
return True
|
return True
|
||||||
|
|
28
jobs.py
28
jobs.py
|
@ -403,6 +403,7 @@ class GatherWoodStates:
|
||||||
print('Unable to get to tree', self.tree)
|
print('Unable to get to tree', self.tree)
|
||||||
if self.tree not in self.good_trees:
|
if self.tree not in self.good_trees:
|
||||||
self.bad_trees.append(self.tree)
|
self.bad_trees.append(self.tree)
|
||||||
|
print('Added to bad trees list')
|
||||||
self.state = self.cleanup
|
self.state = self.cleanup
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -507,7 +508,6 @@ class GatherWoodStates:
|
||||||
# never gets ran, placeholder
|
# never gets ran, placeholder
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, global_state):
|
def __init__(self, global_state):
|
||||||
self.g = global_state
|
self.g = global_state
|
||||||
self.state = self.idle
|
self.state = self.idle
|
||||||
|
@ -1288,19 +1288,23 @@ class ClearLeavesStates:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
if self.g.chopped_tree:
|
if not self.g.chopped_tree:
|
||||||
sapling_type = self.g.chopped_tree + '_sapling'
|
print('Didnt chop tree, clearing leaves')
|
||||||
sapling_item = items.get_id(sapling_type)
|
self.state = self.cleanup
|
||||||
num_saplings = self.g.game.count_items([sapling_item])
|
return
|
||||||
print('Have', num_saplings, sapling_type, 'in inventory')
|
|
||||||
|
|
||||||
if num_saplings > 8:
|
sapling_type = self.g.chopped_tree + '_sapling'
|
||||||
print('Aborting clearing leaves')
|
sapling_item = items.get_id(sapling_type)
|
||||||
self.state = self.cleanup
|
num_saplings = self.g.game.count_items([sapling_item])
|
||||||
return
|
print('Have', num_saplings, sapling_type, 'in inventory')
|
||||||
|
|
||||||
self.state = self.select_log
|
if num_saplings > 8:
|
||||||
print('Clearing leaves...')
|
print('Have enough saplings, aborting clearing leaves')
|
||||||
|
self.state = self.cleanup
|
||||||
|
return
|
||||||
|
|
||||||
|
self.state = self.select_log
|
||||||
|
print('Clearing leaves...')
|
||||||
|
|
||||||
def select_log(self):
|
def select_log(self):
|
||||||
# select a log to avoid using tools
|
# select a log to avoid using tools
|
||||||
|
|
Loading…
Reference in New Issue
Block a user