From daf152389ad0c279231b2724345031115238f619 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 17 Apr 2021 20:59:06 +0000 Subject: [PATCH] Only try to sleep in one existing bed --- jobs.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jobs.py b/jobs.py index 848c9d3..bcc6e90 100644 --- a/jobs.py +++ b/jobs.py @@ -739,7 +739,13 @@ class SleepWithBedStates: w = self.g.world p = utils.pint(self.g.pos) - self.beds = w.find_blocks_indexed(p, blocks.BED_IDS) + result = w.find_blocks_indexed(p, blocks.BED_IDS) + + self.beds = [] + for bed in result: + if bed not in self.beds and bed not in self.bad_beds: + self.beds.append(bed) + print('Found:', self.beds) self.state = self.choose_bed @@ -755,6 +761,7 @@ class SleepWithBedStates: return bed = self.beds[0] + print('Chose:', bed) tmp = c.get_block_at(*bed) c.set_block_at(*bed, blocks.AIR) @@ -771,6 +778,9 @@ class SleepWithBedStates: return else: self.beds.pop(0) + self.bad_beds.append(bed) + print('Cant get to bed, blacklisting') + self.state = self.select_bed def going_to_bed(self): if utils.pint(self.g.pos) == self.opening: @@ -884,6 +894,7 @@ class SleepWithBedStates: self.my_bed = False self.beds = [] + self.bad_beds = [] self.area = None self.opening = None self.bad_areas = []