Stopping Looting Because Loot Table Doesn't Exist - Bodies To Bags interference

Bodies To Bags plugin seems to be interfering with the timeout. No matter what I set my inventoryviewer timer to in the config file, it times out after 5s (default BodiesToBags timer)

I have been trying to fix it myself, but no luck.

Changing the timer on Bodies To Bags allows you to view inventories for that amount of time. (as you can see I have changed it to 15 from 5 to test my theory and I was correct)

        private void OnEntitySpawned(BaseNetworkable entity)
        {
            var corpse = entity as LootableCorpse;
            if (corpse == null || entity is NPCPlayer) return;

            timer.Once(15f, () =>
            {
                corpse.Kill();
                corpse.DropItems();
            });
        }
    }
}

This conflict exists because Inventory Viewer uses a temporary corpse to allow you to loot the player's inventory, which is a smart trick because it avoids vanilla problems around looting awake players, and avoids using Oxide hooks to forcibly allow looting the player, which avoids hooks conflicts and saves on performance.

Here's what I recommend.

  1. Uninstall Bodies To Bags and set the convar corpsedespawn 5 which does the same thing.
  2. Update Inventory Viewer to run corpse.CancelInvoke(corpse.RemoveCorpse); on the line after corpse.Spawn();. That will ensure the corpse removal happens at the right time (after vanilla Rust has scheduled corpse removal, which happens during the Spawn method). Currently, Inventory Viewer is canceling corpse removal immediately after creating the corpse, but before spawning the corpse, which does not work.
I've submitted a thread requesting that the Bodies To Bags plugin/documentation be updated to mention the convar alternative.
https://umod.org/community/bodies-to-bags/43600-documentation-should-state-that-this-plugin-is-not-necessary

I will submit a patch to the Inventory Viewer plugin to resolve the temporary corpse being prematurely removed.