Issue with NPC Loot Drops and Possible Conflict with Dangerous Treasures Plugin

Dear nivex / Dangerous Treasures Support Team,

I hope you are doing well.

I am currently running the Dangerous Treasures plugin (from uMod) alongside Better NPC  on my Rust server. I have encountered an issue where NPCs spawned by Better NPC do not drop loot after a short period of normal operation. Specifically, after restarting the server or the plugin, NPCs drop loot correctly for around 15 minutes, but then suddenly stop dropping any loot at all. This affects not only NPCs from Better NPC but also loot from player bodies and raidable bases.

We observed the following:

  • When Better NPC is disabled, the loot drops work normally.

  • During the problematic period, an error appears in the logs related to Dangerous Treasures:

    InvalidOperationException: Collection was modified; enumeration operation may not execute.
       at Oxide.Plugins.DangerousTreasures.TreasureChest.EquipWeapon(...)
    • We suspected a plugin conflict and tested by removing several other plugins, but the error and issue persist while Better NPC and Dangerous Treasures are both active.

    • The issue might be linked to a hook or interaction between Dangerous Treasures and Better NPC, but we have not pinpointed the root cause yet.

    Could you please advise if Dangerous Treasures might cause this loot-dropping issue or the exception above? Are there any known compatibility issues with Better NPC or other plugins? Additionally, is there a configuration or update that could prevent this conflict or error?

    Thank you very much for your time and support.

    Best regards

Hi, I don't think this is caused by Dangerous Treasures, sorry. There are no configuration changes or known conflicts other than this one, this requires a fix by whatever plugin is causing it. I suggest unloading Dangerous Treasures until you find the cause.

It still appears to be a shared pool issue, which perfectly accounts for every issue you've described. 

DM me your list of plugins and I may be able to help you narrow it down.

To clarify: my plugin does not modify that collection in EquipWeapon, nor was it changed in the last update. This would likely be caused by a third plugin.

Merged post

I left out one very important detail: if this is a pooling issue, then it will require you a server restart, or the List<Item> pool to be reset, each time you remove a plugin while testing

I made a repository to make this easier. It contains valuable steps to narrow down your search, and a plugin to assist with resetting the pool or getting information about the state of the pool.

https://github.com/nivex09/NivexPoolReset

Thank you very much for your kindness!

Merged post

After deleting Dangerous Treasures, the problem does not seem to have recurred.

When I checked using the method you taught me, I found so many related plugins. LOL.

Thank you very much for your help.

Merged post

 RandomTrader.cs (3 matches)
	行番号 1453:             List<Item> scrapStacks = Pool.Get<List<Item>>();
	行番号 1501:             List<Item> scrapStacks = Pool.Get<List<Item>>();
	行番号 1609:             List<Item> result = Pool.Get<List<Item>>();
  Cooking.cs (5 matches)
	行番号  4223:             List<Item> result = Pool.Get<List<Item>>();
	行番号  4611:                     List<Item> item_drops = Pool.Get<List<Item>>();
	行番号  4993:             List<Item> items_to_return = Pool.Get<List<Item>>();
	行番号  5116:                 List<Item> failMoveSlot = Pool.Get<List<Item>>();
	行番号  8750:             List<Item> foundToSell = Pool.Get<List<Item>>();
  Kits.cs (1 matches)
	行番号 3681:                     itemContainer.itemList = Pool.Get<List<Item>>();
  LSkins.cs (1 matches)
	行番号 1063:                 var getItems = Facepunch.Pool.Get<List<Item>>();
  SubmersiblePump.cs (1 matches)
	行番号 293:                 List<Item> invItems = Pool.Get<List<Item>>();
  GlobalStoragePro.cs (1 matches)
	行番号  895:             List<Item> itemsToRemove = Pool.Get<List<Item>>();
  Waystones.cs (1 matches)
	行番号  887:                 List<Item> invItems = Pool.Get<List<Item>>();
  QuickSort.cs (2 matches)
	行番号  645:             List<Item> itemsSelected = Pool.Get<List<Item>>();
	行番号  700:             List<Item> itemsSelected = Pool.Get<List<Item>>();
  RandomRaids.cs (1 matches)
	行番号 3668:                             List<Item> itemList = Pool.Get<List<Item>>();
  BaseRepair.cs (1 matches)
	行番号 396:             List<Item> items = Pool.Get<List<Item>>();
  Sputnik.cs (2 matches)
	行番号 3520:                     List<Item> allItems = Pool.Get<List<Item>>();
	行番号 3535:                         List<Item> allItems = Pool.Get<List<Item>>();
  PogoStick.cs (2 matches)
	行番号  728:                     List<Item> allItems = Pool.Get<List<Item>>();
	行番号  743:                         List<Item> allItems = Pool.Get<List<Item>>();
  CraftingController.cs (1 matches)
	行番号 627:             List<Item> containeritems = Pool.Get<List<Item>>();
  RemoverTool.cs (2 matches)
	行番号 2039:             var list = Pool.Get<List<Item>>();
	行番号 2060:             var list = Pool.Get<List<Item>>();
  Space.cs (2 matches)
	行番号 4651:                     List<Item> allItems = Pool.Get<List<Item>>();
	行番号 4667:                         List<Item> allItems = Pool.Get<List<Item>>();
  ServerRewards.cs (1 matches)
	行番号 1473:         List<Item> items = Pool.Get<List<Item>>();
  ItemPerks.cs (5 matches)
	行番号 3036:             List<Item> item_drops = Pool.Get<List<Item>>();
	行番号 3338:             List<Item> result = Pool.Get<List<Item>>();
	行番号 3950:             List<Item> items = Pool.Get<List<Item>>();
	行番号 4612:             List<Item> items = Pool.Get<List<Item>>();
	行番号 4705:             List<Item> items = Pool.Get<List<Item>>();
  RestoreUponDeath.cs (1 matches)
	行番号 612:                     itemContainer.itemList = Pool.Get<List<Item>>();

Hi, you're welcome

Make sure those plugins are up to date (including Server Rewards) and restart your server

Yes, all have the latest updates applied and are rebooted daily.😊

Ok, you will have to find the plugin causing it then