X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fitems%2Fitem%2Fpickup.qc;h=a3c2d779edcde089ac3d4f7e142693de8e47070b;hb=da62f34a13a4c4349b1983b608c7a84e3bf2cea8;hp=fc958709e87d66af6eb50b958ce71ab8ef8f11b2;hpb=101e31b5eb1dbfb7dc526ba23b29a706201a67aa;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/items/item/pickup.qc b/qcsrc/common/items/item/pickup.qc index fc958709e..a3c2d779e 100644 --- a/qcsrc/common/items/item/pickup.qc +++ b/qcsrc/common/items/item/pickup.qc @@ -1,7 +1,22 @@ #include "pickup.qh" +#include #ifdef SVQC bool ITEM_HANDLE(Pickup, entity this, entity item, entity player) { return this.giveTo(this, item, player); } + +METHOD(Pickup, giveTo, bool(Pickup this, entity item, entity player)) +{ + TC(Pickup, this); + bool b = Item_GiveTo(item, player); + if (b) { + //LOG_DEBUGF("entity %i picked up %s", player, this.m_name); + entity store = IS_PLAYER(player) ? PS(player) : player; + store.inventory.inv_items[this.m_id]++; + Inventory_update(store); + } + return b; +} + #endif