Merging hungerbetter.diff by Xylemon
This commit is contained in:
parent
77712b77a2
commit
8b8b889f95
8 changed files with 356 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2019 Gethyn ThomasQuail <xylemon@posteo.net>
|
||||
* Copyright (c) 2019-2021 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
|
||||
|
@ -32,6 +32,7 @@ class ammo_egonclip:item_ammo
|
|||
void ammo_egonclip::ammo_egonclip(void)
|
||||
{
|
||||
model = "models/w_gas.mdl";
|
||||
Sound_Precache("ammo_gas.pickup");
|
||||
item_ammo::item_ammo();
|
||||
}
|
||||
void ammo_egonclip::touch(void)
|
||||
|
@ -43,8 +44,8 @@ void ammo_egonclip::touch(void)
|
|||
player pl = (player)other;
|
||||
if (pl.ammo_gas < MAX_A_GAS) {
|
||||
pl.ammo_gas = bound(0, pl.ammo_gas + 25, MAX_A_GAS);
|
||||
Sound_Play(other, CHAN_ITEM, "ammo_gas.pickup");
|
||||
item_ammo::touch();
|
||||
Sound_Play(other, CHAN_ITEM, "ammo_gas.pickup");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
146
src/server/gamerules.qc
Normal file
146
src/server/gamerules.qc
Normal file
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 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.
|
||||
*/
|
||||
|
||||
var int autocvar_th_medkitstyle = 0;
|
||||
var int autocvar_th_shovelstyle = 0;
|
||||
|
||||
void
|
||||
HLGameRules::LevelDecodeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_9mm = parm12;
|
||||
pl.ammo_357 = parm13;
|
||||
pl.ammo_buckshot = parm14;
|
||||
pl.ammo_m203_grenade = parm15;
|
||||
pl.ammo_bolt = parm16;
|
||||
pl.ammo_rocket = parm17;
|
||||
pl.ammo_uranium = parm18;
|
||||
pl.ammo_handgrenade = parm19;
|
||||
pl.ammo_satchel = parm20;
|
||||
pl.ammo_tripmine = parm21;
|
||||
pl.ammo_snark = parm22;
|
||||
pl.ammo_hornet = parm23;
|
||||
|
||||
pl.glock_mag = parm24;
|
||||
pl.mp5_mag = parm25;
|
||||
pl.python_mag = parm26;
|
||||
pl.shotgun_mag = parm27;
|
||||
pl.crossbow_mag = parm28;
|
||||
pl.rpg_mag = parm29;
|
||||
pl.satchel_chg = parm30;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelChangeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
parm12 = pl.ammo_9mm;
|
||||
parm13 = pl.ammo_357;
|
||||
parm14 = pl.ammo_buckshot;
|
||||
parm15 = pl.ammo_m203_grenade;
|
||||
parm16 = pl.ammo_bolt;
|
||||
parm17 = pl.ammo_rocket;
|
||||
parm18 = pl.ammo_uranium;
|
||||
parm19 = pl.ammo_handgrenade;
|
||||
parm20 = pl.ammo_satchel;
|
||||
parm21 = pl.ammo_tripmine;
|
||||
parm22 = pl.ammo_snark;
|
||||
parm23 = pl.ammo_hornet;
|
||||
parm24 = pl.glock_mag;
|
||||
parm25 = pl.mp5_mag;
|
||||
parm26 = pl.python_mag;
|
||||
parm27 = pl.shotgun_mag;
|
||||
parm28 = pl.crossbow_mag;
|
||||
parm29 = pl.rpg_mag;
|
||||
parm30 = pl.satchel_chg;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelNewParms(void)
|
||||
{
|
||||
parm1 = parm2 = parm3 = parm4 = parm5 = parm6 = parm7 =
|
||||
parm8 = parm9 = parm10 = parm11 = parm12 = parm13 = parm14 =
|
||||
parm15 = parm16 = parm17 = parm18 = parm19 = parm20 = parm21 =
|
||||
parm22 = parm23 = parm24 = parm25 = parm26 = parm27 = parm28 =
|
||||
parm29 = parm30 = 0;
|
||||
parm64 = FL_CLIENT;
|
||||
}
|
||||
|
||||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
HLGameRules::PlayerPostFrame(base_player pl)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerConnect(base_player pl)
|
||||
{
|
||||
if (Plugin_PlayerConnect(pl) == FALSE)
|
||||
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerDisconnect(base_player pl)
|
||||
{
|
||||
if (Plugin_PlayerDisconnect(pl) == FALSE)
|
||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||
|
||||
/* Make this unusable */
|
||||
pl.solid = SOLID_NOT;
|
||||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.modelindex = 0;
|
||||
pl.health = 0;
|
||||
pl.takedamage = 0;
|
||||
pl.SendFlags = -1;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerKill(base_player pl)
|
||||
{
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
103
src/server/item_healthkit.qc
Normal file
103
src/server/item_healthkit.qc
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2019-2021 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_healthkit (0 0 0.8) (-16 -16 0) (16 16 36)
|
||||
|
||||
HALF-LIFE (1998) ENTITY
|
||||
|
||||
Healthkit item.
|
||||
Adds 20 of health to the player.
|
||||
|
||||
*/
|
||||
class item_healthkit:CBaseEntity
|
||||
{
|
||||
void(void) item_healthkit;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(void) touch;
|
||||
};
|
||||
|
||||
void item_healthkit::touch(void)
|
||||
{
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cvar("th_medkitstyle") == 1) {
|
||||
player pl = (player)other;
|
||||
|
||||
/* If pl does not have WEAPON_MEDKIT, give it to them */
|
||||
if (!Weapons_IsPresent(pl, WEAPON_MEDKIT)) {
|
||||
Sound_Play(other, CHAN_ITEM, "weapon.pickup");
|
||||
Weapons_AddItem(pl, WEAPON_MEDKIT, -1);
|
||||
} else {
|
||||
/* don't remove item if we're already fully */
|
||||
if (pl.ammo_medkit >= MAX_A_MEDKIT)
|
||||
return;
|
||||
|
||||
/* otherwise, just give us ammo */
|
||||
pl.ammo_medkit = bound(0, pl.ammo_medkit + 1, MAX_A_MEDKIT);
|
||||
Sound_Play(other, CHAN_ITEM, "ammo.pickup");
|
||||
Weapons_RefreshAmmo(pl);
|
||||
Logging_Pickup(other, this, __NULL__);
|
||||
}
|
||||
} else {
|
||||
if (other.health >= other.max_health) {
|
||||
return;
|
||||
}
|
||||
|
||||
Damage_Apply(other, this, -20, 0, DMG_GENERIC);
|
||||
Sound_Play(this, CHAN_ITEM, "item.healthkit");
|
||||
Logging_Pickup(other, this, __NULL__);
|
||||
}
|
||||
|
||||
if (real_owner || cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 20.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void item_healthkit::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
SetSize([-16,-16,0],[16,16,16]);
|
||||
SetOrigin(m_oldOrigin);
|
||||
SetModel(m_oldModel);
|
||||
//botinfo = BOTINFO_HEALTH;
|
||||
|
||||
think = __NULL__;
|
||||
nextthink = -1;
|
||||
|
||||
if (!real_owner)
|
||||
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||
|
||||
droptofloor();
|
||||
}
|
||||
|
||||
void item_healthkit::item_healthkit(void)
|
||||
{
|
||||
Sound_Precache("ammo.pickup");
|
||||
Sound_Precache("item.healthkit");
|
||||
Sound_Precache("item.respawn");
|
||||
Sound_Precache("weapon.pickup");
|
||||
model = "models/w_medkit.mdl";
|
||||
CBaseEntity::CBaseEntity();
|
||||
item_healthkit::Respawn();
|
||||
}
|
|
@ -60,7 +60,7 @@
|
|||
../../../valve/src/server/items.qc
|
||||
../../../valve/src/server/item_longjump.qc
|
||||
../../../valve/src/server/item_suit.qc
|
||||
../../../valve/src/server/item_healthkit.qc
|
||||
item_healthkit.qc
|
||||
../../../valve/src/server/item_battery.qc
|
||||
../../../valve/src/server/item_weaponbox.qc
|
||||
../../../valve/src/server/world_items.qc
|
||||
|
|
|
@ -67,7 +67,11 @@ w_medkit_pickup(int new, int startammo)
|
|||
player pl = (player)self;
|
||||
|
||||
if (new) {
|
||||
if (cvar("th_shovelstyle") == 1) {
|
||||
pl.ammo_medkit = 1;
|
||||
} else {
|
||||
pl.ammo_medkit = 8;
|
||||
}
|
||||
} else {
|
||||
if (pl.ammo_medkit < MAX_A_MEDKIT) {
|
||||
pl.ammo_medkit = bound(0, pl.ammo_medkit + 8, MAX_A_MEDKIT);
|
||||
|
|
|
@ -80,7 +80,88 @@ w_shovel_holster(void)
|
|||
void
|
||||
w_shovel_primary(void)
|
||||
{
|
||||
w_crowbar_primary();
|
||||
int anim = 0;
|
||||
vector src;
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_MakeVectors();
|
||||
src = pl.origin + pl.view_ofs;
|
||||
|
||||
/* make sure we can gib corpses */
|
||||
int oldhitcontents = self.hitcontentsmaski;
|
||||
self.hitcontentsmaski = CONTENTBITS_POINTSOLID | CONTENTBIT_CORPSE;
|
||||
traceline(src, src + (v_forward * 32), FALSE, pl);
|
||||
self.hitcontentsmaski = oldhitcontents;
|
||||
|
||||
/* Stock shovel is exactly like umbrella
|
||||
* this cvar will spice things up a bit */
|
||||
if (serverkeyfloat("th_shovelstyle") == 1) {
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
Weapons_ViewPunchAngle([5,0,0]);
|
||||
pl.w_attack_next = 0.85f;
|
||||
} else {
|
||||
Weapons_ViewPunchAngle([-20,0,0]);
|
||||
pl.w_attack_next = 1.2f;
|
||||
}
|
||||
} else {
|
||||
if (trace_fraction >= 1.0) {
|
||||
pl.w_attack_next = 0.5f;
|
||||
} else {
|
||||
pl.w_attack_next = 0.25f;
|
||||
}
|
||||
}
|
||||
pl.w_idle_next = 2.5f;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(trace_fraction >= 1 ? CBAR_ATTACK1MISS:CBAR_ATTACK1HIT);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(trace_fraction >= 1 ? CBAR_ATTACK2MISS:CBAR_ATTACK2HIT);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(trace_fraction >= 1 ? CBAR_ATTACK3MISS:CBAR_ATTACK3HIT);
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
Animation_PlayerTopTemp(ANIM_SHOOTCROWBAR, 0.5f);
|
||||
} else {
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOTCROWBAR, 0.42f);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.miss");
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* don't bother with decals, we got squibs */
|
||||
if (trace_ent.iBleeds) {
|
||||
FX_Blood(trace_endpos, [1,0,0]);
|
||||
} else {
|
||||
FX_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
|
||||
}
|
||||
|
||||
if (trace_ent.takedamage) {
|
||||
if (serverkeyfloat("th_shovelstyle") == 1) {
|
||||
Damage_Apply(trace_ent, pl, Skill_GetValue("plr_crowbar", 10) * 2.0, WEAPON_CROWBAR, DMG_BLUNT);
|
||||
} else {
|
||||
Damage_Apply(trace_ent, pl, Skill_GetValue("plr_crowbar", 10), WEAPON_CROWBAR, DMG_BLUNT);
|
||||
}
|
||||
if (trace_ent.iBleeds) {
|
||||
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.hitbody");
|
||||
}
|
||||
} else {
|
||||
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.hit");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -41,6 +41,7 @@ enum
|
|||
WEAPON_MEDKIT
|
||||
};
|
||||
|
||||
/* Medkit ammo is 12 in stock, changed for multiplayer */
|
||||
#define MAX_A_9MM 250
|
||||
#define MAX_A_357 36
|
||||
#define MAX_A_AP9 200
|
||||
|
@ -57,4 +58,4 @@ enum
|
|||
#define MAX_A_TRIPMINE 10
|
||||
#define MAX_A_SNARK 10
|
||||
#define MAX_A_HORNET 8
|
||||
#define MAX_A_MEDKIT 12
|
||||
#define MAX_A_MEDKIT 8
|
||||
|
|
14
zpak001.pk3dir/particles/weapon_tripmine.cfg
Normal file
14
zpak001.pk3dir/particles/weapon_tripmine.cfg
Normal file
|
@ -0,0 +1,14 @@
|
|||
r_part beam
|
||||
{
|
||||
texture "particles/fteparticlefont.tga"
|
||||
tcoords 97 97 191 191 256
|
||||
scale 1
|
||||
scaledelta 0.5
|
||||
alpha 0.4
|
||||
step 4
|
||||
randomvel 0
|
||||
rgb 200 0 0
|
||||
rgbdelta 0 -150 -150
|
||||
type beam
|
||||
blend add
|
||||
}
|
Loading…
Reference in a new issue