void OnConsumeFuel(BaseOven oven, Item fuel, ItemModBurnable burnable) { BaseEntity slot = oven.GetSlot(BaseEntity.Slot.FireMod); if (slot != null) { //Usually 0.5f for cook tick, fuel is only consumed twice per second slot.SendMessage("Cook", 2f * Settings.SmeltSpeed * Settings.WaterPurifierMultiplier, SendMessageOptions.DontRequireReceiver); } if (oven == null || oven is BaseFuelLightSource) { return; } // Check if permissions are enabled and player has permission if (Settings.UsePermissions && !permission.UserHasPermission(oven.OwnerID.ToString(), permAllow)) { return; } var data = oven.transform.GetOrAddComponent <FurnaceData>(); #region Charcoal Modifier if (burnable.byproductItem != null) { oven.allowByproductCreation = false; int charcoalAmount = 0; float modifiedRate = Settings.CharcoalRate * Settings.WoodRate; charcoalAmount += (int)(Settings.CharcoalRate * Settings.WoodRate); modifiedRate -= charcoalAmount; if (modifiedRate > 0 && modifiedRate <= 1f) { if (UnityEngine.Random.Range(0f, 1f) < modifiedRate) { charcoalAmount += 1; } } if (charcoalAmount > 0) { TryAddItem(oven.inventory, burnable.byproductItem, Mathf.Min(charcoalAmount, fuel.amount)); } } #endregion // Modify the amount of fuel to use fuel.UseItem(Settings.WoodRate - 1); }