Skip to content
RustPluginGenerator

OnFuelConsume

OnFuelConsume is called inside BaseOven.ConsumeFuel just before the game processes a unit of fuel, letting a plugin cancel that consumption by returning a non-null value.

Signature
object OnFuelConsume(BaseOven oven, Item fuel, ItemModBurnable burnable)

Parameters

Hook parameters
ParameterTypeDescription
ovenBaseOvenThe BaseOven (furnace, campfire, lantern, barbecue, etc.) that is about to burn the fuel item. Use it to identify the entity and its owner.
fuelItemThe Item instance being consumed from the oven's fuel slot. Check its amount, skin, or info.shortname to decide what to do.
burnableItemModBurnableThe ItemModBurnable component on the fuel item, which holds burn duration and byproduct settings. Useful for reading burn data before the item is processed.

Return value

Returning null (or nothing else reachable) lets the game proceed with normal fuel consumption, including byproduct creation. Returning any non-null value causes ConsumeFuel to return immediately, so the fuel item is not processed for that tick.

How it works

The hook fires from BaseOven.ConsumeFuel, which the game calls when a fueled entity (furnace, large furnace, campfire, barbecue, lantern, small oil refinery and similar) burns one unit of a fuel item during its update tick. It runs before the byproduct roll and before the fuel item's amount is decremented, so every consumption attempt of every fueled entity on the server passes through it.

The parameters give you the oven entity, the concrete fuel Item and its ItemModBurnable component. You can read fuel.amount, fuel.skin, fuel.info.shortname and burnable.burnDuration to make decisions. Declaring a more specific type for the oven parameter is possible with base types like BaseCombatEntity, but since the first argument is always a BaseOven, narrowing it further to a derived class such as BaseOven itself gains nothing; use is checks inside the hook instead if you need furnace-specific data.

The hook fires often on busy servers with many lit furnaces, so keep the body cheap: no Puts, no printing, no data writes. Return null normally to let the oven burn fuel as usual, or a non-null value to skip that single consumption.

Example plugin: Make lanterns free to burn

FreeLanternFuel.cs
using System.Linq;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("FreeLanternFuel", "RustPluginGenerator", "1.0.0")]
    [Description("Prevents fuel from being consumed on configured ovens such as lanterns.")]
    public class FreeLanternFuel : RustPlugin
    {
        private const string PermUse = "freelanternfuel.use";

        private PluginConfig config;
        private HashSet<string> freePrefabs;

        private class PluginConfig
        {
            [JsonProperty("Require permission")]
            public bool RequirePermission = false;

            [JsonProperty("Prefabs that never consume fuel")]
            public List<string> FreePrefabs = new List<string>
            {
                "lantern.deployed",
                "lantern",
                "ceilinglight.deployed",
                "weaponrack"
            };
        }

        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);

        private void Init()
        {
            permission.RegisterPermission(PermUse, this);
            freePrefabs = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
            foreach (var prefab in config.FreePrefabs)
            {
                if (!string.IsNullOrEmpty(prefab))
                    freePrefabs.Add(prefab);
            }
        }

        private object OnFuelConsume(BaseOven oven, Item fuel, ItemModBurnable burnable)
        {
            if (oven == null || fuel == null || burnable == null) return null;
            if (freePrefabs == null || freePrefabs.Count == 0) return null;

            var prefab = oven.ShortPrefabName;
            if (string.IsNullOrEmpty(prefab) || !freePrefabs.Contains(prefab)) return null;

            if (config.RequirePermission && oven.OwnerID != 0UL)
            {
                if (!permission.UserHasPermission(oven.OwnerID.ToString(), PermUse))
                    return null;
            }

            // Any non-null return keeps the fuel from being processed this tick.
            return true;
        }
    }
}

The plugin configures a list of prefab names whose fuel should not be consumed, with lantern.deployed as the default. Each time OnFuelConsume fires, it reads oven.ShortPrefabName; if it is in the configured list, it returns a non-null value so ConsumeFuel exits before the fuel item amount is reduced. Because the check is an in-memory hash lookup, the hook stays cheap even with many lit lamps. Admins can reload the config to change the list without touching code, and the plugin prints one warning at startup only, not during gameplay.

Common use cases

  • Infinite fuel for decorative lights

    Return non-null for lanterns, ceiling lights and similar cosmetics so bases can be lit permanently without players refilling them.

  • Fuel-gated furnaces by permission

    Check the oven's owner against a permission such as a VIP tier and skip consumption for those players while keeping fuel burns normal for everyone else.

  • Event-only fuel rules

    During a timed event, block fuel consumption on a specific prefab subset by toggling a boolean flag read inside the hook, then restore normal burn afterwards.

Pitfalls

  • Returning a value for all ovens

    A non-null return skips processing for that tick only, but if every oven always returns non-null, fuel items never decrease and player inventories still hold fuel that is used indefinitely; make sure your condition is narrow.

  • Heavy work in a hot hook

    ConsumeFuel is called on every fueled entity tick, so iterating over all entities, sending chat messages or writing to the data file here will tank performance and log spam on real servers.

  • Assuming the fuel slot stays consistent

    Returning non-null stops the byproduct roll and amount decrement for that call only; the game will try again next tick, so do not rely on it to remove the item — handle that explicitly if you need to.

Plugin recipes that use OnFuelConsume

Build a plugin with OnFuelConsume

Describe what should happen and get a compiled plugin that uses this hook.

Prompt: Infinite fuel for decorative lights using the OnFuelConsume hook, with a config file and a permission
Generate this plugin

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 OnFuelConsume

Generate