{
TC(Inventory, this);
WriteHeader(MSG_ENTITY, ENT_CLIENT_INVENTORY);
- entity e = this.owner;
- if (IS_SPEC(e)) e = PS(e.enemy); // TODO: how can this *ever* be the case?
- TC(Player, e);
- Inventory data = e.inventory;
- Inventory_Write(data);
+ TC(PlayerState, this.owner);
+ Inventory_Write(this);
return true;
}
-void Inventory_new(entity e)
+bool Inventory_customize(entity this, entity client)
+{
+ // sends to spectators too!
+ return (PS(client) && PS(client).inventory == this);
+}
+
+void Inventory_new(PlayerState this)
{
Inventory inv = NEW(Inventory), bak = NEW(Inventory);
inv.inventory = bak;
- inv.drawonlytoclient = IS_CLIENT(e) ? e : e.m_client;
- Net_LinkEntity((inv.owner = e).inventory = inv, false, 0, Inventory_Send);
+ setcefc(inv, Inventory_customize);
+ Net_LinkEntity((inv.owner = this).inventory = inv, false, 0, Inventory_Send);
}
void Inventory_delete(entity e) { delete(e.inventory.inventory); delete(e.inventory); }
void Inventory_update(entity e) { e.inventory.SendFlags = 0xFFFFFF; }
#include "state.qh"
-void Inventory_new(entity this);
+void Inventory_new(PlayerState this);
void Inventory_delete(entity this);
void PlayerState_attach(entity this)