OnFuelConsumed
OnFuelConsumed is called by BaseOven.ConsumeFuel right after a furnace-style entity burns one tick of fuel, giving you the consumed item and its burnable definition.
void OnFuelConsumed(BaseOven oven, Item fuel, ItemModBurnable burnable)Parameters
| Parameter | Type | Description |
|---|---|---|
oven | BaseOven | The BaseOven instance that consumed fuel. Covers furnaces, campfires, and other BaseOven-derived deployables; use it to read position, OwnerID, or cast to a subtype such as BaseOven for state checks. |
fuel | Item | The exact Item that was just consumed. Its amount has already been reduced by the fuel rate, so read info.shortname, skin, or position rather than assuming a full stack. |
burnable | ItemModBurnable | The ItemModBurnable component behind the fuel item, carrying the per-unit burn time in fuelAmount. Useful when you need to know how much burn time one unit of this fuel provides. |
Return value
The return value is ignored. BaseOven.ConsumeFuel is a void method and Oxide calls the hook in continue mode here, so returning null, true, or any other value has no effect on fuel consumption or burn logic. Modifying the item or oven inside the hook is the only way to influence state.
How it works
The hook fires inside BaseOven.ConsumeFuel immediately after the game reduces the fuel item by the oven's fuel rate and before the smelting analytics entry is written. It only triggers when an oven actually has valid fuel to burn, so it does not fire for empty or disabled ovens. Because the call happens after UseItem, the fuel item you receive reflects the post-consumption state; do not rely on it still matching the pre-burn stack.
The oven parameter covers every deployable that derives from BaseOven: furnaces, campfires, and similar cooking or smelting entities. Declaring a more specific parameter type such as BaseOven does not narrow further since that is already the signature type, but you can still inspect oven.ShortPrefabName, OwnerID, and transform.position to distinguish types. Keep the handler cheap: on a busy server with dozens of lit furnaces this hook fires every fuel tick per oven, so avoid allocations, logging, and entity lookups. Accumulate counters and flush them on a timer instead.
Example plugin: Track furnace fuel usage per player
using System.Linq;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("Fuel Usage Tracker", "RustPluginGenerator", "1.0.0")]
[Description("Counts fuel units burned by each player's ovens and reports totals via chat")]
public class FuelUsageTracker : RustPlugin
{
private const string PermStats = "fuelusagetracker.stats";
private const string DataFile = "FuelUsageTracker/stats";
private PluginConfig config;
private StoredData data;
private Timer saveTimer;
private class PluginConfig
{
[JsonProperty("Save interval (seconds)")]
public float SaveInterval { get; set; } = 120f;
}
private class StoredData
{
[JsonProperty("Per player fuel units")]
public Dictionary<string, long> ByPlayer { get; set; } = new Dictionary<string, long>();
}
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();
}
SaveConfig();
}
protected override void SaveConfig() => Config.WriteObject(config);
protected override void LoadDefaultMessages()
{
lang.RegisterMessages(new Dictionary<string, string>
{
["NoPermission"] = "You do not have permission to use this command.",
["YourTotal"] = "You have burned {0} fuel units in your ovens.",
["ServerTotal"] = "Server-wide fuel units burned: {0}."
}, this);
}
private string Msg(string key, string userId = null, params object[] args) =>
string.Format(lang.GetMessage(key, this, userId), args);
private void Init()
{
permission.RegisterPermission(PermStats, this);
data = Interface.Oxide.DataFileSystem.ReadObject<StoredData>(DataFile) ?? new StoredData();
}
private void OnServerInitialized()
{
saveTimer = timer.Every(Mathf.Max(15f, config.SaveInterval), SaveData);
}
private void SaveData()
{
Interface.Oxide.DataFileSystem.WriteObject(DataFile, data);
}
private void OnFuelConsumed(BaseOven oven, Item fuel, ItemModBurnable burnable)
{
if (oven == null || fuel == null || oven.OwnerID == 0UL) return;
string userId = oven.OwnerID.ToString();
long current;
data.ByPlayer.TryGetValue(userId, out current);
data.ByPlayer[userId] = current + 1;
}
[ChatCommand("fuelstats")]
private void CmdFuelStats(BasePlayer player, string command, string[] args)
{
if (player == null) return;
if (!permission.UserHasPermission(player.UserIDString, PermStats))
{
player.ChatMessage(Msg("NoPermission", player.UserIDString));
return;
}
long mine;
data.ByPlayer.TryGetValue(player.UserIDString, out mine);
long total = 0;
foreach (var kv in data.ByPlayer) total += kv.Value;
player.ChatMessage(Msg("YourTotal", player.UserIDString, mine));
player.ChatMessage(Msg("ServerTotal", player.UserIDString, total));
}
private void Unload()
{
if (saveTimer != null) saveTimer.Destroy();
SaveData();
data = null;
}
}
}The plugin counts fuel units each player burns in their ovens and reports totals through a chat command. OnFuelConsumed increments a per-owner counter keyed by the oven's OwnerID, using the fuel rate implied by the amount change is unnecessary because the game already reduced the item, so it simply adds one burn event per tick. Counters live in a dictionary and are persisted to oxide/data so restarts do not lose totals. A /fuelstats command lets the caller see their own total and the server-wide figure. Data is saved on Unload and periodically to keep I/O off the hot path.
Common use cases
Per-player fuel economy
Charge or credit players based on how much fuel their furnaces actually burn, using the oven's OwnerID to attribute each tick.
Server analytics dashboards
Aggregate fuel consumption per prefab type to understand which ovens are the biggest resource sinks on your server.
Bonus burn on rare fuels
Detect a specific shortname in the fuel item and, separately, adjust the oven's stored fuel to simulate extra efficiency for premium fuel types.
Pitfalls
Fires on every tick
A single lit furnace with a full stack calls this hook repeatedly per second. Do not log, allocate lists, or query entities here; use counters and flush them outside the hook.
The item is already reduced
Because the game called UseItem before the hook, fuel.amount reflects the post-consumption value. Do not treat the item as the full pre-burn amount.
Return value does nothing
Returning true or a modified value does not cancel or change consumption. You must mutate the oven or item directly if you want to alter behavior.
Build a plugin with OnFuelConsumed
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 OnFuelConsumed
Generate