public static void Execute() { Panel_Cooking panel_Cooking = InterfaceManager.m_Panel_Cooking; GearItem cookedItem = panel_Cooking.GetSelectedFood(); CookingPotItem cookingPotItem = panel_Cooking.m_CookingPotInteractedWith; GearItem result = cookedItem.Drop(1, false, true); CookingModifier cookingModifier = ComponentUtils.GetOrCreateComponent <CookingModifier>(result); cookingModifier.additionalMinutes = result.m_Cookable.m_PotableWaterRequiredLiters * panel_Cooking.m_MinutesToMeltSnowPerLiter; cookingModifier.Apply(); GameAudioManager.Play3DSound(result.m_Cookable.m_PutInPotAudio, cookingPotItem.gameObject); cookingPotItem.StartCooking(result); panel_Cooking.ExitCookingInterface(); }
void Update() { if (fire.GetFireState() == FireState.Off) { "AutoCook.Update: fire isn't lit, aborting".logDbg(); Destroy(this); return; } CookingPotItem pot = null; if (gearPlacePoint.m_PlacedGear) { if (!gearPlacePoint.m_PlacedGear.name.Contains("CookingPot")) // GEAR_CookingPot or GEAR_CookingPotDummy { "AutoCook.Update: gear in place point isn't a cooking pot, aborting".logDbg(); Destroy(this); return; } pot = gearPlacePoint.m_PlacedGear.GetComponent <CookingPotItem>(); if (pot.m_LitersSnowBeingMelted > 0f || pot.m_LitersWaterBeingBoiled > 0f) // if we started with water in pot { if (pot.m_CookingState == CookingPotItem.CookingState.Cooking || pot.m_LitersWaterBeingBoiled == 0f) { return; } "AutoCook.Update: picking up boiled water".logDbg(); pot.PickUpCookedItem(); } if (pot.m_GearItemBeingCooked) { if (pot.GetCookingState() == CookingPotItem.CookingState.Cooking) { return; } $"AutoCook.Update: picking up cooked item {pot.m_GearItemBeingCooked.name}".logDbg(); pot.PickUpCookedItem(); } } var item = getRawFood(!cookMeatToo); if (!item) { return; } $"AutoCook.Update: start cooking {item.name}".logDbg(); item.m_Cookable.m_DoNotCookWhenDropped = true; if (pot) { pot.StartCooking(item); } else { gearPlacePoint.DropAndPlaceItem(item); } item.m_Cookable.m_DoNotCookWhenDropped = false; }