recipe_tracker 
A recipe tracker is an abstract representation of the progress that a cooking container has made towards any of its possible recipe outcomes.
When items are added/steps are performed on a cooking container, the tracker is responsible for determining what known recipes are possible after the step occurs, and tracking whether or not the step was successful. Once a step has been performed that ends a recipe and is successful, the tracker coordinates with the winning recipe to create the result, using what it knows about the steps performed to choose the quality and other attributes of the output.
Vars | |
| container_uid | The parent object holding the recipe tracker. |
|---|---|
| recipe_started | Tells if steps have been taken for this recipe. |
| recipes_all_applied_steps | A list of recipe types to list of step indices we know we've performed. Ensures we don't perform e.g. optional steps we skipped on completion. |
| recipes_applied_step_data | A list of recipe types to metadata returned from completing its steps. This may include things like a custom message shown to the player, or the UID of relevant items used for determining quality at recipe completion. |
| recipes_last_completed_step | A list of recipe types to the index of the latest step we know we've gotten to. |
Procs | |
| process_item | Core function that checks if a object meets all the requirements for certain recipe actions. |
| process_item_wrap | Wrapper function for analyzing process_item internally. |
Var Details
container_uid 
The parent object holding the recipe tracker.
recipe_started 
Tells if steps have been taken for this recipe.
recipes_all_applied_steps 
A list of recipe types to list of step indices we know we've performed. Ensures we don't perform e.g. optional steps we skipped on completion.
recipes_applied_step_data 
A list of recipe types to metadata returned from completing its steps. This may include things like a custom message shown to the player, or the UID of relevant items used for determining quality at recipe completion.
recipes_last_completed_step 
A list of recipe types to the index of the latest step we know we've gotten to.
Proc Details
process_item
Core function that checks if a object meets all the requirements for certain recipe actions.
This is one of the thornier and grosser parts of the cooking system and most people working with it or implementing recipes should never have to look at this. The core idea is:
- we keep track of what recipes are still valid outcomes by testing the used item against the list of recipes which are valid so far.
- each valid recipe is at a certain step, and check the used object against /datum/cooking/recipe_step/proc/check_conditions_met. if we meet the conditions, we track the recipe and the step.
- for each unique step type that we're tracking, call /datum/cooking/recipe_step/proc/follow_step on the first instance of that step type, then /datum/cooking/recipe_step/proc/is_complete on all recipe step instances of that type, to see if we advance their respective recipes.
Once a recipe reaches its final step, the tracker completes the recipe and typically stops existing at that point.
process_item_wrap
Wrapper function for analyzing process_item internally.