The current hook `OnLootSpawn` is triggered just before the `LootContainer.PopulateLoot()` method is called which means that if we would like to manipulate the looting table for the newly spawned entity is not possible, the workaround is to use `NextFrame()` to then do the manipulation.
I would like to suggest the creation of a new hook `OnLootSpawned` at the end of the `SpawnLoot()` method like so:
I would like to suggest the creation of a new hook `OnLootSpawned` at the end of the `SpawnLoot()` method like so:
public virtual void SpawnLoot()
{
if (base.inventory == null)
{
Debug.Log("CONTACT DEVELOPERS! LootContainer::PopulateLoot has null inventory!!!");
return;
}
base.inventory.Clear();
global::ItemManager.DoRemoves();
if (Interface.CallHook("OnLootSpawn", this) != null)
{
return;
}
this.PopulateLoot();
Interface.CallHook("OnLootSpawned", this);
if (this.shouldRefreshContents)
{
base.Invoke(new Action(this.SpawnLoot), UnityEngine.Random.Range(this.minSecondsBetweenRefresh, this.maxSecondsBetweenRefresh));
}
}