Track reopened supply chests and fix API snapshots
This commit is contained in:
@@ -78,6 +78,44 @@ class GroundSupplyTests(unittest.TestCase):
|
||||
self.assertEqual(state.chest, position)
|
||||
self.assertIs(state.state.__func__, state.path_to_supply_chest.__func__)
|
||||
|
||||
def test_empty_supply_chest_is_skipped_until_another_player_opens_it(self):
|
||||
position = (4, 64, 0)
|
||||
key = (position,)
|
||||
event = {'position': position, 'timestamp': 1.0}
|
||||
g = Munch(chest_open_events=[])
|
||||
state = GrabSuppliesStates(g)
|
||||
state.supplies = {(999999,): (1, 1)}
|
||||
state.current_supply_chest_key = key
|
||||
|
||||
class FakeGame:
|
||||
@staticmethod
|
||||
def count_items(_item_ids):
|
||||
return 1
|
||||
|
||||
state.g.game = FakeGame()
|
||||
state.choose_items()
|
||||
self.assertIn(key, state.useless_chests)
|
||||
self.assertIs(state.state.__func__, state.close_supply_chest.__func__)
|
||||
|
||||
second_position = (8, 64, 0)
|
||||
state.supply_chests = [
|
||||
{'position': position, 'positions': key},
|
||||
{'position': second_position, 'positions': (second_position,)},
|
||||
]
|
||||
state.checked_supply_chests = {key}
|
||||
state.choose_supply_chest()
|
||||
self.assertEqual(state.chest, second_position)
|
||||
|
||||
g.chest_open_events.append(event)
|
||||
state.state = state.idle
|
||||
state.run()
|
||||
self.assertNotIn(key, state.useless_chests)
|
||||
self.assertNotIn(key, state.checked_supply_chests)
|
||||
|
||||
state.supply_chests = [{'position': position, 'positions': key}]
|
||||
state.choose_supply_chest()
|
||||
self.assertEqual(state.chest, position)
|
||||
|
||||
def test_unreachable_supply_chest_ends_task_without_searching_barrels(self):
|
||||
class FakeWorld:
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user