Work orders keep the crafting queue
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
97ef606bbf
commit
70be493558
4 changed files with 52 additions and 13 deletions
38
game.py
38
game.py
|
|
@ -3253,7 +3253,8 @@ def process_player(world: dict, player: dict, now: float, rng: random.Random | N
|
|||
burn_fires(world, current["start"] + duration)
|
||||
reason = can_start(world, player, action)
|
||||
if reason:
|
||||
if next_queued(world, player, current["start"], summary, skipped=current):
|
||||
if next_queued(world, player, current["start"], summary, skipped=current) or \
|
||||
"order" in current and finish_once(world, player, current["start"], reason, summary):
|
||||
current = player["action"]
|
||||
continue
|
||||
stop(player, reason)
|
||||
|
|
@ -3277,7 +3278,8 @@ def process_player(world: dict, player: dict, now: float, rng: random.Random | N
|
|||
# Out of materials: stop now, not once the next bar has filled.
|
||||
reason = can_start(world, player, growing(player))
|
||||
if reason:
|
||||
if next_queued(world, player, current["start"], summary, skipped=current):
|
||||
if next_queued(world, player, current["start"], summary, skipped=current) or \
|
||||
"order" in current and finish_once(world, player, current["start"], reason, summary):
|
||||
current = player["action"]
|
||||
continue
|
||||
stop(player, reason)
|
||||
|
|
@ -3322,7 +3324,7 @@ def queue_add(world: dict, player: dict, action_id: str, qty: int, now: float) -
|
|||
reason = queue_reason(world, player, action)
|
||||
if reason:
|
||||
return reason
|
||||
if not (player["action"] and "left" in player["action"]):
|
||||
if not (player["action"] and ("left" in player["action"] or "order" in player["action"])):
|
||||
return start_action(world, player, action_id, now, once=qty)
|
||||
player["queue"].append({"id": action_id, "n": qty})
|
||||
return None
|
||||
|
|
@ -3985,16 +3987,10 @@ def remove_orders(world: dict, player: dict, order_id=None) -> str | None:
|
|||
return None
|
||||
|
||||
|
||||
def claim_order(world: dict, player: dict, order_id, claim: bool = True) -> str | None:
|
||||
def claim_order(world: dict, player: dict, order_id) -> str | None:
|
||||
order = order_by_id(world, order_id)
|
||||
if not order or order["status"] != "open" or order["kind"] != "craft":
|
||||
return "No such order"
|
||||
if not claim:
|
||||
if order["claimed"] == player["id"]:
|
||||
order["claimed"] = None
|
||||
if (player["action"] or {}).get("order") == order["id"]:
|
||||
stop(player)
|
||||
return None
|
||||
if order["by"] == player["id"]:
|
||||
return "That's your own order"
|
||||
if order["claimed"] not in (None, player["id"]):
|
||||
|
|
@ -4005,8 +4001,21 @@ def claim_order(world: dict, player: dict, order_id, claim: bool = True) -> str
|
|||
return None
|
||||
|
||||
|
||||
def drop_order(world: dict, player: dict, order_id, now: float) -> str | None:
|
||||
"""Let go of an order you'd claimed. If you were crafting it: on with the queue, or back to what you were doing."""
|
||||
order = order_by_id(world, order_id)
|
||||
if not order or order["status"] != "open" or order["kind"] != "craft":
|
||||
return "No such order"
|
||||
if order["claimed"] == player["id"]:
|
||||
order["claimed"] = None
|
||||
if (player["action"] or {}).get("order") == order["id"]:
|
||||
finish_once(world, player, now)
|
||||
return None
|
||||
|
||||
|
||||
def work_order(world: dict, player: dict, order_id, now: float) -> str | None:
|
||||
"""Claim a crafting order and start making it."""
|
||||
"""Claim a crafting order and start making it. A make that was running goes back to the
|
||||
front of the queue with what it had left; anything else is what comes after."""
|
||||
order = order_by_id(world, order_id)
|
||||
had = order and order["claimed"] == player["id"]
|
||||
error = claim_order(world, player, order_id)
|
||||
|
|
@ -4022,6 +4031,12 @@ def work_order(world: dict, player: dict, order_id, now: float) -> str | None:
|
|||
return reason
|
||||
if previous and previous.get("party") in world["parties"]:
|
||||
leave_party(world, player, previous["party"], now)
|
||||
if previous and "order" not in previous:
|
||||
if "left" in previous and queueable(ACTION_BY_ID[previous["id"]]):
|
||||
player["queue"].insert(0, {"id": previous["id"], "n": previous["left"]})
|
||||
elif "left" not in previous:
|
||||
previous = {"resume": previous["id"], "resume_plot2": previous.get("plot2")}
|
||||
player["action"].update({k: v for k, v in (previous or {}).items() if k in ("resume", "resume_plot2") and v})
|
||||
player["stopped"] = None
|
||||
return None
|
||||
|
||||
|
|
@ -6576,6 +6591,7 @@ ORDER_RECIPES, ORDER_RAW = _order_sources()
|
|||
# line here (new / balance / fix), and a new release a new entry on top.
|
||||
PATCH_NOTES = [
|
||||
{"date": "2026-10-28", "title": "Queue", "notes": [
|
||||
("new", "Work orders no longer erase your crafting queue"),
|
||||
("new", "Items link to where they're made: click to jump to the recipe."),
|
||||
("new", "Queue: ▲ on #1 swaps it with the current make."),
|
||||
("new", "Updated Guard kit, added recipes for crafting professions to contribute to defence of town without needing combat-related loot."),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue