private Item OnFindBurnable(BaseOven oven) { if (oven.fuelType == null) { return(null); } if (!activeShortNames.Contains(oven.ShortPrefabName)) { return(null); } if (HasFuel(oven)) { return(null); } DecayEntity decayEnt = oven.GetComponent <DecayEntity>(); if (decayEnt == null) { return(null); } AutomaticRefuel refuel = decayEnt.GetComponent <AutomaticRefuel>(); if (!refuel) { decayEnt.gameObject.AddComponent <AutomaticRefuel>(); } if (refuel.cupboard == null) { refuel.SearchForCupboard(); if (refuel.cupboard == null) { return(null); } } if (dontRequireFuel) { return(ItemManager.CreateByName(oven.fuelType.shortname, 1)); } Item fuelItem = refuel.GetFuel(); if (fuelItem == null) { return(null); } RemoveItemThink(fuelItem); ItemManager.CreateByName(oven.fuelType.shortname, 1)?.MoveToContainer(oven.inventory); return(null); }
private IEnumerator FindOvens() { BaseOven[] ovens = UnityEngine.Object.FindObjectsOfType <BaseOven>(); foreach (BaseOven oven in ovens) { yield return(new WaitForSeconds(0.05f)); if (oven.fuelType == null) { continue; } if (!activeShortNames.Contains(oven.ShortPrefabName)) { continue; } AutomaticRefuel refuel = oven.GetComponent <AutomaticRefuel>(); if (!refuel) { oven.gameObject.AddComponent <AutomaticRefuel>(); } } }