Queue: gathering too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-27 23:02:57 +00:00
parent a723558fb2
commit 45a51476a9
3 changed files with 19 additions and 9 deletions

View file

@ -103,6 +103,15 @@ class ActionTest(unittest.TestCase):
self.assertEqual(summary["resumed"], "mine_stone")
self.assertEqual(p["queue"], [])
def test_queue_gathering(self):
world, p = self._smith(4)
self.assertIsNone(game.queue_add(world, p, "cut_logs", 3, T0)) # starts it, mining is what comes after
self.assertIsNone(game.queue_add(world, p, "smith_copper_legs", 1, T0))
self.assertIsNone(game.queue_add(world, p, "cut_logs", 2, T0))
game.process_player(world, p, T0 + 3600, random.Random(1))
self.assertEqual((p["bank"].get("logs"), p["bank"].get("copper_legs")), (5, 1))
self.assertEqual((p["action"]["id"], p["queue"]), ("mine_stone", []))
def test_queue_skips_what_you_cant_make(self):
world, p = self._smith(4)
game.start_action(world, p, "smith_copper_helmet", T0, once=1)
@ -133,7 +142,7 @@ class ActionTest(unittest.TestCase):
def test_queue_rules(self):
world, p = self._smith(4)
self.assertEqual(game.queue_add(world, p, "cut_logs", 1, T0), "Only crafting can be queued")
self.assertEqual(game.queue_add(world, p, "bury_bones", 1, T0), "Only crafting and gathering can be queued")
self.assertIsNone(game.queue_add(world, p, "smith_copper_helmet", 1, T0))
self.assertEqual(p["action"]["id"], "smith_copper_helmet") # nothing being made: it just starts
self.assertEqual(p["action"]["resume"], "mine_stone")