Remove delays from gather_crop job
This commit is contained in:
parent
261684ea90
commit
3540e5580e
|
@ -72,13 +72,11 @@ class GatherCropStates:
|
||||||
|
|
||||||
def break_crop(self):
|
def break_crop(self):
|
||||||
self.g.game.break_block(self.crop)
|
self.g.game.break_block(self.crop)
|
||||||
self.wait_time = 0.5
|
self.state = self.wait_for_item
|
||||||
self.state = self.wait
|
|
||||||
|
|
||||||
def wait(self):
|
def wait_for_item(self):
|
||||||
# wait for the item
|
if self.g.item_lock:
|
||||||
if self.wait_time > 0:
|
return
|
||||||
self.wait_time -= utils.TICK
|
|
||||||
else:
|
else:
|
||||||
self.state = self.select_seed
|
self.state = self.select_seed
|
||||||
|
|
||||||
|
@ -91,18 +89,17 @@ class GatherCropStates:
|
||||||
blocks.MATURE_CARROT_ID: items.CARROT_ID,
|
blocks.MATURE_CARROT_ID: items.CARROT_ID,
|
||||||
blocks.MATURE_BEETROOT_ID: items.BEETROOT_SEEDS_ID,
|
blocks.MATURE_BEETROOT_ID: items.BEETROOT_SEEDS_ID,
|
||||||
}
|
}
|
||||||
|
self.target_seed = crop_seeds[self.type_id]
|
||||||
|
|
||||||
if self.g.game.select_item([crop_seeds[self.type_id]]):
|
if self.g.game.select_item([self.target_seed]):
|
||||||
self.state = self.wait_select
|
self.state = self.wait_select
|
||||||
self.wait_time = 0.5
|
|
||||||
else:
|
else:
|
||||||
print('Aborting planting, no crop')
|
print('Aborting planting, no crop')
|
||||||
self.state = self.cleanup
|
self.state = self.cleanup
|
||||||
|
|
||||||
def wait_select(self):
|
def wait_select(self):
|
||||||
# wait a bit to select
|
if self.target_seed != self.g.holding:
|
||||||
if self.wait_time > 0:
|
return
|
||||||
self.wait_time -= utils.TICK
|
|
||||||
else:
|
else:
|
||||||
self.state = self.place_crop
|
self.state = self.place_crop
|
||||||
|
|
||||||
|
@ -111,12 +108,11 @@ class GatherCropStates:
|
||||||
self.g.game.place_block(p, BlockFace.TOP)
|
self.g.game.place_block(p, BlockFace.TOP)
|
||||||
print('Placed crop')
|
print('Placed crop')
|
||||||
self.state = self.wait_place
|
self.state = self.wait_place
|
||||||
self.wait_time = 0.5
|
|
||||||
|
|
||||||
def wait_place(self):
|
def wait_place(self):
|
||||||
# wait a bit for chunk data to update
|
w = self.g.world
|
||||||
if self.wait_time > 0:
|
if w.block_at(*self.crop) == blocks.AIR:
|
||||||
self.wait_time -= utils.TICK
|
return
|
||||||
else:
|
else:
|
||||||
self.state = self.cleanup
|
self.state = self.cleanup
|
||||||
|
|
||||||
|
@ -134,8 +130,8 @@ class GatherCropStates:
|
||||||
|
|
||||||
self.crop = None
|
self.crop = None
|
||||||
self.type_id = None
|
self.type_id = None
|
||||||
|
self.target_seed = None
|
||||||
self.bad_crops = []
|
self.bad_crops = []
|
||||||
self.wait_time = 0
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.state()
|
self.state()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user