{"path": "scripts/restaurant/restaurant.gd", "sha256": "0e0b34904679377817cbb39eb56b872c17172cae53bedb8eb22b7a8c9b5edc39", "replacements": [{"old": "const DISH_SCENE := preload(\"res://scenes/restaurant/dish.tscn\")\n", "new": "const DISH_SCENE := preload(\"res://scenes/restaurant/dish.tscn\")\nconst QuestDishPrompt := preload(\"res://scripts/core/confirm_prompt.gd\")\n", "count": 1}, {"old": "var takeout_cook: Employee\n", "new": "# Keep each finished portion separate and discard consumed portions safely.\nvar _quest_dishes_to_offer: Array[WeakRef] = []\nvar _quest_dish_prompt: CanvasLayer\nvar takeout_cook: Employee\n", "count": 1}, {"old": "\tcancel_guard = maxf(0.0, cancel_guard - delta)\n", "new": "\t_offer_next_quest_dish()\n\tif get_tree().paused:\n\t\treturn\n\tcancel_guard = maxf(0.0, cancel_guard - delta)\n", "count": 1}, {"old": "\tGameState.toast_from(self, Loc.ui(\"ui.restaurant.dish_ready\") % DataCatalog.recipe_name(recipe_id))\n", "new": "\tGameState.toast_from(self, Loc.ui(\"ui.restaurant.dish_ready\") % DataCatalog.recipe_name(recipe_id))\n\tif not _quest_dish_to_offer(dish).is_empty():\n\t\t_quest_dishes_to_offer.append(weakref(dish))\n\t\t_offer_next_quest_dish.call_deferred()\n", "count": 1}, {"old": "func _set_aside_held_dish() -> void:\n\tvar dish := player.held_dish as Dish\n\tif dish == null or dish.state != Dish.State.FILLED:\n", "new": "func _set_aside_held_dish() -> void:\n\t_set_aside_dish(player.held_dish as Dish)\n\n# The console and the cooking question share the same conversion.\nfunc _set_aside_dish(dish: Dish) -> void:\n\tif not is_instance_valid(dish) or dish.is_queued_for_deletion() or dish.state != Dish.State.FILLED:\n", "count": 1}, {"old": "func _wash_held_plate() -> void:\n", "new": "func _quest_dish_to_offer(dish: Dish) -> String:\n\tif not is_instance_valid(dish) or dish.is_queued_for_deletion() or dish.state != Dish.State.FILLED:\n\t\treturn \"\"\n\tvar quest := GameState.quest_wanting_dish(dish.recipe_id)\n\tif quest.is_empty() or _quest_giver_is_present(quest):\n\t\treturn \"\"\n\treturn quest\n\nfunc _quest_giver_is_present(quest: String) -> bool:\n\tvar giver := str(DataCatalog.QUESTS[quest].get(\"giver\", \"\"))\n\tif giver.is_empty():\n\t\treturn false\n\tfor profile_id: String in DataCatalog.CUSTOMER_PROFILES:\n\t\tif str(DataCatalog.CUSTOMER_PROFILES[profile_id].get(\"character\", \"\")) == giver \\\n\t\t\t\tand customers_present_of(profile_id) > 0:\n\t\t\treturn true\n\treturn false\n\nfunc _offer_next_quest_dish() -> void:\n\tif _quest_dishes_to_offer.is_empty() or is_instance_valid(_quest_dish_prompt) \\\n\t\t\tor not is_inside_tree() or is_queued_for_deletion() or transitioning \\\n\t\t\tor GameState.is_offstage(self) or get_tree().paused or recipe_menu.visible:\n\t\treturn\n\twhile not _quest_dishes_to_offer.is_empty():\n\t\tvar portion: WeakRef = _quest_dishes_to_offer.pop_front()\n\t\tvar dish := portion.get_ref() as Dish\n\t\tvar quest := _quest_dish_to_offer(dish)\n\t\tif quest.is_empty():\n\t\t\tcontinue\n\t\tvar giver := str(DataCatalog.QUESTS[quest].get(\"giver\", \"\"))\n\t\tvar recipient := Loc.entity(\"characters\", giver, \"display_name\") if not giver.is_empty() \\\n\t\t\telse Loc.entity(\"quests\", quest, \"display_name\")\n\t\tvar prompt := QuestDishPrompt.new()\n\t\tprompt.question = Loc.ui(\"ui.prompt.set_aside\") % recipient\n\t\tprompt.confirm_text = Loc.ui(\"ui.common.confirm\")\n\t\tprompt.cancel_text = Loc.ui(\"ui.common.cancel\")\n\t\t_quest_dish_prompt = prompt\n\t\tprompt.answered.connect(func(confirmed: bool) -> void:\n\t\t\t_quest_dish_prompt = null\n\t\t\tif confirmed and _quest_dish_to_offer(dish) == quest:\n\t\t\t\t_set_aside_dish(dish))\n\t\tadd_child(prompt)\n\t\treturn\n\nfunc _wash_held_plate() -> void:\n", "count": 1}]}