Sleep 0.1 s after failing to pathfind to prevent timeouts
This commit is contained in:
parent
7caa51f011
commit
a49caaedf5
|
@ -65,6 +65,7 @@ class CacheItemsStates:
|
|||
return
|
||||
else:
|
||||
self.trapped_chests.pop(0)
|
||||
time.sleep(0.1)
|
||||
|
||||
def going_to_trapped_chest(self):
|
||||
if utils.pint(self.g.pos) == self.opening:
|
||||
|
|
|
@ -64,6 +64,7 @@ class CheckThreatsStates:
|
|||
return
|
||||
else:
|
||||
print('Cant get to safety', self.safety)
|
||||
time.sleep(0.1)
|
||||
|
||||
print('Cant get to safety, aborting')
|
||||
self.state = self.cleanup
|
||||
|
|
|
@ -139,8 +139,7 @@ class FillBlocksStates:
|
|||
else:
|
||||
print('Cant get to that block')
|
||||
self.state = self.cleanup
|
||||
#self.bad_sand.append(self.sand)
|
||||
#self.state = self.find_new_sand
|
||||
time.sleep(0.1)
|
||||
|
||||
def going_to_block(self):
|
||||
if not len(self.g.path):
|
||||
|
|
|
@ -61,15 +61,8 @@ class GatherCropStates:
|
|||
self.state = self.going_to_crop
|
||||
else:
|
||||
print('Cant get to it, blacklisting')
|
||||
time.sleep(0.1)
|
||||
self.bad_crops.append(self.crop)
|
||||
self.wait_time = 0.5
|
||||
self.state = self.wait_to_restart
|
||||
|
||||
def wait_to_restart(self):
|
||||
# prevent timeouts
|
||||
if self.wait_time > 0:
|
||||
self.wait_time -= utils.TICK
|
||||
else:
|
||||
self.state = self.find_new_crop
|
||||
|
||||
def going_to_crop(self):
|
||||
|
|
|
@ -89,6 +89,7 @@ class GatherSandStates:
|
|||
self.state = self.going_to_sand
|
||||
else:
|
||||
print('Cant get to that sand')
|
||||
time.sleep(0.1)
|
||||
self.bad_sand.append(self.sand)
|
||||
self.state = self.find_new_sand
|
||||
|
||||
|
|
|
@ -54,15 +54,8 @@ class GatherWartStates:
|
|||
self.state = self.going_to_wart
|
||||
else:
|
||||
print('Cant get to it, blacklisting')
|
||||
time.sleep(0.1)
|
||||
self.bad_warts.append(wart)
|
||||
self.wait_time = 0.5
|
||||
self.state = self.wait_to_restart
|
||||
|
||||
def wait_to_restart(self):
|
||||
# prevent timeouts
|
||||
if self.wait_time > 0:
|
||||
self.wait_time -= utils.TICK
|
||||
else:
|
||||
self.state = self.find_new_wart
|
||||
|
||||
def going_to_wart(self):
|
||||
|
|
|
@ -80,6 +80,7 @@ class GatherWoodStates:
|
|||
self.state = self.going_to_tree
|
||||
else:
|
||||
self.openings.pop(0)
|
||||
time.sleep(0.1)
|
||||
|
||||
def going_to_tree(self):
|
||||
if utils.pint(self.g.pos) == self.openings[0]:
|
||||
|
@ -126,6 +127,7 @@ class GatherWoodStates:
|
|||
else:
|
||||
self.openings.pop(0)
|
||||
self.state = self.choose_opening
|
||||
time.sleep(0.1)
|
||||
|
||||
def going_to_trunk_base(self):
|
||||
if utils.pint(self.g.pos) == self.tree:
|
||||
|
|
|
@ -61,6 +61,7 @@ class GrabSandStates:
|
|||
return
|
||||
else:
|
||||
print('Cant get to sand', self.sand)
|
||||
time.sleep(0.1)
|
||||
|
||||
print('Cant get to any more sand, aborting')
|
||||
self.state = self.cleanup
|
||||
|
|
|
@ -100,6 +100,7 @@ class GrabSuppliesStates:
|
|||
return
|
||||
else:
|
||||
print('No path, blacklisting barrel')
|
||||
time.sleep(0.1)
|
||||
self.bad_barrels.append(self.barrel)
|
||||
self.state = self.choose_barrel
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ class SellToVillagerStates:
|
|||
self.state = self.going_to_villager
|
||||
else:
|
||||
self.openings.pop(0)
|
||||
time.sleep(0.1)
|
||||
|
||||
def going_to_villager(self):
|
||||
if utils.pint(self.g.pos) == self.openings[0]:
|
||||
|
|
|
@ -81,6 +81,7 @@ class SleepWithBedStates:
|
|||
self.beds.pop(0)
|
||||
self.bad_beds.append(bed)
|
||||
print('Cant get to bed, blacklisting')
|
||||
time.sleep(0.1)
|
||||
self.state = self.select_bed
|
||||
|
||||
def going_to_bed(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user