nuclide/Source/server/valve/item_healthkit.cpp
Marco Hladik 9ce909e291 - Added Rewolf decore_* entities from the demo
- Added early Rewolf Health/Armor HUD variants
- Added original scoreboard from the early Half-Life versions for valve/scihunt/rewolf
- Fixed some skybox behaviour to only apply to BSP30
- Changed the env_message and game_text display to use "creditsfont" instead of the conchars
- Tweaked damage radius and prediction for some entities and weapons
- Added world_items
- Added item_healthkit
- Added item_battery
- Fixed level transition logic
- impulse 101 now fills up health and armor/suit in mod valve
- Some tweaks to Damage_Apply so that healing can be performed without funky visuals
- Added stub monsters for valve/rewolf that'll soon support scripted sequences
- Tweaked chat system to get rid of quotation marks around messages
- Added support for changing the window caption to reflect the mod you're playing
- Lots of small little things in terms of cleanup
2019-03-19 20:01:24 +01:00

58 lines
1.2 KiB
C++

/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class item_healthkit:CBaseEntity
{
void() item_healthkit;
virtual void() Respawn;
virtual void() touch;
};
void item_healthkit::touch(void)
{
if (other.classname == "player") {
if (other.health >= other.max_health) {
return;
}
Damage_Apply(other, this, -20, this.origin, TRUE);
sound(this, CHAN_ITEM, "items/smallmedkit1.wav", 1, ATTN_NORM);
if (cvar("sv_playerslots") == 1) {
remove(self);
} else {
Hide();
think = Respawn;
nextthink = time + 20.0f;
}
}
}
void item_healthkit::Respawn(void)
{
solid = SOLID_TRIGGER;
movetype = MOVETYPE_TOSS;
setmodel(this, m_oldModel);
setsize(this, [-8,-8,0], [8,8,48]);
setorigin(this, m_oldOrigin);
think = __NULL__;
nextthink = -1;
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150);
droptofloor();
}
void item_healthkit::item_healthkit(void)
{
precache_sound("items/smallmedkit1.wav");
precache_sound("items/suitchargeok1.wav");
model = "models/w_medkit.mdl";
CBaseEntity::CBaseEntity();
item_healthkit::Respawn();
}