OnOvenTemperature
OnOvenTemperature is called from BaseOven.GetTemperature whenever the game needs the current cooking temperature of an oven instance. Returning a float replaces that temperature for the call.
object OnOvenTemperature(BaseOven oven, int slot)Parameters
| Parameter | Type | Description |
|---|---|---|
oven | BaseOven | The BaseOven whose temperature is being evaluated. It is the entity that owns the cooking inventory and the smelting state. |
slot | int | The inventory slot index passed to BaseOven.GetTemperature. Use it to make the override slot-specific; most plugins ignore the value and apply the same result to all slots. |
Return value
Return null (or any non-float value) to let the vanilla temperature logic run. Return a float to use that number as the oven's temperature for this call, skipping the rest of the method.
How it works
The hook fires inside BaseOven.GetTemperature(int slot) before the vanilla logic checks the On flag. That method is called while the oven processes its cooking slot, so the hook runs repeatedly for every lit oven with smeltable contents, not just once when it is turned on. The oven parameter is the entity being evaluated - cast it to BaseOven, or to a more specific subtype such as a campfire, furnace, BBQ, lantern or stone oven. Declaring the parameter as a narrower type makes Oxide skip the call for other ovens, which is the clean way to target one building type. The slot value is the inventory index under evaluation. Because the method returns a float, a returned float becomes the temperature the caller uses; anything else keeps vanilla behavior. This is a good place to raise or lower cooking speed per entity, apply a server-wide smelting multiplier, or disable cooking on a specific oven by returning a low value. Keep the body cheap and allocation free - it runs on a hot path for every active oven.
Example plugin: Boost smelting speed with a temperature multiplier
using System;
using Newtonsoft.Json;
using Oxide.Core;
namespace Oxide.Plugins
{
[Info("Oven Temperature Boost", "RustPluginGenerator", "1.0.0")]
[Description("Multiplies or overrides the temperature of every oven on the server.")]
public class OvenTemperatureBoost : RustPlugin
{
private const float BaseTemperature = 20f;
private PluginConfig config;
private class PluginConfig
{
[JsonProperty("Temperature multiplier")]
public float Multiplier = 2f;
[JsonProperty("Flat temperature bonus")]
public float Bonus = 0f;
[JsonProperty("Only affect ovens owned by players")]
public bool PlayerOwnedOnly = false;
}
protected override void LoadDefaultConfig() => config = new PluginConfig();
protected override void LoadConfig()
{
base.LoadConfig();
try
{
config = Config.ReadObject<PluginConfig>();
if (config == null) throw new Exception();
}
catch
{
PrintWarning("Configuration file is invalid, using defaults");
LoadDefaultConfig();
}
if (config.Multiplier < 0f) config.Multiplier = 0f;
SaveConfig();
}
protected override void SaveConfig() => Config.WriteObject(config);
private object OnOvenTemperature(BaseOven oven, int slot)
{
if (oven == null || oven.IsDestroyed) return null;
if (config.PlayerOwnedOnly && oven.OwnerID == 0UL) return null;
if (!oven.HasFlag(BaseEntity.Flags.On)) return null;
// Vanilla base temperature is fixed; scale it by config without recursion.
float result = (BaseTemperature * config.Multiplier) + config.Bonus;
if (result < 0f) result = 0f;
return result;
}
}
}The plugin scales the cooking temperature of every lit oven by a configurable multiplier and adds an optional flat bonus, so admins can speed up or slow down smelting server-wide. OnOvenTemperature receives the oven and slot, checks the oven is alive and flagged as on, and then returns a fixed baseline of 20 degrees scaled by the configured multiplier plus the bonus. Because the return value is a float, the game uses it directly and the vanilla check is skipped. The check for player ownership is optional and lets the change apply only to ovens placed by players. Configuration is loaded with defaults, validated, and saved on load; there are no timers or data files, so the plugin unloads cleanly.
Common use cases
Global smelting speed multiplier
Return a scaled baseline temperature so every furnace and campfire cooks faster without editing each entity's server-side data.
Disable specific ovens
Check
oven.OwnerIDoroven.buildingIDand return 0f to stop cooking on unauthorized or admin-placed test ovens without deleting them.Slow cooking at night
Compare
TOD_Sky.Instance.Cycle.Houror a stored toggle and return a lower temperature during darkness to create survival pressure.
Pitfalls
Do not recurse into GetTemperature
Calling
oven.GetTemperature(slot)from inside the hook re-enters the hook and can stack overflow or loop. Work from config values or cached state instead.Hot path, no logging
The hook fires continuously for each active oven slot. Never call
PutsorPrintWarninghere; cache any diagnostics at startup.Narrow parameter types
Declaring
BaseOvencatches campfires, furnaces, BBQs, lanterns and more. Use a subtype or checkoven.ShortPrefabNamewhen you only want one kind.
Build a plugin with OnOvenTemperature
Describe what should happen and get a compiled plugin that uses this hook.
Edit the prompt on the next screen. 2 free plugins a month, no card.
Last updated Oct 26, 2026. Found a mistake? Email support@rustplugingenerator.com.
Build a plugin with OnOvenTemperature
Generate