#endif
#ifdef CSQC
+#include <client/hud/panel/pickup.qh>
+
Inventory g_inventory;
+
void Inventory_remove(entity this)
{
if(g_inventory == this)
.int fld = inv_items[it.m_id];
int prev = this.(fld);
int next = this.(fld) = ReadByte();
+
+ Pickup_Update(it, next - prev);
LOG_DEBUGF("%s: %.0f -> %.0f", it.m_name, prev, next);
}
}
return true;
}
+
+NET_HANDLE(TE_CSQC_WEAPONPICKUP, bool isnew)
+{
+ const Weapon it = REGISTRY_GET(Weapons, ReadByte());
+ Pickup_Update(it, 1);
+ return true;
+}
#endif
#ifdef SVQC
{
Inventory inv = NEW(Inventory);
setcefc(inv, Inventory_customize);
- Net_LinkEntity((inv.owner = this).inventory = inv, false, 0, Inventory_Send);
+ this.inventory = inv;
+ inv.owner = this;
+ Net_LinkEntity(inv, false, 0, Inventory_Send);
}
+
void Inventory_delete(entity e) { delete(e.inventory); }
void Inventory_update(entity e) { e.inventory.SendFlags = 0xFFFFFF; }
+void Inventory_pickupitem(Pickup this, entity player)
+{
+ //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);
+}
+
void Inventory_clear(entity store)
{
// NOTE: you will need to perform Inventory_update after this to update the storage entity