hhdeath/src/server/item_rune_haste.qc

99 lines
2.5 KiB
C++

/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*QUAKED item_rune_haste (0 0 0.8) (-16 -16 0) (16 16 36)
Household DEATH! (2003) ENTITY
Haste Rune
Doubles the player's speed for 30 seconds.
*/
class item_rune_haste:CBaseTrigger
{
void(void) item_rune_haste;
virtual void(void) touch;
virtual void(void) Respawn;
};
void
item_rune_haste::touch(void)
{
if (other.classname != "player") {
return;
}
/* Make sure we don't have more than one powerup */
player pl = (player)other;
if (pl.g_items & ITEM_MACHETTE) {
return;
}
if (pl.g_items & ITEM_RUNE_HASTE) {
return;
}
Logging_Pickup(other, this, __NULL__);
/* Replace with proper sounds
* sound(other, CHAN_ITEM, "fvox/bell.wav", 1, ATTN_NORM);
sound(other, CHAN_VOICE, "fvox/hev_logon.wav", 1, ATTN_NORM); */
pl.g_items |= ITEM_RUNE_HASTE;
pl.powerup_time = 30.0f;
CBaseTrigger::UseTargets(this, TRIG_TOGGLE, 0.0f);
if (cvar("sv_playerslots") == 1) {
remove(self);
} else {
Hide();
think = Respawn;
nextthink = time + 30.0f;
}
}
void
item_rune_haste::Respawn(void)
{
SetSolid(SOLID_TRIGGER);
SetMovetype(MOVETYPE_NONE);
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
SetOrigin(m_oldOrigin);
SetModel(m_oldModel);
think = __NULL__;
nextthink = -1;
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150);
}
void
item_rune_haste::item_rune_haste(void)
{
/* Powerups have a base model always visable */
entity base = spawn();
setorigin(base, this.origin);
precache_model("models/rune_stand.mdl");
setmodel(base, "models/rune_stand.mdl");
model = "models/rune_haste.mdl";
precache_sound("items/suitchargeok1.wav");
precache_sound("fvox/hev_logon.wav");
precache_sound("fvox/bell.wav");
CBaseTrigger::CBaseTrigger();
}