Queue: swap #1 with the current make
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fa960e1d6c
commit
3d93fabbfd
4 changed files with 43 additions and 1 deletions
21
game.py
21
game.py
|
|
@ -3252,6 +3252,24 @@ def queue_move(player: dict, index: int, to: int) -> str | None:
|
|||
return None
|
||||
|
||||
|
||||
def queue_now(world: dict, player: dict, index: int, now: float) -> str | None:
|
||||
"""Start a queued make now: the one running goes to the front of the queue with what it had left."""
|
||||
queue, current = player["queue"], player["action"]
|
||||
if not 0 <= index < len(queue):
|
||||
return "Not in the queue"
|
||||
if not current or "left" not in current or "order" in current or not queueable(ACTION_BY_ID[current["id"]]):
|
||||
return "Not making anything"
|
||||
action = ACTION_BY_ID.get(queue[index]["id"])
|
||||
reason = can_start(world, player, action) if action else "No such action"
|
||||
if reason:
|
||||
return reason
|
||||
entry = queue.pop(index)
|
||||
queue.insert(0, {"id": current["id"], "n": current["left"]})
|
||||
player["action"] = {**{k: v for k, v in current.items() if k in ("resume", "resume_plot2")},
|
||||
"id": entry["id"], "start": now, "left": entry["n"]}
|
||||
return None
|
||||
|
||||
|
||||
def queue_set(player: dict, index: int, qty: int) -> str | None:
|
||||
if not 0 <= index < len(player["queue"]):
|
||||
return "Not in the queue"
|
||||
|
|
@ -6294,6 +6312,9 @@ ORDER_RECIPES, ORDER_RAW = _order_sources()
|
|||
# What changed, shown on the Patch notes page. Newest first; every shipped change adds a
|
||||
# line here (new / balance / fix), and a new release a new entry on top.
|
||||
PATCH_NOTES = [
|
||||
{"date": "2026-10-28", "title": "Queue", "notes": [
|
||||
("new", "Queue: ▲ on #1 swaps it with the current make."),
|
||||
]},
|
||||
{"date": "2026-10-27", "title": "Prayer", "notes": [
|
||||
("new", "Gathering can be queued."),
|
||||
("new", "Make X and queue counts go up to 9,999. Queue has no length cap."),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue