{"path": "scripts/core/bob_quest_check.gd", "sha256": "554e6baedc4627c2ca6c110e4788f4bd9fd675e833c1735edbd177d05e500fc8", "replacements": [{"old": "\tRegistry.run_hook(\"customer_profiles\", \"bob_guest\", \"on_served\")\n", "new": "\t_fixed_meal_wait(room, bob)\n\tRegistry.run_hook(\"customer_profiles\", \"bob_guest\", \"on_served\")\n", "count": 1}, {"old": "# --- 4. La planque ------------------------------------------------------------------\n", "new": "# Exercise the restaurant's real order, stock and cooking paths.\nfunc _fixed_meal_wait(room: Node, bob: Customer) -> void:\n\tvar stock := GameState.ingredients.duplicate()\n\tvar recipe_id := str(DataCatalog.CUSTOMER_PROFILES.bob_guest.fixed_recipe)\n\tvar requirements: Dictionary = DataCatalog.RECIPES[recipe_id].ingredients\n\tvar normal_order := bob.max_patience * float(GameState.resolve_game_variable(\"patience_coef_order\", 0.6))\n\tvar normal_meal := bob.max_patience * float(GameState.resolve_game_variable(\"patience_coef_service\", 1.0))\n\tGameState.ingredients.clear()\n\troom.customer_seated(bob)\n\tcheck(bob.service_phase == Customer.ServicePhase.THINKING and is_equal_approx(bob.patience, bob.thinking_seconds),\n\t\t\"a missing fixed meal shortens the customer's thinking time\")\n\troom.customer_finished_thinking(bob)\n\tcheck(bob.requested_recipe == recipe_id and is_equal_approx(bob.phase_allowed, normal_order * 0.25),\n\t\t\"Bob does not get a quarter of the ordering wait without his ingredients\")\n\tbob.take_order_by()\n\tcheck(is_equal_approx(bob.phase_allowed, normal_meal * 0.25),\n\t\t\"Bob does not get a quarter of the meal wait without his ingredients\")\n\tbob._process(1.0)\n\tvar spent := bob.phase_allowed - bob.patience\n\troom._release_unservable_waiting_customers()\n\troom._release_unservable_waiting_customers()\n\tcheck(is_equal_approx(bob.patience, normal_meal * 0.25 - spent),\n\t\t\"rechecking an unavailable meal restarts or repeatedly shortens the wait\")\n\tfor ingredient_id: String in requirements:\n\t\tGameState.ingredients[ingredient_id] = int(requirements[ingredient_id])\n\tvar missing := str(requirements.keys()[0])\n\tGameState.ingredients[missing] = int(requirements[missing]) - 1\n\troom._release_unservable_waiting_customers()\n\tcheck(is_equal_approx(bob.phase_allowed, normal_meal * 0.25),\n\t\t\"a partially stocked fixed meal gets the full wait\")\n\tGameState.ingredients[missing] = int(requirements[missing])\n\troom._release_unservable_waiting_customers()\n\tcheck(is_equal_approx(bob.phase_allowed, normal_meal) and is_equal_approx(bob.patience, normal_meal - spent),\n\t\t\"restocking does not restore the normal wait while preserving time spent\")\n\troom.start_cooking(recipe_id, 0)\n\tcheck(room.station_is_busy(0) and not GameState.can_cook(recipe_id), \"the fixed meal did not consume its last ingredients\")\n\troom._release_unservable_waiting_customers()\n\tcheck(is_equal_approx(bob.phase_allowed, normal_meal), \"a fixed meal in the oven shortens the wait\")\n\troom.stations[0].remaining = 0.0\n\troom._finish_dish(0)\n\troom.stations[0].recipe = \"\"\n\troom._release_unservable_waiting_customers()\n\tcheck(is_equal_approx(bob.phase_allowed, normal_meal), \"a cooked fixed meal shortens the wait\")\n\tfor node: Node in GameState.scoped_nodes(room, \"dish\"):\n\t\tif node is Dish and node.recipe_id == recipe_id:\n\t\t\tnode.free()\n\troom._release_unservable_waiting_customers()\n\tcheck(is_equal_approx(bob.phase_allowed, normal_meal * 0.25) and is_equal_approx(bob.patience, normal_meal * 0.25 - spent),\n\t\t\"losing the final portion does not shorten the wait without resetting it\")\n\tbob._process(bob.patience / bob._patience_drain() + 0.01)\n\tcheck(bob.state == Customer.State.LEAVING, \"Bob stays at the restaurant after the shortened wait expires\")\n\tGameState.ingredients = stock\n\n# --- 4. La planque ------------------------------------------------------------------\n", "count": 1}]}