Hi,
You probably have plenty to do but what i'm trying, maybe a trivial task for you is something i struggle with right now.
I'm trying to detect when a player loots an item, say scrap for example. I want to track the item name and amount.
For OnLootEntityEnd, OnDispenserGather and OnDispenserBonus i get it, i just take the BaseEntity and the Item, and do some checks like this for example:
void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item _item)
{
if (!entity.ToPlayer()) return;
var player = AwesomeFindExistingPlayerMethod(entity.ToPlayer().UserIDString);
if (player == null) return;
if (_item == null || _item.info == null || _item.info.name == null) return;
if (_item.info.name.EndsWith(".item"))
{
DoAwesomeMethodOnLoot(_item, entity.ToPlayer());
}
}But how would i go forward getting the item the player loots, and the amount?
I'm currently looking at this hook
OnInventoryNetworkUpdate(PlayerInventory inventory, ItemContainer container, ProtoBuf.UpdateItemContainer updateItemContainer, PlayerInventory.Type type, bool broadcast)Anybody that can save me some headache? :D help is much appreciated. Cheers.