Townsfolk: food variety icons, plain labels

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-28 11:28:29 +00:00
parent a8a3a45846
commit b385012c45
3 changed files with 16 additions and 4 deletions

View file

@ -4388,15 +4388,16 @@ def happiness(world: dict, now: float) -> dict:
supply = min(1.0, meals / want_meals)
variety = min(1.0, kinds / FOOD_KINDS)
needs = {"food": {"score": 0.0 if city["starving"] else 0.5 * supply + 0.5 * variety, "rows": [
{"item": "bread", "label": "Food (any)", "have": int(meals), "want": want_meals, "any": "food"},
{"item": "stew", "label": "Kinds of food", "have": kinds, "want": FOOD_KINDS, "kinds": True},
{"item": "bread", "label": "Food", "have": int(meals), "want": want_meals, "any": "food"},
{"item": "stew", "label": "Food variety", "have": kinds, "want": FOOD_KINDS, "kinds": True,
"day": math.ceil(day), "foods": {item: int(_meals(stock, item)) for item in FOOD_ORDER}},
]}}
season_now = season(world, now)["index"]
burn = 24 * sum(hearth_burn(world, now))
fuel = sum(stock.get(item, 0) for item in FUEL)
want_fuel = math.ceil(FUEL_DAYS * burn)
needs["warmth"] = {"score": 0.0 if city.get("unheated") else min(1.0, fuel / want_fuel) if want_fuel else 1.0,
"rows": [{"item": "kindling", "label": "Firewood (any)", "have": fuel, "want": want_fuel,
"rows": [{"item": "kindling", "label": "Firewood", "have": fuel, "want": want_fuel,
"any": "fuel"}]}
garment, later = SEASON_CLOTHES[season_now], SEASON_CLOTHES[(season_now + 1) % 4]
rows = [{"item": garment, "label": ITEMS[garment]["plural"], "have": stock.get(garment, 0), "want": math.ceil(pop)}]