prozac-qfcc/player.qc

1588 lines
42 KiB
C++
Raw Normal View History

2001-07-17 05:58:10 +00:00
/*======================================================
PLAYER.QC Custom TeamFortress v3.1
(c) TeamFortress Software Pty Ltd 29/2/97
(c) William Kerney 5/21/00
(c) Craig Hauser 19/3/00
========================================================
Handles all player animations, death and etc. Most weapon
firings get shunted through here.
======================================================*/
#include "defs.qh"
2001-07-17 05:58:10 +00:00
/*
Heavily Modified for TeamFortress V1.21
TeamFortress Software
Robin Walker, John Cook, Ian Caughley
*/
// Prototypes
void() bubble_bob;
2004-02-17 00:14:14 +00:00
void(float num) W_FireAssaultCannon;
2001-07-17 05:58:10 +00:00
void() W_FireLightAssault;
void() Throw_Grapple;
// TeamFortress Prototypes
void() BioInfection_Decay;
void() TeamFortress_RemoveTimers;
void() T_Dispenser;
void() Headless_Think;
/*
==============================================================================
PLAYER
==============================================================================
*/
$cd /raid/quake/id1/models/player_4
$origin 0 -6 24
$base base
$skin skin
//
// running
//
$frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
$frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
//
// standing
//
$frame stand1 stand2 stand3 stand4 stand5
$frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
$frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
//
// pain
//
$frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
$frame pain1 pain2 pain3 pain4 pain5 pain6
//
// death
//
$frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
$frame axdeth7 axdeth8 axdeth9
$frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
$frame deatha9 deatha10 deatha11
$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
$frame deathb9
$frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
$frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
$frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
$frame deathd8 deathd9
$frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
$frame deathe8 deathe9
//
// attacks
//
$frame nailatt1 nailatt2
$frame light1 light2
$frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
$frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
$frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
$frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
$frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
/*
==============================================================================
PLAYER
==============================================================================
*/
void() player_touch =
{
local entity Bio;
1) Attempted to give players positive frags whenever possible. You now should get frags for blowing people up with others' dispensers/mines/expbody, airfisting rockets, etc. 2) Redid Give_Frags_Out 3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents and checkmove, now a lot cleaner and less buggy 4) You can grapple builds again. This caused really odd bugs. 5) You can now damage your own buildings again (gasp). Any time a tesla or sentry is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK and counter-spy mechanism. 6) Teslas are now entirely inside their bounding box 7) Now check every frame for players startsolid and for outside of the map cube. 8) #define WALL_HURT to make it hurt when you hit a wall 9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying 10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier. demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy gets extra grenade. 11) New and improved EMP grenade now does damage based on range. no longer blows up shells. Doesn't directly damage sentries anymore, but does significant damage to dispensers. EMP someone who's setting a det and it blows up in their face. 12) Players now do radius damage from getting EMPed (again) 13) EMPs now go through walls (again) 14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100 15) You can only have 2 frag grens, 3 with bandolier now. 16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug where their charge wasn't restored when you die is fixed now. 17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time, with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably more time the closer it is to the EMP. 18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the attacker loses 3 seconds of attack. 19) Judo missing now makes them unable to fire. 20) Shortened judo range (back to normal if w/ close combat) 21) Attempted to rework the railgun. Seems to be okay now. Probably still a lot of bugs in here, but since this is the devel version I thought I would commit all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
// are we stuck inside another object?
if (other.solid != SOLID_BSP && hullpointcontents(other, self.mins, self.maxs, self.origin) == CONTENTS_SOLID)
{
deathmsg = DMSG_PHYSICS;
if (other.takedamage) // kill it! aaah!
TF_T_Damage(other, NIL, NIL, other.health + 100, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
else
TF_T_Damage(self, NIL, NIL, other.health + 100, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
return;
}
2001-07-17 05:58:10 +00:00
// Spies and Scouts can uncloak enemy spies
// WK Or those with Spy kits & Scanners
if (invis_only == FALSE && (self.cutf_items & CUTF_SPY_KIT || other.cutf_items & CUTF_SPY_KIT))
2001-07-17 05:58:10 +00:00
{
if (other.classname == "player")
{
if (self.undercover_team != 0 || self.undercover_skin != 0)
{
if ((other.cutf_items & CUTF_SPY_KIT || other.tf_items & NIT_SCANNER) && !Teammate(self.team_no,other.team_no))
2001-07-17 05:58:10 +00:00
{
sprint(other, PRINT_HIGH, "Wait a minute... he's a Spy!\n");
sprint(self, PRINT_HIGH, "The enemy sees through your disguise!\n");
2001-07-17 05:58:10 +00:00
Spy_RemoveDisguise(self);
}
}
if (other.undercover_team != 0 || other.undercover_skin != 0)
{
if ((self.cutf_items & CUTF_SPY_KIT || self.tf_items & NIT_SCANNER) && !Teammate(other.team_no,self.team_no))
2001-07-17 05:58:10 +00:00
{
sprint(self, PRINT_HIGH, "Wait a minute... he's a Spy!\n");
sprint(other, PRINT_HIGH, "The enemy sees through your disguise!\n");
2001-07-17 05:58:10 +00:00
Spy_RemoveDisguise(other);
}
}
}
}
// Pass on infections
if (self.tfstate & TFSTATE_INFECTED)
2001-07-17 05:58:10 +00:00
{
//WK Melee armor stops infections from spreading
if (other.classname == "player" && !(other.invincible_finished) && !(other.armorclass & AT_SAVEMELEE))
2001-07-17 05:58:10 +00:00
{
// may sure other player is not already infected
if (!(other.tfstate & TFSTATE_INFECTED))
2001-07-17 05:58:10 +00:00
{
// can't infect the medic
if (!(other.weapons_carried & WEAP_MEDIKIT)) //WK
2001-07-17 05:58:10 +00:00
{
// infect 'em
Bio = spawn ();
Bio.nextthink = 2;
Bio.think = BioInfection_Decay;
/* WK Why doesn't this work??? Causes occasional program crashes...
//WK The owner is the original medic if spreading to friend
if (self.team_no == other.team_no) {
te = find(NIL, netname, "biotimer");
while ((te.owner != self) && (te))
2001-07-17 05:58:10 +00:00
te = find(te, netname, "biotimer");
if (te)
2001-07-17 05:58:10 +00:00
Bio.enemy = te.enemy; //Person infecting
else
RPrint("CustomTF: Odd Behavior in infection spreading");
}
else */
Bio.enemy = self; //Person causing infection
Bio.owner = other; //Person getting hurt
Bio.classname = "timer";
Bio.netname = "biotimer";
other.tfstate = other.tfstate | TFSTATE_INFECTED;
2001-07-17 05:58:10 +00:00
other.infection_team_no = self.infection_team_no;
sprint(other, PRINT_MEDIUM, "You have been infected by ");
sprint(other, PRINT_MEDIUM, self.netname);
sprint(other, PRINT_MEDIUM, "!\n");
sprint(self, PRINT_MEDIUM, "You have infected ");
sprint(self, PRINT_MEDIUM, other.netname);
sprint(self, PRINT_MEDIUM, "!\n");
2001-07-17 05:58:10 +00:00
//-OfN
teamprefixsprint(other.team_no,other);
teamsprint(other.team_no,other, other.netname);
teamsprint(other.team_no,other, " has been infected!\n");
}
}
}
}
#ifdef PLAYER_PUSHING
if (other.classname == "player")
{
if (Teammate(self.team_no, other.team_no))
{
v1 = vlen(other.velocity);
if (v1 < 50)
{
v2 = vlen(self.velocity);
if (v2 > 55 || (self.items & (IT_KEY1 | IT_KEY2)))
2001-07-17 05:58:10 +00:00
{
makevectors(self.angles);
traceline (self.origin, self.origin + v_forward*32, FALSE, self);
2001-07-17 05:58:10 +00:00
if (trace_ent == other)
{
if (self.items & (IT_KEY1 | IT_KEY2))
2001-07-17 05:58:10 +00:00
other.velocity = other.velocity + (normalize(self.velocity) * 120);
else if (!(other.items & (IT_KEY1 | IT_KEY2)))
2001-07-17 05:58:10 +00:00
other.velocity = other.velocity + (normalize(self.velocity) * 30);
}
}
}
}
}
#endif
};
void() player_run;
void() player_stand1 =[ $axstnd1, player_stand1 ]
{
self.weaponframe=0;
if (self.velocity_x || self.velocity_y)
{
self.walkframe=0;
player_run();
return;
}
if (self.current_weapon <= WEAP_AXE)
2001-07-17 05:58:10 +00:00
{
if (self.walkframe >= 12)
self.walkframe = 0;
self.frame = $axstnd1 + self.walkframe;
}
else
{
if (self.walkframe >= 5)
self.walkframe = 0;
self.frame = $stand1 + self.walkframe;
}
self.walkframe = self.walkframe + 1;
};
void() player_run =[ $rockrun1, player_run ]
{
self.weaponframe=0;
if (!self.velocity_x && !self.velocity_y)
{
self.walkframe=0;
player_stand1();
return;
}
if (self.current_weapon <= WEAP_AXE)
2001-07-17 05:58:10 +00:00
{
if (self.walkframe >= 6)
self.walkframe = 0;
self.frame = $axrun1 + self.walkframe;
}
else
{
if (self.walkframe >= 6)
self.walkframe = 0;
self.frame = self.frame + self.walkframe;
}
self.walkframe = self.walkframe + 1;
};
void() player_shot1 = [$shotatt1, player_shot2 ] {self.weaponframe=1;muzzleflash();};
void() player_shot2 = [$shotatt2, player_shot3 ] {self.weaponframe=2;};
void() player_shot3 = [$shotatt3, player_shot4 ] {self.weaponframe=3;};
void() player_shot4 = [$shotatt4, player_shot5 ] {self.weaponframe=4;};
void() player_shot5 = [$shotatt5, player_shot6 ] {self.weaponframe=5;};
void() player_shot6 = [$shotatt6, player_run ] {self.weaponframe=6;};
#ifndef NO_AUTORIFLE
2001-07-17 05:58:10 +00:00
void() player_autorifle1 = [$shotatt1, player_autorifle2 ] {self.weaponframe=1; muzzleflash(); };
void() player_autorifle2 = [$shotatt2, player_autorifle3 ] {self.weaponframe=2;};
void() player_autorifle3 = [$shotatt6, player_run ] {self.weaponframe=6;};
#endif
2001-07-17 05:58:10 +00:00
void() player_axe1 = [$axatt1, player_axe2 ] {self.weaponframe=1;};
void() player_axe2 = [$axatt2, player_axe3 ] {self.weaponframe=2;};
void() player_axe3 = [$axatt3, player_axe4 ]
{
self.weaponframe=3;
if (self.current_weapon == WEAP_AXE)
2001-07-17 05:58:10 +00:00
W_FireAxe();
else // if (self.current_weapon == WEAP_SPANNER)
2001-07-17 05:58:10 +00:00
W_FireSpanner();
};
void() player_axe4 = [$axatt4, player_run ] {self.weaponframe=4;};
void() player_axeb1 = [$axattb1, player_axeb2 ] {self.weaponframe=5;};
void() player_axeb2 = [$axattb2, player_axeb3 ] {self.weaponframe=6;};
void() player_axeb3 = [$axattb3, player_axeb4 ]
{
self.weaponframe=7;
if (self.current_weapon == WEAP_AXE)
2004-03-23 04:29:46 +00:00
W_FireBackstab();
else // if (self.current_weapon == WEAP_SPANNER)
2001-07-17 05:58:10 +00:00
W_FireSpanner();
};
void() player_axeb4 = [$axattb4, player_run ] {self.weaponframe=8;};
void() player_axec1 = [$axattc1, player_axec2 ] {self.weaponframe=1;};
void() player_axec2 = [$axattc2, player_axec3 ] {self.weaponframe=2;};
void() player_axec3 = [$axattc3, player_axec4 ]
{
self.weaponframe=3;
if (self.current_weapon == WEAP_AXE)
2001-07-17 05:58:10 +00:00
W_FireAxe();
else // if (self.current_weapon == WEAP_SPANNER)
2001-07-17 05:58:10 +00:00
W_FireSpanner();
};
void() player_axec4 = [$axattc4, player_run ] {self.weaponframe=4;};
void() player_axed1 = [$axattd1, player_axed2 ] {self.weaponframe=5;};
void() player_axed2 = [$axattd2, player_axed3 ] {self.weaponframe=6;};
void() player_axed3 = [$axattd3, player_axed4 ]
{
self.weaponframe=7;
if (self.current_weapon == WEAP_AXE)
2004-03-23 04:29:46 +00:00
W_FireBackstab();
else // if (self.current_weapon == WEAP_SPANNER)
2001-07-17 05:58:10 +00:00
W_FireSpanner();
};
void() player_axed4 = [$axattd4, player_run ] {self.weaponframe=8;};
//=========================
// QW Grappling hook frames
void() player_chain1= [$axattd1, player_chain1a] {self.weaponframe=1;Throw_Grapple();};
void() player_chain1a= [$axattd1, player_chain2 ] {self.weaponframe=2;};
void() player_chain2= [$axattd2, player_chain2a] {self.weaponframe=3;};
void() player_chain2a= [$axattd2, player_chain3 ] {self.weaponframe=4;};
void() player_chain3= [$axattd3, player_chain3 ]
{
self.weaponframe=6;
if (!self.hook_out)
{
player_chain5();
return;
}
if (vlen(self.velocity) >= 750)
{
player_chain4();
return;
}
};
void() player_chain4= [$deathc4, player_chain4 ]
{
self.weaponframe=6;
if (!self.hook_out)
{
player_chain5();
return;
}
if (vlen(self.velocity) < 750)
{
player_chain3();
return;
}
};
void() player_chain5= [$axattd4, player_run ] {self.weaponframe=0;};
// newstuff
void() player_medikit1 = [$axatt1, player_medikit2 ] {self.weaponframe=1;};
void() player_medikit2 = [$axatt2, player_medikit3 ] {self.weaponframe=2;};
void() player_medikit3 = [$axatt3, player_medikit4 ] {self.weaponframe=3;W_FireMedikit(FALSE);};
2001-07-17 05:58:10 +00:00
void() player_medikit4 = [$axatt4, player_run ] {self.weaponframe=4;};
void() player_medikitb1 = [$axattb1, player_medikitb2 ] {self.weaponframe=5;};
void() player_medikitb2 = [$axattb2, player_medikitb3 ] {self.weaponframe=6;};
void() player_medikitb3 = [$axattb3, player_medikitb4 ] {self.weaponframe=7;W_FireMedikit(FALSE);};
2001-07-17 05:58:10 +00:00
void() player_medikitb4 = [$axattb4, player_run ] {self.weaponframe=8;};
void() player_medikitc1 = [$axattc1, player_medikitc2 ] {self.weaponframe=1;};
void() player_medikitc2 = [$axattc2, player_medikitc3 ] {self.weaponframe=2;};
void() player_medikitc3 = [$axattc3, player_medikitc4 ] {self.weaponframe=3;W_FireMedikit(FALSE);};
2001-07-17 05:58:10 +00:00
void() player_medikitc4 = [$axattc4, player_run ] {self.weaponframe=4;};
void() player_medikitd1 = [$axattd1, player_medikitd2 ] {self.weaponframe=5;};
void() player_medikitd2 = [$axattd2, player_medikitd3 ] {self.weaponframe=6;};
void() player_medikitd3 = [$axattd3, player_medikitd4 ] {self.weaponframe=7;W_FireMedikit(FALSE);};
2001-07-17 05:58:10 +00:00
void() player_medikitd4 = [$axattd4, player_run ] {self.weaponframe=8;};
void() player_bioweapon1 = [$axatt1, player_bioweapon2 ] {self.weaponframe=1;};
void() player_bioweapon2 = [$axatt2, player_bioweapon3 ] {self.weaponframe=2;};
void() player_bioweapon3 = [$axatt3, player_bioweapon4 ] {self.weaponframe=3;W_FireBioweapon();};
void() player_bioweapon4 = [$axatt4, player_run ] {self.weaponframe=4;};
void() player_bioweaponb1 = [$axattb1, player_bioweaponb2 ] {self.weaponframe=5;};
void() player_bioweaponb2 = [$axattb2, player_bioweaponb3 ] {self.weaponframe=6;};
void() player_bioweaponb3 = [$axattb3, player_bioweaponb4 ] {self.weaponframe=7;W_FireBioweapon();};
void() player_bioweaponb4 = [$axattb4, player_run ] {self.weaponframe=8;};
void() player_bioweaponc1 = [$axattc1, player_bioweaponc2 ] {self.weaponframe=1;};
void() player_bioweaponc2 = [$axattc2, player_bioweaponc3 ] {self.weaponframe=2;};
void() player_bioweaponc3 = [$axattc3, player_bioweaponc4 ] {self.weaponframe=3;W_FireBioweapon();};
void() player_bioweaponc4 = [$axattc4, player_run ] {self.weaponframe=4;};
void() player_bioweapond1 = [$axattd1, player_bioweapond2 ] {self.weaponframe=5;};
void() player_bioweapond2 = [$axattd2, player_bioweapond3 ] {self.weaponframe=6;};
void() player_bioweapond3 = [$axattd3, player_bioweapond4 ] {self.weaponframe=7;W_FireBioweapon();};
void() player_bioweapond4 = [$axattd4, player_run ] {self.weaponframe=8;};
//============================================================================
void() player_snail1 =[ $nailatt1, player_snail2 ]
{
if (!self.button0 || intermission_running)
{player_run ();return;}
//WK
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;
if (self.attack_finished > time)
return;
muzzleflash();
/*self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;*/
SuperDamageSound();
W_FireSpikes (4);
//Attack_Finished(0.1);
Attack_Finished(0.2);
};
//- OfN -
void() player_snail2 =[ $nailatt2, player_snail1 ]
{
/*if (!self.button0 || intermission_running)
{player_run ();return;}*/
//WK
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;
/*if (self.attack_finished > time)
return;*/
/*self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;*/
//SuperDamageSound();
// if (random() < 0.5) W_FireSpikes (4);
//Attack_Finished(0.2);
//Attack_Finished(0.1);
};
void() player_nail1 =[ $nailatt1, player_nail2 ]
{
if (!self.button0 || intermission_running)
{player_run ();return;}
//WK
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;
if (self.attack_finished > time)
return;
muzzleflash();
/*self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;*/
SuperDamageSound();
W_FireSpikes (4);
//Attack_Finished(0.1);
Attack_Finished(0.2);
};
//- OfN -
void() player_nail2 =[ $nailatt2, player_nail3 ]
{
/*if (!self.button0 || intermission_running)
{player_run ();return;}*/
//WK
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;
/*if (self.attack_finished > time)
return;*/
/*self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;*/
//SuperDamageSound();
// if (random() < 0.5) W_FireSpikes (4);
//Attack_Finished(0.2);
//Attack_Finished(0.1);
};
void() player_nail3 =[ $nailatt1, player_nail4 ]
{
if (!self.button0 || intermission_running)
{player_run ();return;}
//WK
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;
if (self.attack_finished > time)
return;
/*self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;*/
muzzleflash();
SuperDamageSound();
W_FireSpikes (-4);
//Attack_Finished(0.2);
Attack_Finished(0.2);
};
void() player_nail4 =[ $nailatt2, player_nail1 ]
{
/*if (!self.button0 || intermission_running)
{player_run ();return;}*/
//WK
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;
/*if (self.attack_finished > time)
return;*/
/*self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;*/
//SuperDamageSound();
// if (random() < 0.5) W_FireSpikes (-4);
//Attack_Finished(0.2);
//Attack_Finished(0.1);
};
//============================================================================
// ASSAULT CANNON FRAMES
// Cannon powering up
void() player_assaultcannonup1 =[$nailatt1, player_assaultcannonup2 ]
{
if ((!self.button0) || (self.ammo_shells < 1) || intermission_running)
2001-07-17 05:58:10 +00:00
{
// Let him/her walk again
2002-09-08 01:44:11 +00:00
// if (!self.is_haxxxoring) //- OfN already checked on TeamFortress_SetSpeed() {
self.tfstate &= ~TFSTATE_ASSAULTCANNON;
TeamFortress_SetSpeed(self);
// }
2001-07-17 05:58:10 +00:00
self.count = 1;
self.heat = 0;
player_assaultcannondown1();
return;
}
self.fire_held_down = TRUE;
2001-07-17 05:58:10 +00:00
if (self.heat == 1)
sound (self, CHAN_WEAPON, "weapons/asscan1.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
SuperDamageSound();
2004-02-17 00:20:00 +00:00
if (self.heat > 3) {
2004-02-17 00:14:14 +00:00
W_FireAssaultCannon (self.heat);
sound (self, CHAN_WEAPON, "weapons/asscan2.wav", 1, ATTN_NORM);
}
2001-07-17 05:58:10 +00:00
Attack_Finished(0.1);
if (self.heat != 2 && self.heat != 4)
{
if (self.weaponframe >= 3)
self.weaponframe = 0;
else
self.weaponframe = self.weaponframe + 1;
}
self.heat = self.heat + 1;
2004-02-17 00:20:00 +00:00
if (self.heat >= 7)
2001-07-17 05:58:10 +00:00
{
self.heat = 0;
player_assaultcannon1();
}
};
// Cannon powering up 2
void() player_assaultcannonup2 =[$nailatt1, player_assaultcannonup1 ]
{
if ((!self.button0) || (self.ammo_shells < 1) || intermission_running)
2001-07-17 05:58:10 +00:00
{
// Let him/her walk again
2002-09-08 01:44:11 +00:00
// if (!self.is_haxxxoring) //- OfN already checked on TeamFortress_SetSpeed() {
self.tfstate &= ~TFSTATE_ASSAULTCANNON;
TeamFortress_SetSpeed(self);
// }
2001-07-17 05:58:10 +00:00
self.count = 1;
self.heat = 0;
player_assaultcannondown1();
return;
}
SuperDamageSound();
2004-02-17 00:20:00 +00:00
if (self.heat > 5) {
2004-02-17 00:14:14 +00:00
sound (self, CHAN_WEAPON, "weapons/asscan2.wav", 1, ATTN_NORM);
W_FireAssaultCannon (self.heat);
}
2001-07-17 05:58:10 +00:00
Attack_Finished(0.1);
if (self.heat != 2 && self.heat != 4 && self.heat != 7)
{
if (self.weaponframe == 2 && self.heat >= 9)
self.weaponframe = 0;
else if (self.weaponframe >= 3)
self.weaponframe = 0;
else
self.weaponframe = self.weaponframe + 1;
}
self.heat = self.heat + 1;
2004-02-17 00:20:00 +00:00
if (self.heat >= 7)
2001-07-17 05:58:10 +00:00
{
self.heat = 0;
player_assaultcannon1();
}
};
// Cannon Firing
void() player_assaultcannon1 =[$nailatt1, player_assaultcannon2 ]
{
2004-02-04 03:01:51 +00:00
// local string st;
2001-07-17 05:58:10 +00:00
muzzleflash();
sound (self, CHAN_WEAPON, "weapons/asscan2.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
if ((!self.button0) || (self.ammo_shells < 1) || intermission_running)
{
2004-02-17 00:14:14 +00:00
// stuffcmd(self, "v_idlescale 0\n"); // GR NO
2001-07-17 05:58:10 +00:00
// Let him/her walk again
2002-09-08 01:44:11 +00:00
self.tfstate &= ~TFSTATE_ASSAULTCANNON;
2001-07-17 05:58:10 +00:00
TeamFortress_SetSpeed(self);
self.weaponframe = 0;
self.count = 1;
player_assaultcannondown1();
return;
}
if (self.weaponframe == 2)
self.weaponframe = 4;
else
self.weaponframe = 2;
SuperDamageSound();
2004-02-17 00:14:14 +00:00
W_FireAssaultCannon(7);
2001-07-17 05:58:10 +00:00
// Shake the screen
2004-02-04 03:01:51 +00:00
// Not with idlescale -GR
#if 0
2001-07-17 05:58:10 +00:00
stuffcmd(self, "v_idlescale ");
if (self.heat < 5)
st = ftos(self.heat * 4);
else
st = "20";
stuffcmd(self, st);
stuffcmd(self, "\n");
2004-04-04 07:31:31 +00:00
#elifdef ASSCAN_JERK
2004-03-20 00:09:41 +00:00
self.v_angle_x -= (random () + 0.5);
self.v_angle_y -= ((random () * 0.6) - 0.3);
2004-02-04 03:01:51 +00:00
msg_entity = self;
WriteByte (MSG_ONE, SVC_SETANGLE);
2004-03-20 00:09:41 +00:00
WriteAngleV (MSG_ONE, self.v_angle);
2004-02-04 03:01:51 +00:00
#endif
2001-07-17 05:58:10 +00:00
Attack_Finished(0.1);
};
// Cannon Firing 2
void() player_assaultcannon2 =[$nailatt2, player_assaultcannon1 ]
{
2002-09-08 01:44:11 +00:00
if ((!self.button0) || (self.ammo_shells < 1) || intermission_running) {
2001-07-17 05:58:10 +00:00
stuffcmd(self, "v_idlescale 0\n");
// Let him/her walk again
2002-09-08 01:44:11 +00:00
self.tfstate &= ~TFSTATE_ASSAULTCANNON;
TeamFortress_SetSpeed(self);
2001-07-17 05:58:10 +00:00
self.weaponframe = 0;
self.count = 1;
player_assaultcannondown1();
return;
}
2004-02-17 00:14:14 +00:00
self.weaponframe++;
if (self.weaponframe == 4)
2001-07-17 05:58:10 +00:00
self.weaponframe = 2;
2004-02-17 00:14:14 +00:00
else
self.weaponframe = 4;
2001-07-17 05:58:10 +00:00
SuperDamageSound();
2004-02-17 00:14:14 +00:00
W_FireAssaultCannon(7);
2001-07-17 05:58:10 +00:00
// increase the heat of the cannon
self.heat = self.heat + 0.1;
// Shake the screen
2004-02-04 03:01:51 +00:00
// Not with idlescale
#if 0
2001-07-17 05:58:10 +00:00
stuffcmd(self, "v_idlescale 0\n");
2004-02-17 00:14:14 +00:00
#endif
stuffcmd (self, "bf\n");
2001-07-17 05:58:10 +00:00
Attack_Finished(0.1);
};
// Cannon powering down
void() player_assaultcannondown1 =[$nailatt1, player_assaultcannondown1 ]
{
if (self.count == 1)
sound (self, CHAN_WEAPON, "weapons/asscan3.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
2002-09-08 01:44:11 +00:00
if (self.count >= 15) {
2001-07-17 05:58:10 +00:00
self.heat = 0;
2002-09-08 01:44:11 +00:00
self.fire_held_down = FALSE;
2001-07-17 05:58:10 +00:00
// Let him/her walk again
2002-09-08 01:44:11 +00:00
self.tfstate &= ~TFSTATE_ASSAULTCANNON;
TeamFortress_SetSpeed(self);
if (self.ammo_shells < 1 || self.ammo_cells < 6) {
2001-07-17 05:58:10 +00:00
self.current_weapon = W_BestWeapon();
W_SetCurrentAmmo();
W_PrintWeaponMessage();
return;
}
player_run ();
return;
}
2002-09-08 01:44:11 +00:00
if (self.count != 8 && self.count != 10 && self.count != 12 && self.count != 14) {
2001-07-17 05:58:10 +00:00
if (self.weaponframe == 3)
self.weaponframe = 0;
else
self.weaponframe = self.weaponframe + 1;
}
self.count = self.count + 1;
Attack_Finished(0.1);
};
//============================================================================
void() player_light1 =[$light1, player_light2 ]
{
muzzleflash();
2002-09-08 01:44:11 +00:00
if (!self.button0 || intermission_running) {
player_run ();
return;
}
2001-07-17 05:58:10 +00:00
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 5)
self.weaponframe = 1;
SuperDamageSound();
W_FireLightning();
Attack_Finished(0.2);
};
2002-09-08 01:44:11 +00:00
2001-07-17 05:58:10 +00:00
void() player_light2 =[$light2, player_light1 ]
{
2002-09-08 01:44:11 +00:00
if (!self.button0 || intermission_running) {
player_run ();
return;
}
2001-07-17 05:58:10 +00:00
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 5)
self.weaponframe = 1;
SuperDamageSound();
W_FireLightning();
Attack_Finished(0.2);
};
//============================================================================
//WK Frames for the new light assault gun
//(Using the frames for the lightning gun)
void() player_light_assault1 =[$light1, player_light_assault2 ]
{
2002-09-08 01:44:11 +00:00
// muzzleflash();
2001-07-17 05:58:10 +00:00
2002-09-08 01:44:11 +00:00
if (!self.button0 || intermission_running || self.tfstate & TFSTATE_RELOADING) {
player_run ();
return;
}
2001-07-17 05:58:10 +00:00
2002-09-08 01:44:11 +00:00
muzzleflash(); //- oFn moved
2001-07-17 05:58:10 +00:00
2002-09-08 01:44:11 +00:00
self.weaponframe = self.weaponframe + 1;
2001-07-17 05:58:10 +00:00
if (self.weaponframe == 5)
self.weaponframe = 1;
SuperDamageSound();
W_FireLightAssault();
Attack_Finished(0.2);
};
2002-09-08 01:44:11 +00:00
2001-07-17 05:58:10 +00:00
void() player_light_assault2 =[$light2, player_light_assault1 ]
{
2002-09-08 01:44:11 +00:00
if (!self.button0 || intermission_running || self.tfstate & TFSTATE_RELOADING) {
player_run ();
return;
}
2001-07-17 05:58:10 +00:00
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 5)
self.weaponframe = 1;
SuperDamageSound();
W_FireLightAssault();
Attack_Finished(0.2);
};
//End WK
//============================================================================
void() player_rocket1 =[$rockatt1, player_rocket2 ] {self.weaponframe=1; muzzleflash();};
void() player_rocket2 =[$rockatt2, player_rocket3 ] {self.weaponframe=2;};
void() player_rocket3 =[$rockatt3, player_rocket4 ] {self.weaponframe=3;};
void() player_rocket4 =[$rockatt4, player_rocket5 ] {self.weaponframe=4;};
void() player_rocket5 =[$rockatt5, player_rocket6 ] {self.weaponframe=5;};
void() player_rocket6 =[$rockatt6, player_run ] {self.weaponframe=6;};
void(float num_bubbles) DeathBubbles;
void() PainSound =
{
local float rs;
if (self.health < 0)
return;
if (damage_attacker.classname == "teledeath")
{
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
2001-07-17 05:58:10 +00:00
return;
}
// water pain sounds
if (self.watertype == CONTENTS_WATER && self.waterlevel == 3)
2001-07-17 05:58:10 +00:00
{
DeathBubbles(1);
if (random() > 0.5)
sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
else
sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
return;
}
// slime pain sounds
if (self.watertype == CONTENTS_SLIME)
2001-07-17 05:58:10 +00:00
{
// FIX ME put in some steam here
if (random() > 0.5)
sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
else
sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
return;
}
if (self.watertype == CONTENTS_LAVA)
2001-07-17 05:58:10 +00:00
{
if (random() > 0.5)
sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
else
sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
return;
}
if (self.pain_finished > time)
{
self.axhitme = 0;
return;
}
self.pain_finished = time + 0.5;
// don't make multiple pain sounds right after each other
// ax pain sound
if (self.axhitme == 1)
{
self.axhitme = 0;
sound (self, CHAN_VOICE, "player/axhit1.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
return;
}
rs = rint((random() * 5) + 1);
self.noise = "";
if (rs == 1)
self.noise = "player/pain1.wav";
else if (rs == 2)
self.noise = "player/pain2.wav";
else if (rs == 3)
self.noise = "player/pain3.wav";
else if (rs == 4)
self.noise = "player/pain4.wav";
else if (rs == 5)
self.noise = "player/pain5.wav";
else
self.noise = "player/pain6.wav";
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
return;
};
void() player_pain1 = [ $pain1, player_pain2 ] {PainSound();self.weaponframe=0;};
void() player_pain2 = [ $pain2, player_pain3 ] {};
void() player_pain3 = [ $pain3, player_pain4 ] {};
void() player_pain4 = [ $pain4, player_pain5 ] {};
void() player_pain5 = [ $pain5, player_pain6 ] {};
void() player_pain6 = [ $pain6, player_run ] {};
void() player_axpain1 = [ $axpain1, player_axpain2 ] {PainSound();self.weaponframe=0;};
void() player_axpain2 = [ $axpain2, player_axpain3 ] {};
void() player_axpain3 = [ $axpain3, player_axpain4 ] {};
void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
void() player_axpain5 = [ $axpain5, player_axpain6 ] {};
void() player_axpain6 = [ $axpain6, player_run ] {};
void(entity attacker, float damage) player_pain =
2001-07-17 05:58:10 +00:00
{
if (self.weaponframe)
return;
// eyes don't have pain frames
if (self.invisible_finished > time)
return;
// feigning players don't have pain frames
if (self.is_feigning)
{
PainSound();
return;
}
// HvyWeap Guys firing assault cannon don't have pain frames
if (self.button0 && self.current_weapon == WEAP_ASSAULT_CANNON)
2001-07-17 05:58:10 +00:00
return;
if (self.current_weapon <= WEAP_AXE)
2001-07-17 05:58:10 +00:00
player_axpain1 ();
else
player_pain1 ();
};
void() player_diea1;
void() player_dieb1;
void() player_diec1;
void() player_died1;
void() player_diee1;
void() player_die_ax1;
void() DeathBubblesSpawn =
{
2002-08-21 20:25:10 +00:00
if (self.owner.waterlevel != 3 && self.has_holo == 0) {
dremove(self);
2001-07-17 05:58:10 +00:00
return;
2002-08-21 20:25:10 +00:00
}
2001-07-17 05:58:10 +00:00
newmis = spawn();
setmodel (newmis, "progs/s_bubble.spr");
setorigin (newmis, self.owner.origin + '0 0 24');
newmis.movetype = MOVETYPE_NOCLIP;
newmis.solid = SOLID_NOT;
2001-07-17 05:58:10 +00:00
newmis.velocity = '0 0 15';
newmis.nextthink = time + 0.5;
newmis.think = bubble_bob;
newmis.classname = "bubble";
newmis.frame = 0;
newmis.cnt = 0;
setsize (newmis, '-8 -8 -8', '8 8 8');
self.nextthink = time + 0.1;
self.think = DeathBubblesSpawn;
self.air_finished = self.air_finished + 1;
if (self.air_finished >= self.bubble_count)
dremove(self);
};
void(float num_bubbles) DeathBubbles =
{
local entity bubble_spawner;
bubble_spawner = spawn();
setorigin (bubble_spawner, self.origin);
bubble_spawner.movetype = MOVETYPE_NONE;
bubble_spawner.solid = SOLID_NOT;
2001-07-17 05:58:10 +00:00
bubble_spawner.nextthink = time + 0.1;
bubble_spawner.think = DeathBubblesSpawn;
bubble_spawner.air_finished = 0;
bubble_spawner.owner = self;
bubble_spawner.bubble_count = num_bubbles;
if (self.classname=="monster_army")
bubble_spawner.has_holo = 1; // its a soldier;
else
bubble_spawner.has_holo = 0; // not a soldier;
return;
};
void() DeathSound =
{
local float rs;
// water death sounds
if (self.waterlevel == 3)
{
if (self.is_feigning)
DeathBubbles(2);
else
DeathBubbles(10);
sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
2001-07-17 05:58:10 +00:00
return;
}
rs = rint ((random() * 4) + 1);
if (rs == 1)
self.noise = "player/death1.wav";
if (rs == 2)
self.noise = "player/death2.wav";
if (rs == 3)
self.noise = "player/death3.wav";
if (rs == 4)
self.noise = "player/death4.wav";
if (rs == 5)
self.noise = "player/death5.wav";
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
2001-07-17 05:58:10 +00:00
return;
};
void() PlayerDead =
{
self.nextthink = -1;
// allow respawn after a certain time
self.deadflag = DEAD_DEAD;
2001-07-17 05:58:10 +00:00
};
vector(float dm) VelocityForDamage =
{
local vector v;
v_x = 100 * crandom();
v_y = 100 * crandom();
v_z = 200 + 100 * random();
if (dm > -50)
{
// RPrint ("level 1\n");
v = v * 0.7;
}
else if (dm > -200)
{
// RPrint ("level 3\n");
v = v * 2;
}
else
v = v * 10;
return v;
};
void(string gibname, float dm) ThrowGib =
{
newmis = spawn();
newmis.origin = self.origin;
setmodel (newmis, gibname);
newmis.velocity = VelocityForDamage (dm);
newmis.movetype = MOVETYPE_BOUNCE;
newmis.solid = SOLID_NOT;
2001-07-17 05:58:10 +00:00
newmis.avelocity_x = random()*600;
newmis.avelocity_y = random()*600;
newmis.avelocity_z = random()*600;
newmis.think = SUB_Remove;
newmis.ltime = time;
newmis.nextthink = time + 10 + random()*10;
newmis.frame = 0;
newmis.flags = 0;
2002-09-08 01:44:11 +00:00
if (gibname=="progs/tesgib4.mdl" || gibname=="progs/t2gib4.mdl") {
newmis.skin=dm;
newmis.velocity = VelocityForDamage (-70);
}
2004-03-23 04:29:46 +00:00
setsize (newmis, '0 0 0', '0 0 0');
2001-07-17 05:58:10 +00:00
};
void(string gibname, float dm) ThrowHead =
{
setmodel (self, gibname);
self.skin = 0;
self.frame = 0;
self.nextthink = -1;
self.movetype = MOVETYPE_BOUNCE;
self.takedamage = DAMAGE_NO;
self.solid = SOLID_NOT;
2001-07-17 05:58:10 +00:00
self.view_ofs = '0 0 8';
setsize (self, '-16 -16 0', '16 16 56');
self.velocity = VelocityForDamage (dm);
self.origin_z = self.origin_z - 24;
self.flags = self.flags - (self.flags & FL_ONGROUND);
2001-07-17 05:58:10 +00:00
self.avelocity = crandom() * '0 600 0';
2002-09-08 01:44:11 +00:00
/*
if (self.classname == "player") {
self.classname = "player_head";
self.think = SUB_Remove;
self.nextthink = time + 20 + 20 * random();
} else {
self.classname = "monster_head";
self.think = SUB_Remove;
self.nextthink = time + 20 + 20 * random();
}
*/
2004-03-23 04:29:46 +00:00
setorigin (self, self.origin);
2002-09-08 01:44:11 +00:00
//-OfN
2001-07-17 05:58:10 +00:00
};
void(string gibname) HeadShotThrowHead =
{
setmodel (self, gibname);
self.frame = 0;
self.nextthink = -1;
self.movetype = MOVETYPE_BOUNCE;
self.takedamage = DAMAGE_NO;
self.solid = SOLID_NOT;
2001-07-17 05:58:10 +00:00
self.view_ofs = '0 0 8';
setsize (self, '-16 -16 0', '16 16 56');
self.velocity = normalize(self.head_shot_vector) * 600;
self.origin_z = self.origin_z + 24;
self.flags = self.flags - (self.flags & FL_ONGROUND);
2001-07-17 05:58:10 +00:00
self.avelocity = '0 0 0';
2004-03-23 04:29:46 +00:00
setorigin (self, self.origin);
2001-07-17 05:58:10 +00:00
};
void() KillPlayer =
{
self.owner.deadflag = DEAD_DEAD;
2001-07-17 05:58:10 +00:00
dremove(self);
};
void() GibPlayer =
{
2002-09-08 01:44:11 +00:00
//- OfN now this can be turned on/off with the headless localinfo -//
// Decapitation ------------------------------------------------------
if (headless == 1) {
if (deathmsg == DMSG_SNIPERHEADSHOT) {
//- Ofn - I don't like this: || deathmsg == DMSG_BACKSTAB) {
// if (deathmsg == DMSG_SNIPERHEADSHOT)
2001-07-17 05:58:10 +00:00
HeadShotThrowHead("progs/h_player.mdl");
2002-09-08 01:44:11 +00:00
// else
// ThrowHead("progs/h_player.mdl", -60);
newmis = spawn();
newmis.solid = SOLID_NOT;
newmis.movetype = MOVETYPE_STEP;
newmis.angles = self.angles;
setsize(newmis, '0 0 0', '0 0 0');
setorigin(newmis, self.origin);
newmis.colormap = self.colormap;
// newmis.color = self.color
// newmis.skin = self.skin;
setmodel(newmis, "progs/headless.mdl");
newmis.think = Headless_Think;
newmis.nextthink = time + 0.1;
if (self.current_weapon <= WEAP_AXE)
newmis.frame = 0;
else
newmis.frame = 8;
ThrowGib ("progs/zom_gib.mdl", self.health); //- lol, looks cool
} else {
ThrowHead ("progs/h_player.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health); //-added
// ThrowGib ("progs/zom_gib.mdl", self.health); //-added
}
} else {
ThrowHead ("progs/h_player.mdl", self.health);
2001-07-17 05:58:10 +00:00
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
2002-09-08 01:44:11 +00:00
// ThrowGib ("progs/gib3.mdl", self.health); //-added
2001-07-17 05:58:10 +00:00
}
// Why do we need this? What are we doing that's clobbering _something_
// within a second after a trigger_hurt kills the player?
2002-09-08 01:44:11 +00:00
if (deathmsg == DMSG_TRIGGER) {
2001-07-17 05:58:10 +00:00
newmis = spawn();
newmis.owner = self;
newmis.think = KillPlayer;
newmis.nextthink = time + 1;
2002-09-08 01:44:11 +00:00
} else {
self.deadflag = DEAD_DEAD;
2001-07-17 05:58:10 +00:00
}
TeamFortress_SetupRespawn(FALSE);
2001-07-17 05:58:10 +00:00
2002-09-08 01:44:11 +00:00
if (damage_attacker.classname == "teledeath") {
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
2001-07-17 05:58:10 +00:00
// if telefragged, extend respawn delay to prevent chaining telefrags
self.respawn_time = self.respawn_time + 2;
return;
}
2002-09-08 01:44:11 +00:00
if (damage_attacker.classname == "teledeath2") {
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
2001-07-17 05:58:10 +00:00
// if telefragged, extend respawn delay to prevent chaining telefrags
self.respawn_time = self.respawn_time + 2;
return;
}
if (random() < 0.5)
sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
2001-07-17 05:58:10 +00:00
else
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
2001-07-17 05:58:10 +00:00
};
void() PlayerDie =
{
local float i,finished;
local entity te;
//WK Stop orff
sound (self, CHAN_MUSIC, "items/r_item1.wav", 0.1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
//WK Stop glows!
2002-09-08 01:44:11 +00:00
self.effects = 0;
// make dead guy release hook (wedge)
if (self.hook_out) {
Reset_Grapple (self.hook);
Attack_Finished(0.75);
// self.hook_out = TRUE; // PutClientInServer will reset this
}
self.items &= ~(IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD);
self.invisible_finished = 0; // don't die as eyes
self.invincible_finished = 0;
self.super_damage_finished = 0;
self.radsuit_finished = 0;
self.modelindex = modelindex_player; // don't use eyes
2001-07-17 05:58:10 +00:00
// If infected, give the medic a frag
finished = TRUE;
2002-09-08 01:44:11 +00:00
if (self.tfstate & TFSTATE_INFECTED && self == self.enemy) {
te = find(NIL, classname, "timer");
2002-09-08 01:44:11 +00:00
while (te) {
if (te.owner == self && te.think == BioInfection_Decay) {
2001-07-17 05:58:10 +00:00
logfrag(te.enemy, self);
te.enemy.real_frags = te.enemy.real_frags + 1;
2002-09-08 01:44:11 +00:00
if (!(toggleflags & TFLAG_TEAMFRAGS))
2001-07-17 05:58:10 +00:00
te.enemy.frags = te.enemy.real_frags;
finished = TRUE;
2001-07-17 05:58:10 +00:00
}
te = find(te, classname, "timer");
if (finished) te = NIL;
2001-07-17 05:58:10 +00:00
}
}
// Remove all the timer entities for this player
TeamFortress_RemoveTimers();
// Restore player's speed
#ifdef RESTORE_DEAD_SPEEDS
2002-09-08 01:44:11 +00:00
stuffcmd(self,"cl_backspeed 1000\n");
2001-07-17 05:58:10 +00:00
stuffcmd(self,"cl_forwardspeed 1000\n");
stuffcmd(self,"cl_sidespeed 1000\n");
stuffcmd(self,"cl_movespeedkey 2\n");
#endif
if (deathmatch || coop)
DropBackpack();
2002-09-08 01:44:11 +00:00
self.weaponmodel = "";
2001-07-17 05:58:10 +00:00
self.view_ofs = '0 0 -8';
self.deadflag = DEAD_DYING;
self.solid = SOLID_NOT;
self.flags = self.flags - (self.flags & FL_ONGROUND);
self.movetype = MOVETYPE_TOSS;
2001-07-17 05:58:10 +00:00
if (self.velocity_z < 10)
self.velocity_z = self.velocity_z + random()*300;
2002-09-08 01:44:11 +00:00
if (self.health < -40) {
2001-07-17 05:58:10 +00:00
GibPlayer ();
return;
}
DeathSound();
self.angles_x = 0;
self.angles_z = 0;
2002-09-08 01:44:11 +00:00
if (self.current_weapon <= WEAP_AXE) {
2001-07-17 05:58:10 +00:00
player_die_ax1 ();
TeamFortress_SetupRespawn(FALSE);
2001-07-17 05:58:10 +00:00
return;
}
2002-09-08 01:44:11 +00:00
i = 1 + floor(random() * 6);
2001-07-17 05:58:10 +00:00
if (i == 1)
player_diea1();
else if (i == 2)
player_dieb1();
else if (i == 3)
player_diec1();
else if (i == 4)
player_died1();
else
player_diee1();
// get ready to spawn!
TeamFortress_SetupRespawn(FALSE);
2001-07-17 05:58:10 +00:00
};
void() set_suicide_frame =
{ // used by kill command and diconnect command
if (self.model != "progs/player.mdl")
return; // allready gibbed
/*
self.frame = $deatha11;
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_TOSS;
self.deadflag = DEAD_DEAD;
2001-07-17 05:58:10 +00:00
self.nextthink = -1;
*/
setmodel(self, "");
setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
2001-07-17 05:58:10 +00:00
};
void() player_diea1 = [ $deatha1, player_diea2 ] {};
void() player_diea2 = [ $deatha2, player_diea3 ] {};
void() player_diea3 = [ $deatha3, player_diea4 ] {};
void() player_diea4 = [ $deatha4, player_diea5 ] {};
void() player_diea5 = [ $deatha5, player_diea6 ] {};
void() player_diea6 = [ $deatha6, player_diea7 ] {};
void() player_diea7 = [ $deatha7, player_diea8 ] {};
void() player_diea8 = [ $deatha8, player_diea9 ] {};
void() player_diea9 = [ $deatha9, player_diea10 ] {};
void() player_diea10 = [ $deatha10, player_diea11 ] {};
2002-09-08 01:44:11 +00:00
void() player_diea11 = [ $deatha11, player_diea11 ] {PlayerDead();};
2001-07-17 05:58:10 +00:00
void() player_dieb1 = [ $deathb1, player_dieb2 ] {};
void() player_dieb2 = [ $deathb2, player_dieb3 ] {};
void() player_dieb3 = [ $deathb3, player_dieb4 ] {};
void() player_dieb4 = [ $deathb4, player_dieb5 ] {};
void() player_dieb5 = [ $deathb5, player_dieb6 ] {};
void() player_dieb6 = [ $deathb6, player_dieb7 ] {};
void() player_dieb7 = [ $deathb7, player_dieb8 ] {};
void() player_dieb8 = [ $deathb8, player_dieb9 ] {};
void() player_dieb9 = [ $deathb9, player_dieb9 ] {PlayerDead();};
void() player_diec1 = [ $deathc1, player_diec2 ] {};
void() player_diec2 = [ $deathc2, player_diec3 ] {};
void() player_diec3 = [ $deathc3, player_diec4 ] {};
void() player_diec4 = [ $deathc4, player_diec5 ] {};
void() player_diec5 = [ $deathc5, player_diec6 ] {};
void() player_diec6 = [ $deathc6, player_diec7 ] {};
void() player_diec7 = [ $deathc7, player_diec8 ] {};
void() player_diec8 = [ $deathc8, player_diec9 ] {};
void() player_diec9 = [ $deathc9, player_diec10 ] {};
void() player_diec10 = [ $deathc10, player_diec11 ] {};
void() player_diec11 = [ $deathc11, player_diec12 ] {};
void() player_diec12 = [ $deathc12, player_diec13 ] {};
void() player_diec13 = [ $deathc13, player_diec14 ] {};
void() player_diec14 = [ $deathc14, player_diec15 ] {};
void() player_diec15 = [ $deathc15, player_diec15 ] {PlayerDead();};
void() player_died1 = [ $deathd1, player_died2 ] {};
void() player_died2 = [ $deathd2, player_died3 ] {};
void() player_died3 = [ $deathd3, player_died4 ] {};
void() player_died4 = [ $deathd4, player_died5 ] {};
void() player_died5 = [ $deathd5, player_died6 ] {};
void() player_died6 = [ $deathd6, player_died7 ] {};
void() player_died7 = [ $deathd7, player_died8 ] {};
void() player_died8 = [ $deathd8, player_died9 ] {};
void() player_died9 = [ $deathd9, player_died9 ] {PlayerDead();};
void() player_diee1 = [ $deathe1, player_diee2 ] {};
void() player_diee2 = [ $deathe2, player_diee3 ] {};
void() player_diee3 = [ $deathe3, player_diee4 ] {};
void() player_diee4 = [ $deathe4, player_diee5 ] {};
void() player_diee5 = [ $deathe5, player_diee6 ] {};
void() player_diee6 = [ $deathe6, player_diee7 ] {};
void() player_diee7 = [ $deathe7, player_diee8 ] {};
void() player_diee8 = [ $deathe8, player_diee9 ] {};
void() player_diee9 = [ $deathe9, player_diee9 ] {PlayerDead();};
void() player_die_ax1 = [ $axdeth1, player_die_ax2 ] {};
void() player_die_ax2 = [ $axdeth2, player_die_ax3 ] {};
void() player_die_ax3 = [ $axdeth3, player_die_ax4 ] {};
void() player_die_ax4 = [ $axdeth4, player_die_ax5 ] {};
void() player_die_ax5 = [ $axdeth5, player_die_ax6 ] {};
void() player_die_ax6 = [ $axdeth6, player_die_ax7 ] {};
void() player_die_ax7 = [ $axdeth7, player_die_ax8 ] {};
void() player_die_ax8 = [ $axdeth8, player_die_ax9 ] {};
void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {PlayerDead();};
void() Headless_Think =
{
self.frame = self.frame + 1;
2002-09-08 01:44:11 +00:00
if (self.frame == 7 || self.frame == 18) {
2001-07-17 05:58:10 +00:00
self.nextthink = time + 30 + random()*10;
self.think = SUB_Remove;
return;
}
self.nextthink = time + 0.1;
};
2002-09-08 01:44:11 +00:00
// Airgun player stuff ========================================================
2001-07-17 05:58:10 +00:00
void() player_airgun1 =[$rockatt1, player_airgun2 ] {self.weaponframe=1;};
void() player_airgun2 =[$rockatt2, player_airgun3 ] {self.weaponframe=2;};
void() player_airgun3 =[$rockatt3, player_airgun4 ] {self.weaponframe=3;};
void() player_airgun4 =[$rockatt3, player_airgun5 ] {self.weaponframe=4;};
void() player_airgun5 =[$rockatt4, player_airgun6 ] {self.weaponframe=5;};
void() player_airgun6 =[$rockatt4, player_airgun7 ] {self.weaponframe=6;};
void() player_airgun7 =[$rockatt5, player_airgun8 ] {self.weaponframe=7;};
2001-12-05 03:29:52 +00:00
void() player_airgun8 =[$rockatt6, player_run ] {self.weaponframe = 0;};
2001-07-17 05:58:10 +00:00
void() player_failedairgun1 =[$nailatt1, player_failedairgun2 ] {self.weaponframe=6;};
void() player_failedairgun2 =[$nailatt2, player_failedairgun3 ] {self.weaponframe=7;};
2001-12-05 03:29:52 +00:00
void() player_failedairgun3 =[$nailatt2, player_run ] {self.weaponframe=0;};
2001-07-17 05:58:10 +00:00
2002-09-08 01:44:11 +00:00
// Laser cannon player stuff ==================================================
2001-07-17 05:58:10 +00:00
void() player_laser1 =[$nailatt1, player_laser2 ]
{
2002-09-08 01:44:11 +00:00
if (!self.button0 || intermission_running || self.tfstate & TFSTATE_RELOADING) {
player_run ();
return;
}
2001-07-17 05:58:10 +00:00
2002-09-08 01:44:11 +00:00
self.attack_finished = time + 0.2;
self.weaponframe=1;
HIP_FireLaser(0);
2001-07-17 05:58:10 +00:00
};
2002-09-08 01:44:11 +00:00
2001-07-17 05:58:10 +00:00
void() player_laser2 =[$nailatt2, player_laser3 ]
{
2002-09-08 01:44:11 +00:00
if (!self.button0 || intermission_running || self.tfstate & TFSTATE_RELOADING) {
player_run ();
return;
}
self.weaponframe=2;
2001-07-17 05:58:10 +00:00
};
2002-09-08 01:44:11 +00:00
2001-07-17 05:58:10 +00:00
void() player_laser3 =[$nailatt2, player_laser4 ]
{
2002-09-08 01:44:11 +00:00
if (!self.button0 || intermission_running || self.tfstate & TFSTATE_RELOADING) {
player_run ();
return;
}
2001-07-17 05:58:10 +00:00
2002-09-08 01:44:11 +00:00
self.attack_finished = time + 0.2;
self.weaponframe=4;
HIP_FireLaser(1);
2001-07-17 05:58:10 +00:00
};
2002-09-08 01:44:11 +00:00
2001-07-17 05:58:10 +00:00
void() player_laser4 =[$nailatt1, player_laser1 ]
{
2002-09-08 01:44:11 +00:00
if (!self.button0 || intermission_running || self.tfstate & TFSTATE_RELOADING) {
player_run ();
return;
}
self.weaponframe=5;
2001-07-17 05:58:10 +00:00
};
float(entity e) EF_GlowColor =
{
local float ret = 0;
if (e.classname == "player")
{
local entity te = NIL;
te = find(NIL, classname, "item_tfgoal");
while (te)
{
if (te.owner == e && (te.goal_activation & TFGI_GLOW))
{
local float teamno = 0;
if (te.owned_by == 1)
ret |= EF_BLUE;
else if (te.owned_by == 2)
ret |= EF_RED;
else if (!ret)
ret = EF_DIMLIGHT;
}
2003-12-06 04:14:18 +00:00
te = find(te, classname, "item_tfgoal");
}
if (e.super_damage_finished)
ret |= EF_BLUE;
if (e.invincible_finished)
ret |= EF_RED;
if ((e.job & (JOB_CHAPLAN | JOB_ACTIVE)) == (JOB_CHAPLAN | JOB_ACTIVE))
ret |= EF_BLUE | EF_BRIGHTLIGHT;
if (ret & (EF_BLUE | EF_RED))
ret &= ~EF_DIMLIGHT;
return ret;
}
else if (e.classname == "item_tfgoal")
{
if (e.owned_by)
{
if (e.owned_by == 1)
return EF_BLUE;
else if (e.owned_by == 2)
return EF_RED;
}
else if (e.team)
{
if (e.team_no == 1)
return EF_BLUE;
else if (e.team_no == 2)
return EF_RED;
}
return EF_DIMLIGHT;
}
};