Remove finished work orders
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
be478f3b2e
commit
6883b707ad
4 changed files with 28 additions and 2 deletions
10
game.py
10
game.py
|
|
@ -2285,6 +2285,16 @@ def cancel_order(world: dict, player: dict, order_id, now: float) -> str | None:
|
|||
return None
|
||||
|
||||
|
||||
def remove_orders(world: dict, player: dict, order_id=None) -> str | None:
|
||||
"""Clear your finished orders: one, or all of them. Ones still holding items for your bank stay."""
|
||||
gone = [o for o in world["orders"] if o["by"] == player["id"] and o["status"] != "open" and not o["held"]
|
||||
and order_id in (None, o["id"])]
|
||||
if not gone:
|
||||
return "No such order"
|
||||
world["orders"] = [o for o in world["orders"] if o not in gone]
|
||||
return None
|
||||
|
||||
|
||||
def claim_order(world: dict, player: dict, order_id, claim: bool = True) -> str | None:
|
||||
order = order_by_id(world, order_id)
|
||||
if not order or order["status"] != "open" or order["kind"] != "craft":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue