I have two loot plugins that both want to use the OnEntitySpawned() hook to place items into barrels
One is a popular Loot plugin that uses NextTick() inside of OnEntitySpawned() and seems to always go 2nd because of this
This messes up my other custom loot plugin that is adding a random restricted item into barrels, it's work gets overwritten by the main Loot plugin that runs last.
(Im using my own plugin so I can set the probability of the item spawning, the popular loot plugins only give you ~4 pre-set options of rarity that I believe is built into Rust itself)
Anyways, is there a way I can force the order?
Delayed Timer? A NextTick inside of NextTick?
Two Plugins One Hook - How to Force Order?
Discussion in 'Rust Development' started by Togoshige, Jun 14, 2017.
-
Wulf Community Admin
The only way to change the order is to name your plugins in the order you'd like them to be called, else delay them with a timer (unreliable).
-
You can sort hooks
Code:private readonly FieldInfo hooksField = typeof(PluginManager).GetField("hookSubscriptions",BindingFlags.Instance | BindingFlags.NonPublic);var hooksDescriptions = (IDictionary<string, IList<Plugin>>) hooksField.GetValue(Interface.Oxide.RootPluginManager);