Skip to content
RustPluginGenerator

OnOvenStarted

OnOvenStarted is called when a BaseOven begins a cooking session, right after its On flag is set and before fire effects and cooking state are updated.

Signature
void OnOvenStarted(BaseOven oven)

Parameters

Hook parameters
ParameterTypeDescription
ovenBaseOvenThe BaseOven (or a subclass such as BaseCookableOven or BaseFueledOven) that just started cooking. Null-check it and read its inventory, position and owner before using it.

Return value

The return value is ignored; the original StartCooking continues setting up fire and calling UpdateIsCooking(). Return nothing to keep default behavior.

How it works

Oxide fires this hook inside BaseOven.StartCooking, after the oven's On flag is set (with a network update) and before the open-flame NpcFireManager registration and UpdateIsCooking() run. It fires when an oven transitions from idle to actively cooking, typically after a player inserts fuel and/or food and the oven is switched on or auto-starts. The single parameter is the oven instance, which you can use to inspect its type, position, inventory contents, and owner.

Because the argument is BaseOven, declaring BaseCookableOven or BaseFueledOven narrows the hook to those subtypes only; Oxide skips calls where the passed entity is not an instance of your declared type. This hook runs after the On flag is already applied, so it is a notification, not a veto point. The oven's cooking state has not yet been recomputed, so if you need accurate IsCooking()/slot data, act on the next tick or use OnOvenCook instead. This is a per-oven, occasional event, not a hot loop.

Example plugin: Announce oven ignition to the owner's team

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

namespace Oxide.Plugins
{
    [Info("Oven Start Notifier", "RustPluginGenerator", "1.0.0")]
    [Description("Announces oven starts to the owning player and their team")]
    public class OvenStartNotifier : RustPlugin
    {
        private const string PermNotify = "ovenstartnotifier.notify";

        private PluginConfig config;
        private readonly Dictionary<ulong, float> lastNotify = new Dictionary<ulong, float>();

        private class PluginConfig
        {
            [JsonProperty("Notify owner")]
            public bool NotifyOwner = true;

            [JsonProperty("Notify team members")]
            public bool NotifyTeam = true;

            [JsonProperty("Message cooldown seconds")]
            public float Cooldown = 5f;
        }

        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>
            {
                ["Started"] = "Oven started cooking at {0}",
                ["TeamStarted"] = "{0}'s oven started cooking at {1}"
            }, this);
        }

        private void Init()
        {
            permission.RegisterPermission(PermNotify, this);
        }

        private void OnOvenStarted(BaseOven oven)
        {
            if (oven == null || oven.OwnerID == 0) return;

            ulong ownerId = oven.OwnerID;
            string ownerString = ownerId.ToString();
            if (!permission.UserHasPermission(ownerString, PermNotify)) return;

            if (config.Cooldown > 0f)
            {
                float now = UnityEngine.Time.realtimeSinceStartup;
                if (lastNotify.TryGetValue(oven.net.ID.Value, out float last) && now - last < config.Cooldown) return;
                lastNotify[oven.net.ID.Value] = now;
            }

            string grid = PositionToGrid(oven.transform.position);
            string ovenName = oven.ShortPrefabName ?? "oven";

            BasePlayer owner = BasePlayer.FindByID(ownerId);
            if (config.NotifyOwner && owner != null && owner.IsConnected)
            {
                owner.ChatMessage(string.Format(Msg("Started", ownerString), grid));
            }

            if (!config.NotifyTeam || owner == null || owner.currentTeam == 0) return;

            var team = RelationshipManager.ServerInstance.FindTeam(owner.currentTeam);
            if (team == null) return;

            foreach (ulong memberId in team.members)
            {
                if (memberId == ownerId) continue;
                BasePlayer member = BasePlayer.FindByID(memberId);
                if (member == null || !member.IsConnected) continue;
                member.ChatMessage(string.Format(Msg("TeamStarted", member.UserIDString), owner.displayName, grid));
            }
        }

        private string PositionToGrid(Vector3 pos)
        {
            const float cellSize = 150f;
            int x = Mathf.FloorToInt((pos.x + 2048f) / cellSize);
            int z = Mathf.FloorToInt((2048f - pos.z) / cellSize);
            return GridNumber(x) + z.ToString();
        }

        private string GridNumber(int index)
        {
            string result = string.Empty;
            index++;
            while (index > 0)
            {
                int rem = (index - 1) % 26;
                result = (char)('A' + rem) + result;
                index = (index - 1) / 26;
            }
            return result;
        }

        private string Msg(string key, string userId = null, params object[] args)
            => string.Format(lang.GetMessage(key, this, userId), args);

        private void Unload()
        {
            lastNotify.Clear();
        }
    }
}

The plugin listens for OnOvenStarted and checks that the oven has a player owner (OwnerID). It resolves the owner, confirms they have the ovenstartnotifier.notify permission, and formats a chat message localized through the language file with the oven's readable name and grid position. It reports to the owner and to every connected teammate by looking up currentTeam via RelationshipManager.ServerInstance.FindTeam. If no team exists, only the owner is messaged. A short cooldown per oven network ID prevents duplicate spam when an oven restarts quickly. The plugin registers its permission in Init and loads default messages so admins can translate them.

Common use cases

  • Fuel and food auditing

    On start, read the oven's inventory to detect which wood type and what food were loaded and record it to a data file for later server audits.

  • Team notifications

    Alert the owning player and their teammates in chat when a base oven kicks on, which helps groups track who is cooking and when.

  • Economy or XP rewards

    Grant a small Economics balance or custom point award each time a player starts a smelting batch, using the oven owner to credit the right account.

Pitfalls

  • Runs before cooking state updates

    The hook fires before UpdateIsCooking(), so IsCooking() and per-slot cook progress may still reflect the pre-start state. Use OnOvenCook if you need live cooking data.

  • Ovens have many subtypes

    BBQ, campfire, furnace, and refinery all derive from BaseOven. If you only care about one kind, declare the specific subclass (e.g. BaseFueledOven) or check oven.ShortPrefabName.

  • Not a veto point

    The On flag is already set before this hook fires and the return value is ignored, so you cannot cancel cooking here. Use OnOvenStart or OnOvenToggle for prevention logic.

Build a plugin with OnOvenStarted

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

Prompt: Fuel and food auditing using the OnOvenStarted 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 OnOvenStarted

Generate