Skip to content
RustPluginGenerator

OnExcavatorSuppliesRequest

OnExcavatorSuppliesRequest is called when a player requests supplies from a powered, supplied ExcavatorSignalComputer at the Giant Excavator monument, before the supply plane is spawned.

Signature
object OnExcavatorSuppliesRequest(ExcavatorSignalComputer excavatorSignalComputer, BasePlayer player)

Parameters

Hook parameters
ParameterTypeDescription
excavatorSignalComputerExcavatorSignalComputerThe ExcavatorSignalComputer entity that received the supply request. Use it to read its position, owner, flags or power state, or to call Kill() on it to remove the computer.
playerBasePlayerThe BasePlayer who triggered the request through the signal computer UI. Can be null if the RPC arrives without a valid player, so always null-check it before use.

Return value

Return null to let the game spawn the supply plane and drop point as usual. Return any non-null object (for example true or an empty string) to stop the original method; the value itself is discarded because RequestSupplies returns void.

How it works

The hook fires inside ExcavatorSignalComputer.RequestSupplies, which is the RPC handler for the panel on the excavator signal computer. By the time the hook is reached the game has already verified that the computer has the Reserved7 flag set, is receiving power, has enough charge (chargePower >= GetChargeNeededForSupplies()) and still has supplies remaining. Your handler sees the computer entity and the requesting player.

Returning a non-null value aborts the rest of the method, so no supply plane entity is created and no drop point is picked. Returning null (or not declaring the hook) lets vanilla behavior continue: a supply plane prefab is created at a random drop point and spawned, and the crate falls at that location.

Because the original method returns void, only null-versus-non-null matters; the actual returned object is not used as a result. The hook is not called when any of the preconditions fail, so you do not need to repeat the power or charge checks yourself. Declaring object as the return type is required; you may narrow the computer parameter if you only care about one subtype, but there is only one relevant type here.

Example plugin: Replace the supply plane with a direct airdrop crate at the computer

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

namespace Oxide.Plugins
{
    [Info("ExcavatorDirectSupply", "RustPluginGenerator", "1.0.0")]
    [Description("Replaces the excavator supply plane with a crate dropped near the signal computer")]
    public class ExcavatorDirectSupply : RustPlugin
    {
        private const string PermUse = "excavatordirectsupply.use";

        private PluginConfig config;

        private class PluginConfig
        {
            [JsonProperty("Replace supply plane with direct crate")]
            public bool DirectDrop { get; set; } = true;

            [JsonProperty("Prefab spawned above the computer")]
            public string CratePrefab { get; set; } = "assets/prefabs/misc/supply drop/supply_drop.prefab";

            [JsonProperty("Height above the computer")]
            public float Height { get; set; } = 40f;
        }

        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>
            {
                ["Delivered"] = "Your excavator supplies were delivered directly to the drop point.",
                ["NoPermission"] = "You are not allowed to use the excavator supply panel."
            }, 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(PermUse, this);
        }

        private object OnExcavatorSuppliesRequest(ExcavatorSignalComputer excavatorSignalComputer, BasePlayer player)
        {
            if (excavatorSignalComputer == null)
                return null;

            if (player != null && !permission.UserHasPermission(player.UserIDString, PermUse))
            {
                player.ChatMessage(Msg("NoPermission", player.UserIDString));
                return true;
            }

            if (!config.DirectDrop)
                return null;

            var prefab = GameManager.server.FindPrefab(config.CratePrefab);
            if (prefab == null)
                return null;

            Vector3 position = excavatorSignalComputer.transform.position + Vector3.up * config.Height;
            BaseEntity crate = GameManager.server.CreateEntity(config.CratePrefab, position, Quaternion.identity);
            if (crate == null)
                return null;

            crate.Spawn();

            if (player != null)
                player.ChatMessage(Msg("Delivered", player.UserIDString));

            // Returning non-null stops the original supply plane spawn.
            return true;
        }
    }
}

The plugin intercepts every supply request on the excavator signal computer. It checks a config option; if direct delivery is enabled, it returns a non-null value so vanilla never creates the supply plane, then finds a random drop point by spawning nothing at all and instead spawning a supply drop crate above the signal computer's position. It still requires the game's own power and supply checks to pass, because the hook only fires after they succeed. Players receive a chat confirmation in their own language, and the code guards against a null player and a null crate prefab so a failed spawn cannot leave the request unanswered.

Common use cases

  • Replace the plane with a direct crate drop

    Return non-null to suppress the supply plane and spawn your own HackableLockedCrate or SupplyDrop at a controlled position, which avoids planes flying through base builds or crashing into cliffs.

  • Add a cooldown or permission gate

    Track the last request time per player in oxide/data and return non-null while the cooldown is active, sending a chat notice with the remaining seconds instead of a full airdrop.

  • Reward the player with custom loot

    Block the vanilla plane and instead give the player items from a configured table using ItemManager.CreateByName and player.GiveItem, which is useful for PvE or custom economy servers.

Pitfalls

  • The hook only fires when prerequisites are met

    If the computer lacks power, charge or remaining supplies, RequestSupplies exits before the hook is called. Do not build logic that assumes the hook fires on every interaction with the panel.

  • Returning a value silently cancels the airdrop

    Because the method returns void, returning anything non-null simply stops the original path. Make sure you either spawn your own reward or message the player, otherwise the request appears to do nothing.

  • Player can be null

    The player comes from the RPC message and may not be a valid BasePlayer. Check for null before sending chat, giving items or writing data against player.userID.

Build a plugin with OnExcavatorSuppliesRequest

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

Prompt: Replace the plane with a direct crate drop using the OnExcavatorSuppliesRequest 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 OnExcavatorSuppliesRequest

Generate