Skip to content
RustPluginGenerator

How to make a Rust recycler output multiplier plugin (Oxide/Carbon)

Scales the amount of resources a recycler returns using a global multiplier plus per-item overrides. It hooks OnItemRecycleAmount and adjusts the returned yield before the item is consumed.

Recyclers return fixed yields, so on a server where scrap and components are plentiful or scarce you cannot tune the economy without editing loot tables. A multiplier lets you reward recycling (for example 1.5x) while keeping specific items at a different rate so one resource does not flood the map.

This plugin uses the OnItemRecycleAmount hook, which fires for each recyclable item as the recycler processes it and asks for the amount to return. The plugin reads the incoming amount, looks up an override for that item's shortname, otherwise applies the global multiplier, and rounds to a whole number. All values live in the config so admins can retune without recompiling. The result is a single file that works on Oxide and on Carbon, with no commands needed for normal operation.

The plugin code

RecyclerMultiplier.cs
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;

namespace Oxide.Plugins
{
    [Info("Recycler Multiplier", "RustPluginGenerator", "1.0.0")]
    [Description("Multiplies recycler output with a global multiplier and per-item overrides.")]
    public class RecyclerMultiplier : RustPlugin
    {
        private const float MinimumAmount = 1f;

        private PluginConfig config;

        private class PluginConfig
        {
            [JsonProperty("Global multiplier")]
            public float GlobalMultiplier { get; set; } = 1.0f;

            [JsonProperty("Per-item overrides (shortname -> multiplier)")]
            public Dictionary<string, float> Overrides { get; set; } = new Dictionary<string, float>
            {
                ["scrap"] = 1.0f
            };
        }

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

            // Sanitize multipliers so a mistyped value cannot zero out recycling.
            if (config.Overrides == null)
            {
                config.Overrides = new Dictionary<string, float>();
            }

            if (config.GlobalMultiplier <= 0f)
            {
                PrintWarning("Global multiplier must be greater than 0, resetting to 1.0");
                config.GlobalMultiplier = 1.0f;
            }

            foreach (var key in new List<string>(config.Overrides.Keys))
            {
                if (config.Overrides[key] <= 0f)
                {
                    PrintWarning($"Override for '{key}' must be greater than 0, resetting to 1.0");
                    config.Overrides[key] = 1.0f;
                }
            }

            SaveConfig();
        }

        protected override void SaveConfig() => Config.WriteObject(config);

        private object OnItemRecycleAmount(Item slot, int num3, Recycler recycler)
        {
            if (slot == null || slot.info == null) return null;
            if (num3 <= 0) return null;

            float multiplier = config.GlobalMultiplier;

            float overrideValue;
            if (config.Overrides.TryGetValue(slot.info.shortname, out overrideValue))
            {
                multiplier = overrideValue;
            }

            if (Math.Abs(multiplier - 1f) < 0.0001f) return null;

            float result = num3 * multiplier;
            int amount = (int)Math.Round(result, MidpointRounding.AwayFromZero);

            if (amount < MinimumAmount) amount = (int)MinimumAmount;

            return amount;
        }
    }
}

Hooks used: OnItemRecycleAmount

Config file

Created automatically on first load at oxide/config/RecyclerMultiplier.json.

RecyclerMultiplier.json
{
  "Global multiplier": 1,
  "Per-item overrides (shortname -> multiplier)": {
    "scrap": 1
  }
}

How the code works

  1. Read the yield and match the item

    OnItemRecycleAmount(Item slot, int num3, Recycler recycler) fires with the item being recycled and the vanilla return amount in num3. The plugin first null-checks slot and slot.info, then reads slot.info.shortname. Because the config stores overrides by shortname, the lookup is a single TryGetValue on the Overrides dictionary.

  2. Apply the multiplier

    The plugin starts from config.GlobalMultiplier and replaces it with the override value if the item's shortname is present in Overrides. It multiplies num3 by that factor and rounds with Math.Round using MidpointRounding.AwayFromZero so 2.5 becomes 3 rather than 2. The final number is clamped to a minimum of 1 so a small multiplier on a 1-item yield does not silently delete the output.

  3. Return the adjusted amount

    OnItemRecycleAmount returns an object; returning a boxed int replaces the amount the recycler hands back. Returning null keeps the vanilla value. The plugin returns null when the multiplier is 1.0, so the outcome is identical to vanilla until an admin changes the config.

  4. Configure global and per-item values

    The PluginConfig class holds Global multiplier (a float, default 1.0) and Per-item overrides (shortname -> multiplier) (a Dictionary<string, float>). The default dictionary ships a single scrap entry set to 1.0 as a template. LoadConfig reads the file and falls back to LoadDefaultConfig with a warning if the JSON is invalid or empty.

  5. Guard against bad values

    LoadConfig also checks the loaded multipliers: a GlobalMultiplier at or below zero is reset to 1.0 with a warning, and any override value at or below zero is reset the same way while iterating over a copied key list. A null Overrides dictionary is replaced with an empty one. The sanitized config is written back with SaveConfig.

Install it on your server

  1. Save RecyclerMultiplier.cs

    Keep the file name exactly as the class name. Oxide matches them.
  2. Upload it to the plugins folder

    Oxide: oxide/plugins/. Carbon: carbon/plugins/. The server compiles and loads it within a few seconds, no restart needed.
  3. Edit the config if you want

    On first load the default config is written to oxide/config/RecyclerMultiplier.json (Carbon: carbon/configs/RecyclerMultiplier.json). After editing, reload it:oxide.reload RecyclerMultiplier c.reload RecyclerMultiplier # Carbon

Variations

Each one opens the generator with a ready prompt you can tweak.

FAQ

Does this affect the recycler's processing time?

No. OnItemRecycleAmount only controls how many resources come back per item. The time a recycler takes to process an item is unchanged, and the plugin does not touch the recycler's queue.

What happens if a shortname in my overrides is wrong?

The entry never matches a recycled item because the lookup uses slot.info.shortname exactly. The plugin does not validate shortnames against ItemManager, so check the spelling in game before relying on an override.

Can I use a multiplier below 1?

Yes. The plugin clamps the final amount to at least 1, so a 0.5 multiplier on a yield of 4 returns 2, but a 0.1 multiplier on a yield of 1 still returns 1. A value of 0 or below in the config is reset to 1.0 on load.

How do I install it on Oxide or Carbon?

Drop the compiled .cs file into oxide/plugins on an Oxide server or the equivalent Carbon plugins folder. The plugin has no dependencies and no permissions, so no extra setup is required. Edit oxide/config/RecyclerMultiplier.json and reload the plugin to apply changes.

Will stacking in inventory break the multiplied output?

No. The recycler still creates normal items; the plugin only changes the amount. If the container has no room the game drops the overflow as usual, which is standard recycler behavior.

Customize it for your server

Change the reward, add a cooldown, restrict it to VIPs. Start from this prompt and edit anything.

Prompt: Create a Rust Oxide plugin that multiplies recycler output using OnItemRecycleAmount, with a global multiplier defaulting to 1.0 and per-item shortname overrides in the config, rounding up and clamping to a minimum of 1.
Customize for my server

Edit the prompt on the next screen. 2 free plugins a month, no card.

Last updated Oct 26, 2026.

Customize recycler output multiplier

Customize