Body Bag Despawn
by Base Inspector · v1.3.0 · updated Nov 8, 2026
No dependencies: works on its own.
Installs itself with Oxide Sync. Add it to a linked server from My servers. Every future update included. How it works
- Full C# source
- Free updates
- Signed releases
- Oxide / uMod compatible
Body Bag Despawn
Automatic Body Bag Cleanup for Rust Servers
Keep your Rust server clean, optimized, and free from abandoned body bags with Body Bag Despawn, a lightweight Oxide/uMod plugin that automatically removes dropped player body bags after a configurable amount of time.
Unlike standard loot cleanup behavior, Body Bag Despawn removes tracked bags regardless of whether they still contain items, helping prevent abandoned loot containers from accumulating across your map.
Designed with performance in mind, the plugin uses a single global timer and efficient entity tracking to minimize unnecessary processing.
Features
- Automatic Body Bag Removal — Automatically despawns
item_drop_backpackentities after a configurable duration. - Death-Based Despawn Timing — Tracks player corpse creation times and uses those timestamps to calculate when associated body bags should be removed.
- Removes Bags Regardless of Contents — Bags are deleted even if they contain valuable loot.
- Configurable Despawn Duration — Adjust the cleanup interval to match your server's gameplay.
- Performance-Focused Design — Uses one global processing timer rather than creating a separate timer for every tracked bag.
- Efficient Entity Detection — Caches prefab IDs to reduce unnecessary entity comparisons.
- Automatic Tracking Cleanup — Removes expired death records and entries for destroyed bags.
- Optional Debug Logging — Provides diagnostic information for troubleshooting.
How It Works
- Player Dies — The plugin tracks the player's death using the spawned corpse.
- Body Bag Appears — When a matching dropped backpack spawns, the plugin attempts to associate it with the recorded death.
- Despawn Timer Is Calculated — The plugin determines how much time remains in the configured cleanup window.
- Automatic Removal — Once the timer expires, the body bag is deleted, even if it contains items.
If the plugin cannot associate a spawned body bag with a recorded death, it starts the full configured timer from the bag's spawn time.
Default Configuration
{
"Enabled": true,
"DespawnSecondsFromDeath": 300.0,
"ExtraBufferSeconds": 180.0,
"Debug": false
}
Configuration Options
Enabled
Enables or disables automatic body bag tracking and cleanup.
DespawnSecondsFromDeath
Determines how many seconds a body bag should remain before removal.
Default: 300 seconds (5 minutes).
ExtraBufferSeconds
Additional time used when determining how long death-tracking records should be retained. This does not extend the actual body bag despawn timer.
Default: 180 seconds.
Debug
Enables diagnostic logging for death tracking, body bag scheduling, and cleanup events.
Default: false.
Performance Optimization
Body Bag Despawn is designed for busy, modded Rust servers where large numbers of dropped containers can accumulate.
The plugin includes:
- A single global cleanup timer running once per second.
- Dictionary-based tracking of pending body bags.
- Cached prefab IDs for efficient entity identification.
- Reusable collections to reduce repeated allocations.
- Automatic removal of expired tracking records.
- Minimal processing when no body bags are scheduled for cleanup.
This approach avoids creating individual repeating timers for every dropped bag.
Installation
- Download
BodyBagDespawn.cs. - Upload it to your Rust server's
oxide/pluginsdirectory. - Allow Oxide/uMod to compile and load the plugin.
- Edit the generated configuration file at
oxide/config/BodyBagDespawn.json. - Reload the plugin after making configuration changes.
To reload manually:
oxide.reload BodyBagDespawn
Commands & Permissions
No chat commands, console commands, or permissions are required.
The plugin operates automatically once loaded and enabled.
Compatibility
- Game: Rust
- Framework: Oxide/uMod
- Plugin Version: 1.3.1
- Tracked Entity:
item_drop_backpack - Configuration: JSON
- Dependencies: No additional plugin dependencies declared
Important Notes
- Body bags are removed regardless of their remaining inventory contents.
- The plugin targets dropped backpack entities, not every type of loot container.
- Death-based timing depends on successfully associating the bag's owner ID with a tracked corpse.
- Existing bags are not automatically scanned when the plugin loads.
- Pending timers are not persisted across plugin reloads or server restarts.
- The configured despawn duration is enforced with approximately one-second timer resolution.
Body Bag Despawn is an efficient, configurable solution for automatically removing abandoned body bags and maintaining a cleaner Rust server environment.
v1.3.0Mar 1, 2026Latest
Prefab ID caching — On server init, the backpack prefab ID is resolved to a single uint and corpse prefab IDs are collected into a HashSet<uint>. Now OnEntitySpawned rejects irrelevant entities with a uint comparison and a HashSet.Contains before any casting or string work. The old string-based IsBodyBag is kept only as a fallback if prefab caching somehow fails at startup. Global tick replaces per-bag timers — Instead of each backpack getting its own timer.Once with a closure, bags are queued into _pendingBags with a pre-calculated KillAtTime. A single timer.Every(1s) tick processes the entire queue each pass. On a busy 100x with dozens of deaths per minute, this eliminates hundreds of concurrent timer handles and closure allocations. The 1s tick interval is fine here since bag despawn times are measured in minutes. ulong keys replace string keys — _pendingBags is keyed by net.ID.Value (a ulong value type) instead of .ToString(). Zero allocation on every bag spawn/kill, and faster dictionary hashing/comparison. Removed try/catch blocks from hot paths — GetCorpsePlayerId and ScheduleBagDespawnFromDeath no longer wrap simple property access in try/catch. These properties don't throw under normal conditions, and the exception handling frame setup was unnecessary overhead on every death. Reusable prune buffer — MaybePruneDeathTimes now uses the class-level _keysToRemove list instead of allocating a new List<ulong> each time it prunes. OnEntityKill also uses prefab ID checks — Same cheap uint rejection so the kill hook doesn't cast on every entity death. Gameplay is completely unchanged — same despawn timing, same death-to-backpack linking logic, same config.
v1.2.0Feb 23, 2026
Initial release



