nuclide/Source/server/valve/items.cpp
Marco Hladik 75bed53adc Client: We're now reading skyname and setting the skybox (with fallback) in CSQC. Much rejoice
Added item_suit and item_longjump... they do not do anything interesting yet.
Decals: Added glass break decals upon impact
Damage: Brush-entity radius damage should to work better now
Also seperated the weapons table from generic weapon entry functions. This should make maintaining mods easier
Fixed references from sv_clientslots to sv_playerslots. My brain gets confused between the Quake games at this point. I blame FTE
Fixed sprite animation cycle length check. It attempted to play one more frame than any sprite ever has. Needs more heavy testing?
2019-03-14 20:13:02 +01:00

70 lines
1.3 KiB
C++

/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
/* PICKUP ITEMS */
class item_pickup:CBaseEntity
{
int id;
void() item_pickup;
virtual void() touch;
virtual void(int i) setitem;
virtual void() Respawn;
};
void item_pickup::touch(void)
{
if (other.classname == "player") {
if (Weapons_IsPresent((player)other, id) == TRUE) {
return;
}
sound(other, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM);
Weapons_AddItem((player)other, id);
if (cvar("sv_playerslots") == 1) {
remove(self);
} else {
Hide();
think = Respawn;
nextthink = time + 30.0f;
}
}
}
void item_pickup::setitem(int i)
{
id = i;
m_oldModel = Weapons_GetWorldmodel(id);
setmodel(this, m_oldModel);
}
void item_pickup::Respawn(void)
{
solid = SOLID_TRIGGER;
movetype = MOVETYPE_TOSS;
setorigin(this, m_oldOrigin);
/* At some points, the item id might not yet be set */
if (m_oldModel) {
setmodel(this, m_oldModel);
}
setsize(this, [-24,-24,0], [24,24,48]);
think = __NULL__;
nextthink = -1;
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150);
droptofloor();
}
void item_pickup::item_pickup(void)
{
precache_sound("items/suitchargeok1.wav");
CBaseEntity::CBaseEntity();
Respawn();
}