Look along path while approaching beds
This commit is contained in:
@@ -243,6 +243,37 @@ class TestSleepWithBed(unittest.TestCase):
|
||||
self.assertEqual(state.beds, [])
|
||||
self.assertEqual(state.state, state.choose_bed)
|
||||
|
||||
def test_bed_approach_follows_path_before_aiming_at_bed(self):
|
||||
bed = (4, 64, 2)
|
||||
opening = (3, 64, 0)
|
||||
state = SleepWithBedStates(Munch(
|
||||
pos=(0, 64, 0), path=[opening], look_at=bed,
|
||||
game=FakeGame(), world=FakeWorld()))
|
||||
state.area = bed
|
||||
state.opening = opening
|
||||
state.opening_deadline = 9999999999
|
||||
|
||||
state.going_to_bed()
|
||||
self.assertIsNone(state.g.look_at)
|
||||
|
||||
state.g.pos = opening
|
||||
state.going_to_bed()
|
||||
self.assertEqual(state.g.look_at, bed)
|
||||
self.assertEqual(state.state, state.turn_to_bed)
|
||||
|
||||
def test_bed_placement_approach_follows_path(self):
|
||||
opening = (3, 64, 0)
|
||||
state = SleepWithBedStates(Munch(
|
||||
pos=(0, 64, 0), path=[opening], look_at=(4, 64, 2),
|
||||
game=FakeGame(), world=FakeWorld()))
|
||||
state.area = (4, 64, 2)
|
||||
state.opening = opening
|
||||
state.opening_deadline = 9999999999
|
||||
|
||||
state.going_to_area()
|
||||
|
||||
self.assertIsNone(state.g.look_at)
|
||||
|
||||
def test_arrival_accepts_completed_path_with_small_position_error(self):
|
||||
state = SleepWithBedStates(Munch(
|
||||
pos=(0, 64, 0), path=[(1, 64, 0)], look_at=None,
|
||||
|
||||
Reference in New Issue
Block a user