Refresh listed containers on map?Solved
Is it possible to refresh listed containers on the map? Because I'm working on a plugin that has a chance to add a new item in the container at spawn.
Clarify, how do you add them? OnLootSpawn or?
Yes, OnLootSpawn :)
I doubt you can manually call it. Why not just go through all containers in OnServerInitialized?
I'm learning Rust plugin. I'll try to check every container at initialization but it looks hard 😂

How can I "list" every container?
BaseNetworkable.serverEntities
if entity is LootContainer
Thank you!
But I got one error:
void OnFirstRun()
        {
            foreach (var item in BaseNetworkable.serverEntities.Count)
            {

            }
            Puts("TEST: " + BaseNetworkable.serverEntities.entityList.Count);
        }​
"foreach" isn't working because it needs a "GetEnumerator". What is this?

EDIT: My bad, I use .count that isn't an item xD

Merged post

I managed to kill every container that are listed but is there a command to refresh the respawn time of all container?
Just manually call your method for loot refresh in foreach. On Unload you could reset loot in containers.
1. https://umod.org/plugins/extra-loot
2. You need to add it on every time ONLY loot respawns, not every time entity spawns. Same if you will check all entities on plugin load, you have chance to fuckup (for example you will change config), and it will work 5 times instead of 1
Locked automatically