172 lines
3.7 KiB
Plaintext
172 lines
3.7 KiB
Plaintext
/*
|
|
* 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.
|
|
*/
|
|
|
|
class item_ammo:CBaseEntity
|
|
{
|
|
void(void) item_ammo;
|
|
virtual void(void) Respawn;
|
|
virtual void(void) touch;
|
|
};
|
|
|
|
void item_ammo::touch(void)
|
|
{
|
|
if not (other.flags & FL_CLIENT) {
|
|
return;
|
|
}
|
|
|
|
player pl = (player)other;
|
|
Sound_Play(other, CHAN_ITEM, "ammo.pickup");
|
|
Weapons_RefreshAmmo(pl);
|
|
Logging_Pickup(other, this, __NULL__);
|
|
|
|
if (cvar("sv_playerslots") == 1) {
|
|
remove(self);
|
|
} else {
|
|
Hide();
|
|
think = Respawn;
|
|
nextthink = time + 20.0f;
|
|
}
|
|
}
|
|
|
|
void item_ammo::Respawn(void)
|
|
{
|
|
SetSolid(SOLID_TRIGGER);
|
|
SetMovetype(MOVETYPE_TOSS);
|
|
SetSize([-16,-16,0],[16,16,16]);
|
|
SetOrigin(m_oldOrigin);
|
|
SetModel(m_oldModel);
|
|
|
|
think = __NULL__;
|
|
nextthink = -1;
|
|
Sound_Play(this, CHAN_ITEM, "ammo.respawn");
|
|
droptofloor();
|
|
}
|
|
|
|
void item_ammo::item_ammo(void)
|
|
{
|
|
m_oldModel = model;
|
|
SetModel(m_oldModel);
|
|
CBaseEntity::CBaseEntity();
|
|
}
|
|
|
|
/*QUAKED ammo_forks (0 0 0.8) (-16 -16 0) (16 16 32)
|
|
|
|
Household DEATH! (2003) ENTITY
|
|
|
|
Ammo for the throwable Forks.
|
|
A single fork, despite name. It's just a fork man.
|
|
|
|
*/
|
|
class ammo_forks:item_ammo
|
|
{
|
|
void(void) ammo_forks;
|
|
virtual void(void) touch;
|
|
};
|
|
|
|
void ammo_forks::ammo_forks(void)
|
|
{
|
|
model = "models/w_fork2.mdl";
|
|
item_ammo::item_ammo();
|
|
SetRenderMode(RM_FULLBRIGHT);
|
|
SetRenderAmt(1.0f);
|
|
}
|
|
void ammo_forks::touch(void)
|
|
{
|
|
if not (other.flags & FL_CLIENT) {
|
|
return;
|
|
}
|
|
if (other.classname == "player") {
|
|
player pl = (player)other;
|
|
if (pl.ammo_forks < MAX_A_FORKS) {
|
|
pl.ammo_forks = bound(0, pl.ammo_forks + 1, MAX_A_FORKS);
|
|
item_ammo::touch();
|
|
}
|
|
}
|
|
}
|
|
|
|
/*QUAKED ammo_legoblocks (0 0 0.8) (-16 -16 0) (16 16 32)
|
|
|
|
Household DEATH! (2003) ENTITY
|
|
|
|
Ammo for the Lego Launcher.
|
|
A single pack provides 12 legos.
|
|
|
|
*/
|
|
|
|
class ammo_legoblocks:item_ammo
|
|
{
|
|
void(void) ammo_legoblocks;
|
|
virtual void(void) touch;
|
|
};
|
|
|
|
void ammo_legoblocks::ammo_legoblocks(void)
|
|
{
|
|
model = "models/legoblocks.mdl";
|
|
item_ammo::item_ammo();
|
|
SetRenderMode(RM_FULLBRIGHT);
|
|
SetRenderAmt(1.0f);
|
|
}
|
|
void ammo_legoblocks::touch(void)
|
|
{
|
|
if not (other.flags & FL_CLIENT) {
|
|
return;
|
|
}
|
|
if (other.classname == "player") {
|
|
player pl = (player)other;
|
|
if (pl.ammo_legos < MAX_A_LEGOS) {
|
|
pl.ammo_legos = bound(0, pl.ammo_legos + 12, MAX_A_LEGOS);
|
|
item_ammo::touch();
|
|
}
|
|
}
|
|
}
|
|
|
|
/*QUAKED ammo_sodacans (0 0 0.8) (-16 -16 0) (16 16 32)
|
|
|
|
Household DEATH! (2003) ENTITY
|
|
|
|
Ammo for the Soda Launcher.
|
|
A single pack provides 6 soda cans.
|
|
|
|
*/
|
|
|
|
class ammo_sodacans:item_ammo
|
|
{
|
|
void(void) ammo_sodacans;
|
|
virtual void(void) touch;
|
|
};
|
|
|
|
void ammo_sodacans::ammo_sodacans(void)
|
|
{
|
|
model = "models/nukacola.mdl";
|
|
item_ammo::item_ammo();
|
|
SetRenderMode(RM_FULLBRIGHT);
|
|
SetRenderAmt(1.0f);
|
|
}
|
|
void ammo_sodacans::touch(void)
|
|
{
|
|
if not (other.flags & FL_CLIENT) {
|
|
return;
|
|
}
|
|
if (other.classname == "player") {
|
|
player pl = (player)other;
|
|
if (pl.ammo_soda < MAX_A_SODA) {
|
|
pl.ammo_soda = bound(0, pl.ammo_soda + 6, MAX_A_SODA);
|
|
item_ammo::touch();
|
|
}
|
|
}
|
|
}
|