Don't pick up bed items near other bots
This commit is contained in:
1 parent
032b4cfd33
commit
185cefced9
4 files changed
+142
-1
No files matched your search
@@ -52,6 +52,46 @@ class GroundSupplyTests(unittest.TestCase):
|
||||
self.assertEqual(state.target_items, (items.CHEST_ID,))
|
||||
self.assertIs(state.state.__func__, state.find_ground_items.__func__)
|
||||
|
||||
def test_grab_supplies_leaves_bed_drop_near_sibling_bot(self):
|
||||
bed = Munch(
|
||||
entity_id=13, item_id=next(iter(items.BED_IDS)),
|
||||
x=1.0, y=64.0, z=0.0)
|
||||
|
||||
class FakeWorld:
|
||||
@staticmethod
|
||||
def find_objects(_item_ids):
|
||||
return [bed]
|
||||
|
||||
@staticmethod
|
||||
def path_to_place(*_args):
|
||||
raise AssertionError('must not path to another bot\'s bed')
|
||||
|
||||
class FakeGame:
|
||||
@staticmethod
|
||||
def count_items(_item_ids):
|
||||
return 0
|
||||
|
||||
g = Munch(
|
||||
name='mosfet1', pos=(0.5, 64.0, 0.5), world=FakeWorld(),
|
||||
game=FakeGame(), players={
|
||||
2: Munch(player_uuid='other-uuid', x=2.0, y=64.0, z=0.0),
|
||||
}, player_names={'other-uuid': 'mosfet2'}, objects={13: bed},
|
||||
path=[], ground_stack_counts={},
|
||||
)
|
||||
state = GrabSuppliesStates(g)
|
||||
state.checked_ground_items = set()
|
||||
state.checked_ground_groups = set()
|
||||
state.ground_stack_counts = {}
|
||||
state.target_items = tuple(items.BED_IDS)
|
||||
state.target_maximum_stacks = 1
|
||||
|
||||
self.assertFalse(state._has_nearby_ground_items(
|
||||
state.target_items, state.target_maximum_stacks))
|
||||
state.find_ground_items()
|
||||
|
||||
self.assertIn(state.target_items, state.checked_ground_groups)
|
||||
self.assertIs(state.state.__func__, state.check_supplies.__func__)
|
||||
|
||||
def test_supply_selection_uses_only_addressed_supply_chests(self):
|
||||
position = (4, 64, 0)
|
||||
chest_record = {
|
||||
|
||||
Reference in new issue
Block a user