gettouch(this)(this, actor);
}
-// if defaultrespawntime is 0 get respawntime from the item definition
-// if defaultrespawntimejitter is 0 get respawntimejitter from the item definition
-void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
+void StartItem(entity this, entity def)
{
+ if (def.m_spawnfunc_hookreplace)
+ def = def.m_spawnfunc_hookreplace(def, this);
+ this.itemdef = def;
+ if (def.m_canonical_spawnfunc != "") // FIXME why do weapons set itemdef to an entity that doesn't have this?
+ this.classname = def.m_canonical_spawnfunc;
+
string itemname = def.m_name;
float(entity player, entity item) pickupevalfunc = def.m_pickupevalfunc;
float pickupbasevalue = def.m_botvalue;
// must be done before Item_Reset() and after MUTATORBLOCKED check (blocked items may have null func ptrs)
if(!this.respawntime) // both need to be set
{
- this.respawntime = defaultrespawntime ? defaultrespawntime : def.m_respawntime();
- this.respawntimejitter = defaultrespawntimejitter ? defaultrespawntimejitter : def.m_respawntimejitter();
+ if (def.m_respawntime)
+ this.respawntime = def.m_respawntime();
+ else
+ LOG_WARNF("Default respawntime for a %s is unavailable from its itemdef", this.classname);
+
+ if (def.m_respawntimejitter)
+ this.respawntimejitter = def.m_respawntimejitter();
+ else
+ LOG_WARNF("Default respawntimejitter for a %s is unavailable from its itemdef", this.classname);
}
if(this.angles != '0 0 0')
setItemGroup(this);
}
-void StartItem(entity this, GameItem def)
-{
- def = def.m_spawnfunc_hookreplace(def, this);
-
- this.classname = def.m_canonical_spawnfunc;
-
- this.itemdef = def;
- _StartItem(this, this.itemdef, 0, 0);
-}
-
#define IS_SMALL(def) ((def.instanceOfHealth && def == ITEM_HealthSmall) || (def.instanceOfArmor && def == ITEM_ArmorSmall))
int group_count = 1;
bool autocvar_g_nodepthtestitems;
#define autocvar_g_weapon_stay cvar("g_weapon_stay")
-void StartItem(entity this, entity a);
-.int item_group;
-.int item_group_count;
-
float autocvar_sv_simple_items;
+
bool ItemSend(entity this, entity to, int sf);
const float ITEM_RESPAWN_TICKS = 10;
.bool is_item;
.entity itemdef;
-void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter);
+void StartItem(entity this, entity def);
+.int item_group;
+.int item_group_count;
void setItemGroup(entity this);
void setItemGroupCount();
else
this.glowmod = colormapPaletteColor(this.owner.clientcolors & 0x0F, true);
- GameItem def = wpn.m_pickup;
- this.itemdef = def;
- _StartItem(this, this.itemdef, this.respawntime, this.respawntimejitter);
+ StartItem(this, wpn.m_pickup);
#if 0 // WEAPONTODO
if (this.modelindex) { // don't precache if this was removed