{"path": "scripts/core/quests_check.gd", "sha256": "5c7c4446139b6fbdde7ed95824e26c4bef6fd426a6ce8711c1126f7cd54aae4b", "replacements": [{"old": "\t# Le journal de la console.\n", "new": "\tawait _cooked_dish_questions(room)\n\n\t# Le journal de la console.\n", "count": 1}, {"old": "func _finish() -> void:\n", "new": "# Finish through the real stove update while the player tends the station.\nfunc _cook_question_meal(room: Node, recipe_id: String = MEAL) -> Dish:\n\tfor ingredient_id: String in DataCatalog.RECIPES[recipe_id].ingredients:\n\t\tGameState.add_ingredient(ingredient_id, int(DataCatalog.RECIPES[recipe_id].ingredients[ingredient_id]))\n\troom.start_cooking(recipe_id, 0)\n\tcheck(room.station_is_busy(0), \"the question's meal did not start cooking\")\n\troom.stations[0].remaining = 0.01\n\troom.player.controls_enabled = true\n\troom.player.global_position = room.cooking_station.default_stand_position()\n\troom.player.refresh_target()\n\tInput.action_press(\"action\")\n\troom._process(0.1)\n\tInput.action_release(\"action\")\n\tawait _frames(2)\n\tcheck(not room.station_is_busy(0), \"tending the stove did not finish the meal\")\n\tfor node: Node in GameState.scoped_nodes(room, \"dish\"):\n\t\tif node is Dish and node.recipe_id == recipe_id and node.state == Dish.State.FILLED and not node.is_queued_for_deletion():\n\t\t\treturn node as Dish\n\tcheck(false, \"the finished meal is missing\")\n\treturn null\n\nfunc _cooked_dish_questions(room: Node) -> void:\n\tGameState.set_key_item_amount(TOKEN, 0)\n\tvar dish := await _cook_question_meal(room, OTHER)\n\tcheck(room.get_node_or_null(\"ConfirmPrompt\") == null and not get_tree().paused, \"an unrelated meal opens a quest question\")\n\tif is_instance_valid(dish):\n\t\tdish.free()\n\tGameState.set_quest_value(QUEST, \"state\", 2)\n\tdish = await _cook_question_meal(room)\n\tcheck(room.get_node_or_null(\"ConfirmPrompt\") == null, \"a completed quest opens a meal question\")\n\tif is_instance_valid(dish):\n\t\tdish.free()\n\tGameState.set_quest_value(QUEST, \"state\", 1)\n\tGameState.set_key_item_amount(TOKEN, 1)\n\tdish = await _cook_question_meal(room)\n\tcheck(room.get_node_or_null(\"ConfirmPrompt\") == null, \"a full quest bag opens a meal question\")\n\tif is_instance_valid(dish):\n\t\tdish.free()\n\tGameState.set_key_item_amount(TOKEN, 0)\n\t# No giver configured: name the quest, and let the player decline.\n\tdish = await _cook_question_meal(room)\n\tvar prompt := room.get_node_or_null(\"ConfirmPrompt\")\n\tcheck(prompt != null and get_tree().paused, \"finishing a wanted dish opens no question\")\n\tif prompt == null:\n\t\tif is_instance_valid(dish):\n\t\t\tdish.free()\n\t\treturn\n\tcheck(prompt.question == Loc.ui(\"ui.prompt.set_aside\") % \"Probe errand\", \"the meal question does not name its quest\")\n\tprompt.cancel_button.pressed.emit()\n\tawait _frames(3)\n\tcheck(not get_tree().paused and is_instance_valid(dish) and dish.state == Dish.State.FILLED and GameState.key_item_amount(TOKEN) == 0,\n\t\t\"declining consumes the plate, gives an item, or leaves the game paused\")\n\tcheck(room.get_node_or_null(\"ConfirmPrompt\") == null, \"a declined portion immediately asks again\")\n\tdish.free()\n\t# A different giver's presence blocks the prompt, including while leaving.\n\tDataCatalog.QUESTS[QUEST].giver = VIP_CHARACTER\n\tvar giver: Customer = CustomerScene.instantiate()\n\troom.add_child(giver)\n\tgiver.setup(VIP, room, -1, -1, Vector2.ZERO, room.entrance_point())\n\troom.customers.append(giver)\n\tgiver.state = Customer.State.LEAVING\n\tdish = await _cook_question_meal(room)\n\tcheck(room.get_node_or_null(\"ConfirmPrompt\") == null and not get_tree().paused,\n\t\t\"a giver still at the restaurant opens a take-away question\")\n\tif is_instance_valid(dish):\n\t\tdish.free()\n\troom.customers.erase(giver)\n\tgiver.free()\n\tdish = await _cook_question_meal(room)\n\tprompt = room.get_node_or_null(\"ConfirmPrompt\")\n\tcheck(prompt != null and get_tree().paused, \"an absent giver opens no meal question\")\n\tif prompt != null:\n\t\tcheck(prompt.question == Loc.ui(\"ui.prompt.set_aside\") % \"Madame Probe\", \"the meal question does not name its giver\")\n\t\tprompt.confirm_button.pressed.emit()\n\t\tprompt.confirm_button.pressed.emit()\n\t\tawait _frames(2)\n\t\tcheck(GameState.key_item_amount(TOKEN) == 1 and not is_instance_valid(dish) and not get_tree().paused,\n\t\t\t\"confirming does not put exactly one meal in the bag and release the plate\")\n\t# Cooking offstage must not interrupt the current scene; offer on return.\n\tGameState.set_key_item_amount(TOKEN, 0)\n\tGameState.park_restaurant(room)\n\tdish = await _cook_question_meal(room)\n\tcheck(room.get_node_or_null(\"ConfirmPrompt\") == null and not get_tree().paused, \"offstage cooking pauses the active scene\")\n\tGameState.restore_offstage_restaurant()\n\troom._process(0.0)\n\tawait _frames(2)\n\tprompt = room.get_node_or_null(\"ConfirmPrompt\")\n\tcheck(prompt != null, \"a still-ready quest portion is not offered on return\")\n\tif prompt != null:\n\t\tprompt.confirm_button.pressed.emit()\n\t\tawait _frames(2)\n\tcheck(GameState.key_item_amount(TOKEN) == 1 and not get_tree().paused, \"the returned meal did not enter the quest bag\")\n\tDataCatalog.QUESTS[QUEST].giver = \"\"\n\nfunc _finish() -> void:\n", "count": 1}]}