Track a recipe under the top bar

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-20 21:13:46 +01:00
parent 722cf0b382
commit a86594594a
5 changed files with 67 additions and 6 deletions

15
game.py
View file

@ -1090,7 +1090,7 @@ RAID_TRAITS = ["lightly armoured, heavy on archers", "mounted and fast, few bows
# --- world ---------------------------------------------------------------
WORLD_VERSION = 21
WORLD_VERSION = 22
def new_world(now: float, speed: float = 1.0) -> dict:
@ -1253,6 +1253,10 @@ def migrate(world: dict, now: float | None = None) -> dict:
for slot in EQUIP_SLOTS:
player["equip"].setdefault(slot, None)
world["version"] = 21
if world["version"] < 22:
for player in world["players"].values():
player.setdefault("tracked", None)
world["version"] = 22
return world
@ -1513,6 +1517,7 @@ def new_player(uid: str, name: str, cls: str, now: float) -> dict:
"garrison": False,
"donated": 0,
"pinned": [], # skills pinned to the top of the sidebar
"tracked": None, # recipe shown under the top bar
}
@ -3962,6 +3967,14 @@ def toggle_pin(player: dict, skill: str) -> str | None:
return None
def toggle_track(player: dict, action_id: str) -> str | None:
action = ACTION_BY_ID.get(action_id)
if not action or not action["inputs"]:
return "No such recipe"
player["tracked"] = None if player["tracked"] == action_id else action_id
return None
# --- icons ------------------------------------------------------------------------
# Every item, skill, class, building, prayer and output-less action gets a
# game-icons.net glyph (CC BY 3.0) and a tint. Families share a shape and are