|
|
|
@ -38,15 +38,19 @@ class FindGappleStates: |
|
|
|
|
step = utils.spiral(self.count) |
|
|
|
|
step_scaled = utils.pmul(step, 192) |
|
|
|
|
self.coord = utils.padd(self.origin, step_scaled) |
|
|
|
|
self.coord = utils.padd(self.coord, (0, 50, 0)) |
|
|
|
|
self.coord = (self.coord[0], 50, self.coord[2]) |
|
|
|
|
|
|
|
|
|
print('count:', self.count, 'teleporting to:', self.coord) |
|
|
|
|
self.g.chat.send('/tp {} {} {}'.format(*self.coord)) |
|
|
|
|
|
|
|
|
|
self.g.command_lock = True |
|
|
|
|
self.state = self.wait_for_load |
|
|
|
|
|
|
|
|
|
def wait_for_load(self): |
|
|
|
|
if self.g.chunks.check_loaded(self.g.pos): |
|
|
|
|
if self.g.command_lock: |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
if self.g.chunks.check_loaded(self.g.pos, 169): |
|
|
|
|
print('chunks have been loaded') |
|
|
|
|
self.state = self.pick_chest |
|
|
|
|
|
|
|
|
@ -56,9 +60,16 @@ class FindGappleStates: |
|
|
|
|
chest_list.extend(self.g.chunks.index.get(chest_id, [])) |
|
|
|
|
|
|
|
|
|
for chest in chest_list: |
|
|
|
|
if chest in self.checked_chests: continue |
|
|
|
|
if chest in self.checked_chests: |
|
|
|
|
# slow but simple |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
if utils.phyp_king(self.coord, chest) > 96: |
|
|
|
|
# skip because we can't detect item drops |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
self.current_chest = chest |
|
|
|
|
self.checked_chests.append(self.current_chest) |
|
|
|
|
self.state = self.break_chest |
|
|
|
|
break |
|
|
|
|
else: # for |
|
|
|
@ -68,13 +79,21 @@ class FindGappleStates: |
|
|
|
|
def break_chest(self): |
|
|
|
|
print('Breaking chest', self.current_chest) |
|
|
|
|
self.g.command_lock = True |
|
|
|
|
self.g.item_lock = True |
|
|
|
|
self.g.chat.send('/setblock {} {} {} air destroy'.format(*self.current_chest)) |
|
|
|
|
self.checked_chests.append(self.current_chest) |
|
|
|
|
|
|
|
|
|
self.wait_time = 0.5 |
|
|
|
|
self.state = self.wait_for_items |
|
|
|
|
|
|
|
|
|
def wait_for_items(self): |
|
|
|
|
if not self.g.command_lock: |
|
|
|
|
# wait for command to execute |
|
|
|
|
if self.g.command_lock: |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
# wait for items to drop |
|
|
|
|
if self.wait_time > 0: |
|
|
|
|
self.wait_time -= utils.TICK |
|
|
|
|
else: |
|
|
|
|
print('done waiting for items') |
|
|
|
|
self.state = self.pick_chest |
|
|
|
|
|
|
|
|
@ -95,6 +114,7 @@ class FindGappleStates: |
|
|
|
|
self.coord = None |
|
|
|
|
self.current_chest = None |
|
|
|
|
self.checked_chests = [] |
|
|
|
|
self.wait_time = 0 |
|
|
|
|
|
|
|
|
|
def run(self): |
|
|
|
|
self.state() |
|
|
|
@ -602,7 +622,7 @@ class JobStates: |
|
|
|
|
if s1.state == s1.idle: |
|
|
|
|
s1.state = s1.init |
|
|
|
|
elif s1.state == s1.done: |
|
|
|
|
s1.state = s1.init |
|
|
|
|
s1.state = s1.tp_to_coord |
|
|
|
|
|
|
|
|
|
s1.run() |
|
|
|
|
|
|
|
|
|