Counter-Strike: Add item_suit, so that the training works again.
This commit is contained in:
parent
0968ee7756
commit
15181308f8
3 changed files with 105 additions and 37 deletions
66
src/server/cstrike/item_suit.cpp
Normal file
66
src/server/cstrike/item_suit.cpp
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2019 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* 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_suit:CBaseTrigger
|
||||
{
|
||||
void() item_suit;
|
||||
|
||||
virtual void() touch;
|
||||
virtual void() Respawn;
|
||||
};
|
||||
|
||||
void item_suit::touch(void)
|
||||
{
|
||||
if (other.classname == "player") {
|
||||
player pl = (player)other;
|
||||
/*if (pl.g_items & ITEM_SUIT) {
|
||||
return;
|
||||
}*/
|
||||
sound(other, CHAN_ITEM, "items/tr_kevlar.wav", 1, ATTN_NORM);
|
||||
/*pl.g_items |= ITEM_SUIT;*/
|
||||
|
||||
CBaseTrigger::UseTargets();
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 30.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void item_suit::Respawn(void)
|
||||
{
|
||||
solid = SOLID_TRIGGER;
|
||||
movetype = MOVETYPE_TOSS;
|
||||
setsize(this, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
setorigin(this, m_oldOrigin);
|
||||
setmodel(this, m_oldModel);
|
||||
|
||||
think = __NULL__;
|
||||
nextthink = -1;
|
||||
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150);
|
||||
}
|
||||
|
||||
void item_suit::item_suit(void)
|
||||
{
|
||||
model = "models/w_kevlar.mdl";
|
||||
precache_sound("items/tr_kevlar.wav");
|
||||
CBaseTrigger::CBaseTrigger();
|
||||
Respawn();
|
||||
}
|
|
@ -63,6 +63,7 @@ money.c
|
|||
armoury_entity.cpp
|
||||
hostage_entity.cpp
|
||||
func_hostage_rescue.cpp
|
||||
item_suit.cpp
|
||||
info_hostage_rescue.cpp
|
||||
func_vip_safetyzone.cpp
|
||||
info_map_parameters.cpp
|
||||
|
|
|
@ -17,17 +17,17 @@
|
|||
class item_weaponbox
|
||||
{
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
int ammo_buckshot;
|
||||
int ammo_m203_grenade;
|
||||
int ammo_bolt;
|
||||
int ammo_rocket;
|
||||
int ammo_uranium;
|
||||
int ammo_handgrenade;
|
||||
int ammo_satchel;
|
||||
int ammo_tripmine;
|
||||
int ammo_snark;
|
||||
int ammo_hornet;
|
||||
int ammo_357;
|
||||
int ammo_buckshot;
|
||||
int ammo_m203_grenade;
|
||||
int ammo_bolt;
|
||||
int ammo_rocket;
|
||||
int ammo_uranium;
|
||||
int ammo_handgrenade;
|
||||
int ammo_satchel;
|
||||
int ammo_tripmine;
|
||||
int ammo_snark;
|
||||
int ammo_hornet;
|
||||
int weapon_items;
|
||||
|
||||
void(void) item_weaponbox;
|
||||
|
@ -40,22 +40,23 @@ void item_weaponbox::touch(void)
|
|||
if (other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
player pl = (player)other;
|
||||
sound(pl, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM);
|
||||
pl.ammo_9mm += ammo_9mm;
|
||||
pl.ammo_357 += ammo_357;
|
||||
pl.ammo_buckshot += ammo_buckshot;
|
||||
pl.ammo_m203_grenade += ammo_m203_grenade;
|
||||
pl.ammo_bolt += ammo_bolt;
|
||||
pl.ammo_rocket += ammo_rocket;
|
||||
pl.ammo_uranium += ammo_uranium;
|
||||
pl.ammo_handgrenade += ammo_handgrenade;
|
||||
pl.ammo_satchel += ammo_satchel;
|
||||
pl.ammo_tripmine += ammo_tripmine;
|
||||
pl.ammo_snark += ammo_snark;
|
||||
pl.ammo_hornet += ammo_hornet;
|
||||
pl.g_items |= weapon_items;
|
||||
remove(this);
|
||||
pl.ammo_357 += ammo_357;
|
||||
pl.ammo_buckshot += ammo_buckshot;
|
||||
pl.ammo_m203_grenade += ammo_m203_grenade;
|
||||
pl.ammo_bolt += ammo_bolt;
|
||||
pl.ammo_rocket += ammo_rocket;
|
||||
pl.ammo_uranium += ammo_uranium;
|
||||
pl.ammo_handgrenade += ammo_handgrenade;
|
||||
pl.ammo_satchel += ammo_satchel;
|
||||
pl.ammo_tripmine += ammo_tripmine;
|
||||
pl.ammo_snark += ammo_snark;
|
||||
pl.ammo_hornet += ammo_hornet;
|
||||
pl.g_items |= weapon_items;
|
||||
remove(this);
|
||||
}
|
||||
|
||||
void item_weaponbox::setup(player pl)
|
||||
|
@ -63,23 +64,23 @@ void item_weaponbox::setup(player pl)
|
|||
/* TODO: Should the magazine bits be transferred too? */
|
||||
ammo_9mm = pl.ammo_9mm;
|
||||
ammo_357 = pl.ammo_357;
|
||||
ammo_buckshot = pl.ammo_buckshot;
|
||||
ammo_m203_grenade = pl.ammo_m203_grenade;
|
||||
ammo_bolt = pl.ammo_bolt;
|
||||
ammo_rocket = pl.ammo_rocket;
|
||||
ammo_uranium = pl.ammo_uranium;
|
||||
ammo_handgrenade = pl.ammo_handgrenade;
|
||||
ammo_satchel = pl.ammo_satchel;
|
||||
ammo_tripmine = pl.ammo_tripmine;
|
||||
ammo_snark = pl.ammo_snark;
|
||||
ammo_hornet = pl.ammo_hornet;
|
||||
weapon_items = pl.g_items;
|
||||
ammo_buckshot = pl.ammo_buckshot;
|
||||
ammo_m203_grenade = pl.ammo_m203_grenade;
|
||||
ammo_bolt = pl.ammo_bolt;
|
||||
ammo_rocket = pl.ammo_rocket;
|
||||
ammo_uranium = pl.ammo_uranium;
|
||||
ammo_handgrenade = pl.ammo_handgrenade;
|
||||
ammo_satchel = pl.ammo_satchel;
|
||||
ammo_tripmine = pl.ammo_tripmine;
|
||||
ammo_snark = pl.ammo_snark;
|
||||
ammo_hornet = pl.ammo_hornet;
|
||||
weapon_items = pl.g_items;
|
||||
}
|
||||
|
||||
void item_weaponbox::item_weaponbox(void)
|
||||
{
|
||||
setmodel(this, "models/w_weaponbox.mdl");
|
||||
setsize(this, [-16,-16,0], [16,16,16]);
|
||||
setsize(this, [-16,-16,0], [16,16,16]);
|
||||
solid = SOLID_TRIGGER;
|
||||
movetype = MOVETYPE_TOSS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue