Skip to main content

CookingPot

A class in Root.Township, Alta.Cooking.

The cooking pot: tracks ingredients and garnishes dropped in, and moves through the stages Preparation, WarmingUp, Stewing and StewLocked as liquid is added and heats up. The server runs it; the StewManager on the same object makes the stew.

Constructors​

MemberWhat it is
CookingPot()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

12 private and internal fields
MemberWhat it is
private AltaCoroutine checkingForConversionTemperatureThe running temperature check coroutine.
private HashSet<ICookingGarnishMarker> containedGarnishesSet for garnishes in the pot. Not used in this file.
private HashSet<Cookable> convertedCookabledIngredients already added to the stew, so they aren't added twice.
private CookingLiquid cookingLiquidBacking field for CookingLiquid.
private CookingPot.CookingStage currentStageThe pot's cooking stage. Saved, but Load copies the field into the save data instead of back, so it is probably never restored.
private static Logger loggerNLog logger for this class.
private PotDefinition potDefinitionBacking field for Definition.
private HeatArea potHeatAreaThe heat area that heats the liquid and stew.
private CookingPotVolume potVolumeTrigger volume that reports objects entering and leaving the pot.
private CookableEvent rejectedIngredientEvent fired with an ingredient the locked pot pushed out.
private UnityEvent startedStewingEvent fired when the pot starts stewing.
private StewManager stewManagerThe stew manager on the same object.

Properties​

MemberWhat it is
HashSet<Cookable> ContainedCookables { get; }The plain cookable ingredients currently in the pot.
CookingLiquid CookingLiquid { get; }The pot's liquid, which holds the water or stew.
PotDefinition Definition { get; }The pot's settings, such as how many ingredients a stew needs and how many garnishes it takes.

Methods​

MemberWhat it is
override void InitializeAsServer(SpawnData spawnData)Server: hooks the pot volume and liquid events, and starts warming up if liquid is already in.
void RegisterStewToHeatArea(StewComponent stew)Adds the stew's cooking point to the pot's heat area so the stew keeps cooking.
void StartStewLockedStage()Locks the stew so no more ingredients are taken, and stops the temperature check. Called by StewManager.
25 private and internal methods
MemberWhat it is
private IEnumerator CheckForConversionTemperature() (iterator)Coroutine that, while the liquid is hot enough, adds each hot, untouched ingredient in the pot to the stew. Runs until the stew locks.
private void DisableNormalCookingOnIngredients(IEnumerable<Cookable> ingredients)Puts ingredients into simple cooking mode while they are in the stewing pot.
private void GarnishAdded(ICookingGarnishMarker garnish)Adds a garnish to the stew, but only while stewing or locked.
private void HandleAnyIngredientsInPotThatHaventCalledEvents()On load, registers ingredients already inside the pot volume.
private void HandleExistingGarnishes()When stewing starts, adds garnishes that were already in the pot.
private void HandleExistingIngredientForStewing()Switches current ingredients to simple cooking and starts the temperature check.
private void HandleIngredientAddedWhenLocked(Cookable newIngredient)Rejects an ingredient added after the stew is locked.
private void HandleNewIngredient(Cookable newIngredient)While stewing, prepares a new ingredient and restarts the temperature check if needed; when locked, rejects it.
private void IngredientAdded(Cookable cookableIngredient)Tracks a new cookable ingredient and handles it for the current stage.
private void IngredientRemoved(Cookable cookableIngredient)Stops tracking an ingredient and turns its normal cooking back on.
private bool IsCookable(Item item)True if the item has a CookableItem component of exactly that type (not a subclass).
private void ItemAddedToPot(GameObject obj)Pot volume handler: sorts a new object into garnish or ingredient.
private void ItemRemovedFromPot(GameObject obj)Pot volume handler: removes a cookable ingredient that left the pot.
private void LoadAtCurrentStage()After a load, re-runs the stage setup up to currentStage and finds the child stew.
private void Alta.Chunks.ISavableFull.LoadSetup()Registers ingredients already in the pot, then restores the current stage.
private void RejectIngredient(Cookable newIngredient)Pushes the ingredient out with a force from CookingSettings and fires rejectedIngredient.
private void ResetCookableIngredient(Cookable cookableIngredient)Turns normal cooking back on for an ingredient.
private void SetStewOnStewManager()Finds the stew entity under the pot and hands it to the stew manager. Used when loading.
private void StartCheckingForConversionTemperature()Restarts the CheckForConversionTemperature coroutine.
private void StartStewing()On the first ingredient converted while warming up, moves to Stewing, creates the default stew and adds existing garnishes.
private void StartStewingStage()Sets the stage to Stewing, makes the liquid refuse more liquid and fires startedStewing.
private void StartWarmingUp()Starts warming up when liquid is added during Preparation.
private void StartWarmingUpStage(bool isSettingLiquidOfStewManager)Sets the stage to WarmingUp, heats the liquid in the pot's heat area and optionally sets the stew's base liquid.
private void StewEmptied()Resets the pot to Preparation when the stew or liquid is emptied, and removes the stew.
private void WaterAddedToPot()Liquid handler that starts warming up.

Used in​

Members of other types that take, return or hold a CookingPot: