2001-07-23 20:52:47 +00:00
|
|
|
#include "defs.qh"
|
|
|
|
#include "menu.qh"
|
2001-07-17 05:58:10 +00:00
|
|
|
/*==============================================
|
|
|
|
SPY.QC
|
|
|
|
|
|
|
|
TeamFortress v2.5 29/2/97
|
|
|
|
========================================================
|
|
|
|
Functions for the SPY class and associated weaponry
|
|
|
|
========================================================*/
|
|
|
|
void() TeamFortress_SpyGoUndercover;
|
|
|
|
void(float type) TeamFortress_SpyFeignDeath;
|
|
|
|
void(entity spy) TeamFortress_SpyCalcName;
|
|
|
|
void() TeamFortress_SpyUndercoverThink;
|
|
|
|
void(float class) TeamFortress_SpyChangeSkin;
|
|
|
|
void(float teamno) TeamFortress_SpyChangeColor;
|
|
|
|
void() GasGrenadeMakeGas;
|
|
|
|
void() HallucinationTimer;
|
|
|
|
void() W_FireTranq;
|
|
|
|
void() T_TranqDartTouch;
|
|
|
|
void() TranquiliserTimer;
|
|
|
|
void() TranquiliserTimer2; //CH for demons
|
|
|
|
void(entity spy) Spy_RemoveDisguise;
|
|
|
|
|
|
|
|
// Spy Feign Death Handling
|
|
|
|
$cd /raid/quake/id1/models/player_4
|
|
|
|
$origin 0 -6 24
|
|
|
|
$base base
|
|
|
|
$skin skin
|
|
|
|
$frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
|
|
|
|
$frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
|
|
|
|
$frame stand1 stand2 stand3 stand4 stand5
|
|
|
|
$frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
|
|
|
|
$frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
|
|
|
|
$frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
|
|
|
|
$frame pain1 pain2 pain3 pain4 pain5 pain6
|
|
|
|
$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
|
|
|
|
|
|
|
|
/*
|
|
|
|
$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
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Spy Feign Death Frames
|
|
|
|
void() spy_diea1 = [ $deatha1, spy_diea2 ] {};
|
|
|
|
void() spy_diea2 = [ $deatha2, spy_diea3 ] {};
|
|
|
|
void() spy_diea3 = [ $deatha3, spy_diea4 ] {};
|
|
|
|
void() spy_diea4 = [ $deatha4, spy_diea5 ] {};
|
|
|
|
void() spy_diea5 = [ $deatha5, spy_diea6 ] {};
|
|
|
|
void() spy_diea6 = [ $deatha6, spy_diea7 ] {};
|
|
|
|
void() spy_diea7 = [ $deatha7, spy_diea8 ] {};
|
|
|
|
void() spy_diea8 = [ $deatha8, spy_diea9 ] {};
|
|
|
|
void() spy_diea9 = [ $deatha9, spy_diea10 ] {};
|
|
|
|
void() spy_diea10 = [ $deatha10, spy_diea11 ] {};
|
|
|
|
void() spy_diea11 = [ $deatha11, spy_diea11 ] {};
|
|
|
|
|
|
|
|
void() spy_dieb1 = [ $deathb1, spy_dieb2 ] {};
|
|
|
|
void() spy_dieb2 = [ $deathb2, spy_dieb3 ] {};
|
|
|
|
void() spy_dieb3 = [ $deathb3, spy_dieb4 ] {};
|
|
|
|
void() spy_dieb4 = [ $deathb4, spy_dieb5 ] {};
|
|
|
|
void() spy_dieb5 = [ $deathb5, spy_dieb6 ] {};
|
|
|
|
void() spy_dieb6 = [ $deathb6, spy_dieb7 ] {};
|
|
|
|
void() spy_dieb7 = [ $deathb7, spy_dieb8 ] {};
|
|
|
|
void() spy_dieb8 = [ $deathb8, spy_dieb9 ] {};
|
|
|
|
void() spy_dieb9 = [ $deathb9, spy_dieb9 ] {};
|
|
|
|
|
|
|
|
void() spy_diec1 = [ $deathc1, spy_diec2 ] {};
|
|
|
|
void() spy_diec2 = [ $deathc2, spy_diec3 ] {};
|
|
|
|
void() spy_diec3 = [ $deathc3, spy_diec4 ] {};
|
|
|
|
void() spy_diec4 = [ $deathc4, spy_diec5 ] {};
|
|
|
|
void() spy_diec5 = [ $deathc5, spy_diec6 ] {};
|
|
|
|
void() spy_diec6 = [ $deathc6, spy_diec7 ] {};
|
|
|
|
void() spy_diec7 = [ $deathc7, spy_diec8 ] {};
|
|
|
|
void() spy_diec8 = [ $deathc8, spy_diec9 ] {};
|
|
|
|
void() spy_diec9 = [ $deathc9, spy_diec10 ] {};
|
|
|
|
void() spy_diec10 = [ $deathc10, spy_diec11 ] {};
|
|
|
|
void() spy_diec11 = [ $deathc11, spy_diec12 ] {};
|
|
|
|
void() spy_diec12 = [ $deathc12, spy_diec13 ] {};
|
|
|
|
void() spy_diec13 = [ $deathc13, spy_diec14 ] {};
|
|
|
|
void() spy_diec14 = [ $deathc14, spy_diec15 ] {};
|
|
|
|
void() spy_diec15 = [ $deathc15, spy_diec15 ] {};
|
|
|
|
|
|
|
|
void() spy_died1 = [ $deathd1, spy_died2 ] {};
|
|
|
|
void() spy_died2 = [ $deathd2, spy_died3 ] {};
|
|
|
|
void() spy_died3 = [ $deathd3, spy_died4 ] {};
|
|
|
|
void() spy_died4 = [ $deathd4, spy_died5 ] {};
|
|
|
|
void() spy_died5 = [ $deathd5, spy_died6 ] {};
|
|
|
|
void() spy_died6 = [ $deathd6, spy_died7 ] {};
|
|
|
|
void() spy_died7 = [ $deathd7, spy_died8 ] {};
|
|
|
|
void() spy_died8 = [ $deathd8, spy_died9 ] {};
|
|
|
|
void() spy_died9 = [ $deathd9, spy_died9 ] {};
|
|
|
|
|
|
|
|
void() spy_diee1 = [ $deathe1, spy_diee2 ] {};
|
|
|
|
void() spy_diee2 = [ $deathe2, spy_diee3 ] {};
|
|
|
|
void() spy_diee3 = [ $deathe3, spy_diee4 ] {};
|
|
|
|
void() spy_diee4 = [ $deathe4, spy_diee5 ] {};
|
|
|
|
void() spy_diee5 = [ $deathe5, spy_diee6 ] {};
|
|
|
|
void() spy_diee6 = [ $deathe6, spy_diee7 ] {};
|
|
|
|
void() spy_diee7 = [ $deathe7, spy_diee8 ] {};
|
|
|
|
void() spy_diee8 = [ $deathe8, spy_diee9 ] {};
|
|
|
|
void() spy_diee9 = [ $deathe9, spy_diee9 ] {};
|
|
|
|
|
|
|
|
void() spy_die_ax1 = [ $axdeth1, spy_die_ax2 ] {};
|
|
|
|
void() spy_die_ax2 = [ $axdeth2, spy_die_ax3 ] {};
|
|
|
|
void() spy_die_ax3 = [ $axdeth3, spy_die_ax4 ] {};
|
|
|
|
void() spy_die_ax4 = [ $axdeth4, spy_die_ax5 ] {};
|
|
|
|
void() spy_die_ax5 = [ $axdeth5, spy_die_ax6 ] {};
|
|
|
|
void() spy_die_ax6 = [ $axdeth6, spy_die_ax7 ] {};
|
|
|
|
void() spy_die_ax7 = [ $axdeth7, spy_die_ax8 ] {};
|
|
|
|
void() spy_die_ax8 = [ $axdeth8, spy_die_ax9 ] {};
|
|
|
|
void() spy_die_ax9 = [ $axdeth9, spy_die_ax9 ] {};
|
|
|
|
|
|
|
|
// Spy Feign Death... getting up Frames
|
|
|
|
void() spy_upb1 = [ $deathb9, spy_upb2 ] {};
|
|
|
|
void() spy_upb2 = [ $deathb8, spy_upb3 ] {};
|
|
|
|
void() spy_upb3 = [ $deathb7, spy_upb4 ] {};
|
|
|
|
void() spy_upb4 = [ $deathb6, spy_upb5 ] {};
|
|
|
|
void() spy_upb5 = [ $deathb5, spy_upb6 ] {};
|
|
|
|
void() spy_upb6 = [ $deathb4, spy_upb7 ] {};
|
|
|
|
void() spy_upb7 = [ $deathb3, spy_upb8 ] {};
|
|
|
|
void() spy_upb8 = [ $deathb2, spy_upb9 ] {};
|
|
|
|
void() spy_upb9 = [ $deathb1, spy_upb9 ]
|
|
|
|
{
|
|
|
|
player_stand1();
|
|
|
|
};
|
|
|
|
|
|
|
|
void() spy_upc1 = [ $deathc15, spy_upc2 ] {};
|
|
|
|
void() spy_upc2 = [ $deathc14, spy_upc3 ] {};
|
|
|
|
void() spy_upc3 = [ $deathc13, spy_upc4 ] {};
|
|
|
|
void() spy_upc4 = [ $deathc12, spy_upc5 ] {};
|
|
|
|
void() spy_upc5 = [ $deathc11, spy_upc6 ] {};
|
|
|
|
void() spy_upc6 = [ $deathc10, spy_upc7 ] {};
|
|
|
|
void() spy_upc7 = [ $deathc9, spy_upc8 ] {};
|
|
|
|
void() spy_upc8 = [ $deathc8, spy_upc9 ] {};
|
|
|
|
void() spy_upc9 = [ $deathc7, spy_upc10 ] {};
|
|
|
|
void() spy_upc10 = [ $deathc6, spy_upc11 ] {};
|
|
|
|
void() spy_upc11 = [ $deathc5, spy_upc12 ] {};
|
|
|
|
void() spy_upc12 = [ $deathc4, spy_upc13 ] {};
|
|
|
|
void() spy_upc13 = [ $deathc3, spy_upc14 ] {};
|
|
|
|
void() spy_upc14 = [ $deathc2, spy_upc15 ] {};
|
|
|
|
void() spy_upc15 = [ $deathc1, spy_upc15 ]
|
|
|
|
{
|
|
|
|
player_stand1();
|
|
|
|
};
|
|
|
|
|
|
|
|
void() spy_upd1 = [ $deathd9, spy_upd2 ] {};
|
|
|
|
void() spy_upd2 = [ $deathd8, spy_upd3 ] {};
|
|
|
|
void() spy_upd3 = [ $deathd7, spy_upd4 ] {};
|
|
|
|
void() spy_upd4 = [ $deathd6, spy_upd5 ] {};
|
|
|
|
void() spy_upd5 = [ $deathd5, spy_upd6 ] {};
|
|
|
|
void() spy_upd6 = [ $deathd4, spy_upd7 ] {};
|
|
|
|
void() spy_upd7 = [ $deathd3, spy_upd8 ] {};
|
|
|
|
void() spy_upd8 = [ $deathd2, spy_upd9 ] {};
|
|
|
|
void() spy_upd9 = [ $deathd1, spy_upd9 ]
|
|
|
|
{
|
|
|
|
player_stand1();
|
|
|
|
};
|
|
|
|
|
|
|
|
void() spy_upe1 = [ $deathe1, spy_upe9 ] {};
|
|
|
|
void() spy_upe2 = [ $deathe2, spy_upe8 ] {};
|
|
|
|
void() spy_upe3 = [ $deathe3, spy_upe7 ] {};
|
|
|
|
void() spy_upe4 = [ $deathe4, spy_upe6 ] {};
|
|
|
|
void() spy_upe5 = [ $deathe5, spy_upe5 ] {};
|
|
|
|
void() spy_upe6 = [ $deathe6, spy_upe4 ] {};
|
|
|
|
void() spy_upe7 = [ $deathe7, spy_upe3 ] {};
|
|
|
|
void() spy_upe8 = [ $deathe8, spy_upe2 ] {};
|
|
|
|
void() spy_upe9 = [ $deathe9, spy_upe1 ]
|
|
|
|
{
|
|
|
|
player_stand1();
|
|
|
|
};
|
|
|
|
|
|
|
|
void() spy_upaxe1 = [ $axdeth9, spy_upaxe2 ] {};
|
|
|
|
void() spy_upaxe2 = [ $axdeth8, spy_upaxe3 ] {};
|
|
|
|
void() spy_upaxe3 = [ $axdeth7, spy_upaxe4 ] {};
|
|
|
|
void() spy_upaxe4 = [ $axdeth6, spy_upaxe5 ] {};
|
|
|
|
void() spy_upaxe5 = [ $axdeth5, spy_upaxe6 ] {};
|
|
|
|
void() spy_upaxe6 = [ $axdeth4, spy_upaxe7 ] {};
|
|
|
|
void() spy_upaxe7 = [ $axdeth3, spy_upaxe8 ] {};
|
|
|
|
void() spy_upaxe8 = [ $axdeth2, spy_upaxe9 ] {};
|
|
|
|
void() spy_upaxe9 = [ $axdeth1, spy_upaxe9 ]
|
|
|
|
{
|
|
|
|
player_stand1();
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Function handling the Spy's feign death ability
|
|
|
|
void(float type) TeamFortress_SpyFeignDeath =
|
|
|
|
{
|
|
|
|
local float i;
|
|
|
|
local entity at_spot;
|
|
|
|
|
|
|
|
if (self.is_feigning)
|
|
|
|
{
|
|
|
|
// Check to make sure there isn't anyone on top of us
|
|
|
|
at_spot = findradius(self.origin, 64);
|
2001-07-23 20:52:47 +00:00
|
|
|
i = TRUE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-11-02 17:00:52 +00:00
|
|
|
while (at_spot)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (at_spot.classname == "player" && at_spot.deadflag == DEAD_NO && self != at_spot)
|
|
|
|
i = FALSE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
at_spot = at_spot.chain;
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (i == TRUE)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
i = 1 + floor(random()*5);
|
|
|
|
|
|
|
|
self.velocity = '0 0 0';
|
|
|
|
//WK Jump em up since they fall down now when feigning
|
|
|
|
//setorigin (self, self.origin + '0 0 30');
|
2001-07-23 20:52:47 +00:00
|
|
|
setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
|
2001-07-17 05:58:10 +00:00
|
|
|
self.view_ofs = '0 0 22';
|
|
|
|
//Prevent bad movetype errors, or something
|
|
|
|
if (self.classname != "player") {
|
|
|
|
RPrint("BUG BUG BUG BUG BUG BUG BUG BUG BUG\n");
|
|
|
|
RPrint("Non-player tried to un-feign!\n");
|
|
|
|
return;
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
self.movetype = MOVETYPE_WALK;
|
|
|
|
self.is_feigning = FALSE;
|
2001-07-17 05:58:10 +00:00
|
|
|
self.current_weapon = self.weapon;
|
|
|
|
W_SetCurrentAmmo();
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
self.tfstate = self.tfstate - (self.tfstate & TFSTATE_CANT_MOVE);
|
2001-07-17 05:58:10 +00:00
|
|
|
TeamFortress_SetSpeed(self);
|
|
|
|
|
|
|
|
// Check .weapon, because .current_weapon has been reset
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.weapon <= WEAP_AXE)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
spy_upaxe1 ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 1)
|
|
|
|
spy_upb1();
|
|
|
|
else if (i == 2)
|
|
|
|
spy_upc1();
|
|
|
|
else if (i == 3)
|
|
|
|
spy_upd1();
|
|
|
|
else
|
|
|
|
spy_upe1();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "You can't get up while someone\nis standing on you.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (!(self.flags & FL_ONGROUND) && (self.waterlevel == 0))
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "You can't feign in the air.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//WK - Can't feign while carrying flag. King cheater!
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT)) {
|
|
|
|
sprint(self, PRINT_HIGH, "Can't feign while glowing, you sloppy bitch.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
//WK - Can't feign while shooting grapple. Crash fix?
|
|
|
|
if (self.hook_out) {
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "Can't feign and grapple, silly\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
//WK - No feign detpackers
|
|
|
|
if (self.is_detpacking) {
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "Can't feign while setting a detpack, fool\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (self.is_toffingadet) //SB same for C4 det
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "How are you going to throw a detpack while lying down?\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (self.is_haxxxoring) // SB No sleep-hackers
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "You can't fall asleep AND hack, do one or the other.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
//WK Stop detpackers
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.tfstate & TFSTATE_CANT_MOVE) {
|
|
|
|
sprint(self,PRINT_HIGH, "Can't feign whilst stationary\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
//WK Prevent sliders
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.is_building == TRUE) {
|
|
|
|
sprint(self, PRINT_HIGH, "Can't feign while building, beeatch.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
//WK Prevent worker/feigners
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.job & JOB_ACTIVE) {
|
|
|
|
sprint(self, PRINT_HIGH, "Can't rest while working, you lazy bum!\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
//CH Prevents the most evil bug of all, so evil that I can not speak of it.... j/k
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.done_custom & CUSTOM_BUILDING) {
|
|
|
|
sprint (self, PRINT_HIGH, "You can't pretend to die when you're not alive!\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check to make sure there isn't anyone on top of us
|
|
|
|
at_spot = findradius(self.origin, 64);
|
2001-11-02 17:00:52 +00:00
|
|
|
while (at_spot)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (at_spot.classname == "player" && self != at_spot && at_spot.is_feigning == TRUE)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "You can't feign on top of another spy!\n");
|
2001-09-26 03:59:53 +00:00
|
|
|
return;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
at_spot = at_spot.chain;
|
|
|
|
}
|
|
|
|
|
|
|
|
makeImmune(self,time+2);
|
|
|
|
//self.immune_to_check = time + 2;
|
2001-07-23 20:52:47 +00:00
|
|
|
self.tfstate = self.tfstate | TFSTATE_CANT_MOVE;
|
2001-07-17 05:58:10 +00:00
|
|
|
TeamFortress_SetSpeed(self);
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
self.is_feigning = TRUE;
|
2001-07-17 05:58:10 +00:00
|
|
|
Attack_Finished(0.8);
|
|
|
|
|
|
|
|
// make dead guy release hook (wedge)
|
|
|
|
if (self.hook_out)
|
|
|
|
{
|
|
|
|
Reset_Grapple (self.hook);
|
|
|
|
Attack_Finished(0.75);
|
2001-07-23 20:52:47 +00:00
|
|
|
self.hook_out = TRUE; // PutClientInServer will reset this
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (self.undercover_team == 0 && self.undercover_skin == 0)
|
2001-08-10 10:03:36 +00:00
|
|
|
self.items = self.items & ~IT_INVISIBILITY;
|
2001-07-17 05:58:10 +00:00
|
|
|
self.invisible_finished = 0;
|
|
|
|
self.modelindex = modelindex_player; // don't use eyes
|
|
|
|
|
|
|
|
// Save the current weapon and remove it
|
|
|
|
self.weapon = self.current_weapon;
|
|
|
|
self.current_weapon = 0;
|
|
|
|
self.weaponmodel = "";
|
|
|
|
self.weaponframe = 0;
|
|
|
|
|
|
|
|
//WK setsize (self, '-16 -16 -24', '16 16 4');
|
|
|
|
//WK Make people fall to the ground when they feign
|
|
|
|
// Ambush, the guy that made MegaTF swears that there is no way
|
|
|
|
// to lower the camera angle, and even has a letter from Carmack
|
|
|
|
// testifying to that fact...
|
|
|
|
// Here's how you do it, moron:
|
|
|
|
// setsize (self, '0 0 -10', '0 0 0');
|
|
|
|
setsize (self, '-16 -16 -24', '16 16 4');
|
|
|
|
self.view_ofs = '0 0 4';
|
2001-07-23 20:52:47 +00:00
|
|
|
self.movetype = MOVETYPE_TOSS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
if (type == 1) //CH normal feign
|
|
|
|
DeathSound();
|
|
|
|
|
|
|
|
self.angles_x = 0;
|
|
|
|
self.angles_z = 0;
|
|
|
|
|
|
|
|
// Check .weapon, because .current_weapon has been reset
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.weapon <= WEAP_AXE)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
spy_die_ax1 ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 1 + floor(random()*6);
|
|
|
|
|
|
|
|
if (i == 1)
|
|
|
|
spy_diea1();
|
|
|
|
else if (i == 2)
|
|
|
|
spy_dieb1();
|
|
|
|
else if (i == 3)
|
|
|
|
spy_diec1();
|
|
|
|
else if (i == 4)
|
|
|
|
spy_died1();
|
|
|
|
else
|
|
|
|
spy_diee1();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// If its a net game, the SPY goes invisible.
|
|
|
|
// If its a LAN game, the class/skin changing menu pops up.
|
|
|
|
void() TeamFortress_SpyGoUndercover =
|
|
|
|
{
|
|
|
|
local entity te;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT))
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_MEDIUM, "You cannot disguise while glowing.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (invis_only == TRUE)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
// If the spy is already invisible, become visible
|
|
|
|
if (self.is_undercover == 1)
|
|
|
|
{
|
|
|
|
self.is_undercover = 0;
|
|
|
|
self.modelindex = modelindex_player; // return to normal
|
2001-08-10 10:03:36 +00:00
|
|
|
//WK self.items = self.items & ~IT_INVISIBILITY;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
else if (self.is_undercover == 2)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "You stop going undercover.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
self.is_undercover = 0;
|
|
|
|
}
|
|
|
|
else // Become invisible
|
|
|
|
{
|
|
|
|
if (self.ammo_cells > 1)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "Going undercover...\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
self.is_undercover = 2;
|
|
|
|
|
|
|
|
// Start a timer, which turns the player invisible when it ticks
|
|
|
|
te = spawn();
|
|
|
|
te.classname = "timer";
|
|
|
|
te.owner = self;
|
|
|
|
te.think = TeamFortress_SpyUndercoverThink;
|
2001-07-23 20:52:47 +00:00
|
|
|
te.nextthink = time + PC_SPY_GO_UNDERCOVER_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
self.StatusRefreshTime = time + 0.1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Pop up the menu
|
|
|
|
if (self.is_undercover != 2)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
self.current_menu = MENU_SPY;
|
|
|
|
self.menu_count = MENU_REFRESH_RATE;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
else // if (self.is_undercover == 2)
|
|
|
|
{
|
|
|
|
//WK Fix TF2.5 bug
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "You stop going undercover.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
if (self.undercover_team != 0 || self.undercover_skin != 0)
|
|
|
|
self.is_undercover = 1;
|
|
|
|
else
|
|
|
|
self.is_undercover = 0;
|
2001-11-02 17:00:52 +00:00
|
|
|
local entity ent = NIL;
|
2001-10-08 19:13:33 +00:00
|
|
|
while (ent = find (ent, classname, "timer")) {
|
|
|
|
if (ent.owner == self && ent.think == TeamFortress_SpyUndercoverThink) {
|
|
|
|
ent.think = SUB_Remove;
|
|
|
|
ent.nextthink = time + 0.1;
|
|
|
|
}
|
|
|
|
}
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Try and find the player's name who's skin and team closest fit the
|
|
|
|
// current disguise of the spy
|
|
|
|
void(entity spy) TeamFortress_SpyCalcName =
|
|
|
|
{
|
|
|
|
local entity te;
|
|
|
|
|
2001-09-30 22:38:44 +00:00
|
|
|
spy.undercover_name = "";
|
2001-07-17 05:58:10 +00:00
|
|
|
// Find a player on the team the spy is disguised as to pretend to be
|
|
|
|
if (spy.undercover_team != 0)
|
|
|
|
{
|
2001-11-02 17:00:52 +00:00
|
|
|
te = find(NIL, classname, "player");
|
2001-07-17 05:58:10 +00:00
|
|
|
while (te)
|
|
|
|
{
|
|
|
|
// First, try to find a player with same color and skins
|
|
|
|
if (te.team_no == spy.undercover_team && te.skin == spy.undercover_skin)
|
|
|
|
{
|
|
|
|
spy.undercover_name = te.netname;
|
2001-11-02 17:00:52 +00:00
|
|
|
te = NIL;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
te = find(te, classname, "player");
|
|
|
|
}
|
|
|
|
|
|
|
|
// If we couldn't, just find one of that team
|
2001-09-30 22:38:44 +00:00
|
|
|
if (!spy.undercover_name)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-11-02 17:00:52 +00:00
|
|
|
te = find(NIL, classname, "player");
|
2001-07-17 05:58:10 +00:00
|
|
|
while (te)
|
|
|
|
{
|
|
|
|
if (te.team_no == spy.undercover_team)
|
|
|
|
{
|
|
|
|
spy.undercover_name = te.netname;
|
2001-11-02 17:00:52 +00:00
|
|
|
te = NIL;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
te = find(te, classname, "player");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Make the spy who owns this timer undercover, and then remove itself
|
|
|
|
void() TeamFortress_SpyUndercoverThink =
|
|
|
|
{
|
2001-07-24 20:54:19 +00:00
|
|
|
local float tc, tc2;
|
2001-07-17 05:58:10 +00:00
|
|
|
local string st;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (!(self.owner.cutf_items & CUTF_SPY_KIT)) //WK
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (self.owner.is_undercover == 2)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
//WK self.owner.items = self.owner.items | IT_INVISIBILITY;
|
|
|
|
if (invis_only == TRUE)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
self.owner.frame = 0;
|
|
|
|
self.owner.modelindex = modelindex_eyes;
|
|
|
|
self.owner.is_undercover = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
makeImmune(self.owner,time + 4);
|
|
|
|
//self.owner.immune_to_check = time + 4;
|
|
|
|
|
|
|
|
// Skin change?
|
|
|
|
if (self.skin != 0)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self.owner, PRINT_HIGH, "Skin set to ");
|
2001-07-17 05:58:10 +00:00
|
|
|
TeamFortress_PrintClassName(self.owner,self.skin,0);
|
|
|
|
|
|
|
|
self.owner.undercover_skin = self.skin;
|
|
|
|
TeamFortress_SetSkin(self.owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Color change
|
|
|
|
if (self.team != 0)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self.owner, PRINT_HIGH, "Colors set to Team ");
|
2001-07-17 05:58:10 +00:00
|
|
|
st = ftos(self.team);
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self.owner, PRINT_HIGH, st);
|
|
|
|
sprint(self.owner, PRINT_HIGH, "\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
self.owner.undercover_team = self.team;
|
2001-07-24 20:54:19 +00:00
|
|
|
// Set their color
|
|
|
|
tc = TeamGetColor (self.team) - 1;
|
|
|
|
tc2 = TeamGetNiceColor (self.team);
|
|
|
|
SetPlayerColor (self.owner, tc, tc2);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TeamFortress_SpyCalcName(self.owner);
|
|
|
|
|
|
|
|
if (self.owner.StatusBarSize == 0)
|
|
|
|
CenterPrint(self.owner, "You are now disguised.\n");
|
|
|
|
|
|
|
|
self.owner.is_undercover = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
self.owner.StatusRefreshTime = time + 0.1;
|
|
|
|
//CH go to special bar :)
|
|
|
|
self.owner.StatusBarScreen = 2;
|
|
|
|
|
|
|
|
dremove(self);
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Change the Spy's skin to the class they chose
|
|
|
|
void(float class) TeamFortress_SpyChangeSkin =
|
|
|
|
{
|
|
|
|
local entity te;
|
|
|
|
|
|
|
|
// If they're returning their skin to their Spy, just reset it
|
2001-07-23 20:52:47 +00:00
|
|
|
if (class == PC_SPY && self.playerclass == PC_SPY) //WK
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint (self, PRINT_HIGH, "Skin reset.");
|
2001-07-17 05:58:10 +00:00
|
|
|
self.undercover_skin = 0;
|
|
|
|
TeamFortress_SetSkin(self);
|
|
|
|
|
|
|
|
if (self.undercover_team == 0)
|
|
|
|
{
|
2001-08-10 10:03:36 +00:00
|
|
|
//WK self.items = self.items & ~IT_INVISIBILITY;
|
2001-07-17 05:58:10 +00:00
|
|
|
self.is_undercover = 0;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "Going undercover...\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
self.is_undercover = 2;
|
|
|
|
|
|
|
|
// Start a timer, which changes the spy's skin to the chosen one
|
|
|
|
te = spawn();
|
|
|
|
te.classname = "timer";
|
|
|
|
te.owner = self;
|
|
|
|
te.think = TeamFortress_SpyUndercoverThink;
|
2001-07-23 20:52:47 +00:00
|
|
|
te.nextthink = time + PC_SPY_GO_UNDERCOVER_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
te.skin = class;
|
|
|
|
TeamFortress_SetSkin(self);
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Change the Spy's color to that of the Team they chose
|
|
|
|
void(float teamno) TeamFortress_SpyChangeColor =
|
|
|
|
{
|
|
|
|
local entity te;
|
2001-07-24 20:54:19 +00:00
|
|
|
local float tc, tc2;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
// If they're returning their color to their own team, just reset it
|
|
|
|
if (teamno == self.team_no)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint (self, PRINT_HIGH, "Colors reset.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
makeImmune(self,time + 4);
|
|
|
|
//self.immune_to_check = time + 4;
|
|
|
|
self.undercover_team = 0;
|
2001-07-24 20:54:19 +00:00
|
|
|
tc = TeamGetColor (self.team_no) - 1;
|
|
|
|
tc2 = TeamGetNiceColor (self.team_no);
|
|
|
|
SetPlayerColor (self, tc, tc2);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
if (self.undercover_skin == 0)
|
|
|
|
{
|
2001-08-10 10:03:36 +00:00
|
|
|
//WK self.items = self.items & ~IT_INVISIBILITY;
|
2001-07-17 05:58:10 +00:00
|
|
|
self.is_undercover = 0;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self, PRINT_HIGH, "Going undercover...\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
self.is_undercover = 2;
|
|
|
|
|
|
|
|
// Start a timer, which changes the spy's skin to the chosen one
|
|
|
|
te = spawn();
|
|
|
|
te.classname = "timer";
|
|
|
|
te.owner = self;
|
|
|
|
te.think = TeamFortress_SpyUndercoverThink;
|
2001-07-23 20:52:47 +00:00
|
|
|
te.nextthink = time + PC_SPY_GO_UNDERCOVER_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
te.team = teamno;
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Gas Grenade touch function.
|
|
|
|
void() GasGrenadeTouch =
|
|
|
|
{
|
|
|
|
// Thrown grenades don't detonate when hitting an enemy
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
|
2001-07-17 05:58:10 +00:00
|
|
|
if (self.velocity == '0 0 0')
|
|
|
|
self.avelocity = '0 0 0';
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Gas grenade explosion. Throws up the particle cloud.
|
|
|
|
void() GasGrenadeExplode =
|
|
|
|
{
|
|
|
|
local entity te;
|
|
|
|
local float pos;
|
|
|
|
|
|
|
|
// Check the pointcontents to prevent detpack outside the world
|
|
|
|
pos = pointcontents(self.origin);
|
2001-07-31 17:08:59 +00:00
|
|
|
if (pos == CONTENTS_EMPTY)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
te = spawn();
|
|
|
|
te.think = GasGrenadeMakeGas;
|
|
|
|
te.nextthink = time + 0.1;
|
|
|
|
te.heat = 0;
|
|
|
|
te.origin = self.origin;
|
|
|
|
te.owner = self.owner;
|
|
|
|
te.team_no = self.owner.team_no;
|
|
|
|
te.weapon = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Make some bubbles :)
|
|
|
|
pos = 0;
|
|
|
|
while (pos < 10)
|
|
|
|
{
|
|
|
|
newmis = spawn();
|
|
|
|
setmodel (newmis, "progs/s_bubble.spr");
|
|
|
|
setorigin (newmis, self.origin);
|
2001-07-23 20:52:47 +00:00
|
|
|
newmis.movetype = MOVETYPE_NOCLIP;
|
|
|
|
newmis.solid = SOLID_NOT;
|
2001-07-17 05:58:10 +00:00
|
|
|
newmis.velocity = '0 0 15';
|
|
|
|
newmis.velocity_z = 10 + (random() * 20);
|
|
|
|
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');
|
|
|
|
|
|
|
|
pos = pos + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEMO_STUFF
|
|
|
|
// Remove any camera's locks on this missile
|
|
|
|
if (self.enemy)
|
|
|
|
CamProjectileLockOff();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
dremove(self);
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Gas Grenade Gas function
|
|
|
|
void() GasGrenadeMakeGas =
|
|
|
|
{
|
|
|
|
local entity te, timer;
|
|
|
|
|
|
|
|
self.nextthink = time + 0.75;
|
|
|
|
|
|
|
|
// Do the Effects
|
|
|
|
te = findradius(self.origin, 200);
|
2001-11-02 17:00:52 +00:00
|
|
|
while (te)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (te.classname == "player" && te.deadflag == DEAD_NO)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
//Dont affect those with gas masks or invincible or biosuits
|
2001-07-23 20:52:47 +00:00
|
|
|
if (!(te.tf_items & NIT_SCUBA || te.invincible_finished > time || te.radsuit_finished > time)) //WK
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
// Damage
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_GREN_GAS;
|
2001-07-17 05:58:10 +00:00
|
|
|
if (self.heat = 0)
|
2001-11-02 17:00:52 +00:00
|
|
|
TF_T_Damage (te, NIL, self.owner, 20, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
|
2001-07-17 05:58:10 +00:00
|
|
|
else
|
2001-11-02 17:00:52 +00:00
|
|
|
TF_T_Damage (te, NIL, self.owner, 40, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
// Make them hallucinate
|
2001-07-23 20:52:47 +00:00
|
|
|
if (te.tfstate & TFSTATE_HALLUCINATING)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
// Already Hallucination, so just increase the time
|
2001-11-02 17:00:52 +00:00
|
|
|
timer = find(NIL, classname, "timer");
|
|
|
|
while (((timer.owner != te) || (timer.think != HallucinationTimer)) && (timer))
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
timer = find(timer, classname, "timer");
|
|
|
|
}
|
2001-11-02 17:00:52 +00:00
|
|
|
if (timer)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
timer.health = timer.health + 50; //SB used to be 25
|
|
|
|
if (timer.health > 100)
|
|
|
|
timer.health = 100;
|
2001-07-23 20:52:47 +00:00
|
|
|
timer.nextthink = time + GR_HALLU_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(te, PRINT_HIGH, "You stop breathing as the poison attacks your nerves...\n");
|
|
|
|
te.tfstate = te.tfstate | TFSTATE_HALLUCINATING;
|
2001-07-17 05:58:10 +00:00
|
|
|
// Create a timer entity
|
|
|
|
timer = spawn();
|
2001-07-23 20:52:47 +00:00
|
|
|
timer.nextthink = time + GR_HALLU_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
timer.think = HallucinationTimer;
|
|
|
|
timer.classname = "timer";
|
|
|
|
timer.owner = te;
|
|
|
|
timer.health = 75; //WK 100 - this makes it more balanced
|
|
|
|
//SB 25 - this makes it more funner
|
|
|
|
timer.team_no = self.team_no;
|
|
|
|
}
|
|
|
|
} //WK --^
|
|
|
|
}
|
|
|
|
te = te.chain;
|
|
|
|
}
|
|
|
|
|
|
|
|
self.heat = self.heat + 1;
|
|
|
|
|
|
|
|
// Do the cloud
|
|
|
|
if (self.heat == 1)
|
|
|
|
{
|
2001-10-13 23:02:22 +00:00
|
|
|
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
|
|
|
|
WriteByte (MSG_MULTICAST, TE_TAREXPLOSION);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_x);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_y);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_z);
|
2001-07-23 20:52:47 +00:00
|
|
|
multicast (self.origin, MULTICAST_PVS);
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (self.heat <= 3)
|
|
|
|
{
|
|
|
|
self.weapon = self.weapon + 1;
|
|
|
|
if (self.weapon == 1)
|
|
|
|
{
|
2001-10-13 23:02:22 +00:00
|
|
|
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
|
|
|
|
WriteByte (MSG_MULTICAST, TE_LAVASPLASH);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_x);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_y);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_z - 24);
|
2001-07-23 20:52:47 +00:00
|
|
|
multicast (self.origin, MULTICAST_PVS);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
else if (self.weapon == 2)
|
|
|
|
{
|
|
|
|
self.weapon = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dremove(self);
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Timer function for Hallucinations.
|
|
|
|
void() HallucinationTimer =
|
|
|
|
{
|
|
|
|
local entity te;
|
|
|
|
local float tmpx, tmpy, halltype;
|
|
|
|
|
|
|
|
// Setup for the next Think
|
2001-07-23 20:52:47 +00:00
|
|
|
self.health = self.health - GR_HALLU_DEC;
|
2001-07-17 05:58:10 +00:00
|
|
|
// medic recovers twice as fast
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.owner.weapons_carried & WEAP_MEDIKIT) //WK
|
|
|
|
self.health = self.health - GR_HALLU_DEC;
|
2001-07-17 05:58:10 +00:00
|
|
|
if (self.health <= 0)
|
2001-07-23 20:52:47 +00:00
|
|
|
self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & TFSTATE_HALLUCINATING);
|
|
|
|
if (!(self.owner.tfstate & TFSTATE_HALLUCINATING))
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self.owner, PRINT_HIGH, "You feel a little better now.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
dremove(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
self.nextthink = time + GR_HALLU_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
// Kick
|
|
|
|
if (random() < 0.5)
|
|
|
|
{
|
|
|
|
KickPlayer(-10, self.owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do the Hallucinations
|
|
|
|
tmpx = (random() * 800) - 400;
|
|
|
|
tmpy = (random() * 800) - 400;
|
|
|
|
halltype = random();
|
|
|
|
msg_entity = self.owner;
|
|
|
|
// Explosions
|
|
|
|
if (halltype < 0.4) //WK .4 We want all hallucination to be explosions. :)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
WriteByte (MSG_ONE, SVC_TEMPENTITY);
|
2001-07-17 05:58:10 +00:00
|
|
|
if (halltype < 0.4)
|
2001-07-23 20:52:47 +00:00
|
|
|
WriteByte (MSG_ONE, TE_EXPLOSION);
|
2001-07-17 05:58:10 +00:00
|
|
|
else if (halltype < 0.6)
|
2001-07-23 20:52:47 +00:00
|
|
|
WriteByte (MSG_ONE, TE_TAREXPLOSION);
|
2001-07-17 05:58:10 +00:00
|
|
|
else // if (halltype < 0.4)
|
2001-07-23 20:52:47 +00:00
|
|
|
WriteByte (MSG_ONE, TE_LAVASPLASH);
|
|
|
|
WriteCoord (MSG_ONE, msg_entity.origin_x + tmpx);
|
|
|
|
WriteCoord (MSG_ONE, msg_entity.origin_y + tmpy);
|
|
|
|
WriteCoord (MSG_ONE, msg_entity.origin_z);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
// Teleport
|
|
|
|
else if (halltype < 0.7)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
WriteByte (MSG_ONE, SVC_TEMPENTITY);
|
|
|
|
WriteByte (MSG_ONE, TE_TELEPORT);
|
|
|
|
WriteCoord (MSG_ONE, msg_entity.origin_x + tmpx);
|
|
|
|
WriteCoord (MSG_ONE, msg_entity.origin_y + tmpy);
|
|
|
|
WriteCoord (MSG_ONE, msg_entity.origin_z);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
// Lightning
|
|
|
|
else // if (halltype < 1)
|
|
|
|
{
|
|
|
|
te = spawn();
|
|
|
|
te.origin_x = msg_entity.origin_x + tmpx;
|
|
|
|
te.origin_y = msg_entity.origin_y + tmpy;
|
|
|
|
te.origin_z = msg_entity.origin_z;
|
2001-07-23 20:52:47 +00:00
|
|
|
WriteByte (MSG_ONE, SVC_TEMPENTITY);
|
|
|
|
WriteByte (MSG_ONE, TE_LIGHTNING2);
|
|
|
|
WriteEntity (MSG_ONE, te);
|
|
|
|
WriteCoord (MSG_ONE, te.origin_x);
|
|
|
|
WriteCoord (MSG_ONE, te.origin_y);
|
|
|
|
WriteCoord (MSG_ONE, te.origin_z);
|
2001-07-17 05:58:10 +00:00
|
|
|
tmpx = (random() * 800) - 400;
|
|
|
|
tmpy = (random() * 800) - 400;
|
2001-07-23 20:52:47 +00:00
|
|
|
WriteCoord (MSG_ONE, msg_entity.origin_x + tmpx);
|
|
|
|
WriteCoord (MSG_ONE, msg_entity.origin_y + tmpy);
|
|
|
|
WriteCoord (MSG_ONE, msg_entity.origin_z);
|
2001-07-17 05:58:10 +00:00
|
|
|
dremove(te);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Firing Function for the Tranquiliser Gun
|
|
|
|
void() W_FireTranq =
|
|
|
|
{
|
|
|
|
self.currentammo = self.ammo_nails = self.ammo_nails - 1;
|
|
|
|
|
|
|
|
KickPlayer(-2, self);
|
|
|
|
|
|
|
|
newmis = spawn ();
|
|
|
|
newmis.owner = self;
|
2001-07-23 20:52:47 +00:00
|
|
|
newmis.movetype = MOVETYPE_FLYMISSILE;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
makevectors (self.v_angle);
|
|
|
|
newmis.velocity = v_forward;
|
|
|
|
newmis.velocity = newmis.velocity * 1500; // Faster than a normal nail WK 1500
|
|
|
|
newmis.angles = vectoangles(newmis.velocity);
|
|
|
|
|
|
|
|
newmis.touch = T_TranqDartTouch;
|
|
|
|
|
|
|
|
newmis.think = SUB_Remove;
|
|
|
|
newmis.nextthink = time + 6;
|
|
|
|
|
|
|
|
setmodel (newmis, "progs/spike.mdl");
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
setorigin (newmis, self.origin + v_forward*8 + '0 0 16');
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Touch Function for the Tranquiliser Darts
|
|
|
|
void() T_TranqDartTouch =
|
|
|
|
{
|
|
|
|
local entity timer;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.solid == SOLID_TRIGGER)
|
2001-07-17 05:58:10 +00:00
|
|
|
return; // trigger field, do nothing
|
|
|
|
|
2001-07-31 17:08:59 +00:00
|
|
|
if (pointcontents(self.origin) == CONTENTS_SKY)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
dremove(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//WK Sweep for mines at point of contact
|
|
|
|
GuerillaMineSweep(self.origin);
|
|
|
|
|
|
|
|
// hit something that bleeds
|
|
|
|
if (other.takedamage)
|
|
|
|
{
|
|
|
|
//WK Make sure they aren't immune
|
2001-07-23 20:52:47 +00:00
|
|
|
if (!(other.tf_items & NIT_SCUBA || other.invincible_finished > time || other.radsuit_finished > time))
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
spawn_touchblood (9);
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_TRANQ;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
// Do the Damage
|
2001-07-23 20:52:47 +00:00
|
|
|
TF_T_Damage (other, self, self.owner, 10, TF_TD_NOTTEAM, TF_TD_NAIL);
|
2001-07-17 05:58:10 +00:00
|
|
|
// If its a player or demon, tranquilise them
|
2001-07-23 20:52:47 +00:00
|
|
|
//- OfN if (other.classname == "monster_demon1" && !(Teammate(other.real_owner.team_no,self.owner.team_no) && (teamplay & (TEAMPLAY_HALFDIRECT | TEAMPLAY_NODIRECT))))
|
|
|
|
if (IsMonster(other))// && !(Teammate(other.real_owner.team_no,self.owner.team_no) && (teamplay & (TEAMPLAY_HALFDIRECT | TEAMPLAY_NODIRECT))))
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
//bprint(PRINT_HIGH, "demon tranq!\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
// If they're already tranquilised, just make it last longer
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.tfstate & TFSTATE_TRANQUILISED)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-11-02 17:00:52 +00:00
|
|
|
timer = find(NIL, classname, "timer");
|
|
|
|
while (((timer.owner != other) || (timer.think != TranquiliserTimer2)) && (timer))
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
timer = find(timer, classname, "timer");
|
|
|
|
}
|
2001-11-02 17:00:52 +00:00
|
|
|
if (timer)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
timer.nextthink = time + TRANQ_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
other.tfstate = other.tfstate | TFSTATE_TRANQUILISED;
|
2001-07-17 05:58:10 +00:00
|
|
|
// Create a timer entity
|
|
|
|
timer = spawn();
|
2001-07-23 20:52:47 +00:00
|
|
|
timer.nextthink = time + TRANQ_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
timer.think = TranquiliserTimer2;
|
|
|
|
timer.classname = "timer";
|
|
|
|
timer.owner = other;
|
|
|
|
timer.team_no = self.owner.team_no;
|
|
|
|
}
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.classname == "player" && !(Teammate(other.team_no, self.owner.team_no) && (teamplay & (TEAMPLAY_HALFDIRECT | TEAMPLAY_NODIRECT))))
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
// If they're already tranquilised, just make it last longer
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.tfstate & TFSTATE_TRANQUILISED)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-11-02 17:00:52 +00:00
|
|
|
timer = find(NIL, classname, "timer");
|
|
|
|
while (((timer.owner != other) || (timer.think != TranquiliserTimer)) && (timer))
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
timer = find(timer, classname, "timer");
|
|
|
|
}
|
2001-11-02 17:00:52 +00:00
|
|
|
if (timer)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
timer.nextthink = time + TRANQ_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(other, PRINT_HIGH, "You stop breathing...\n");
|
|
|
|
other.tfstate = other.tfstate | TFSTATE_TRANQUILISED;
|
2001-07-17 05:58:10 +00:00
|
|
|
// Create a timer entity
|
|
|
|
timer = spawn();
|
2001-07-23 20:52:47 +00:00
|
|
|
timer.nextthink = time + TRANQ_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
timer.think = TranquiliserTimer;
|
|
|
|
timer.classname = "timer";
|
|
|
|
timer.owner = other;
|
|
|
|
timer.team_no = self.owner.team_no;
|
|
|
|
|
|
|
|
// now slow them down
|
|
|
|
TeamFortress_SetSpeed(other);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (other.classname == "force_field") //- OfN - Makes field explosion b4 removing it
|
|
|
|
FieldExplosion(other,self.origin,self);
|
|
|
|
else
|
|
|
|
{
|
2001-10-13 23:02:22 +00:00
|
|
|
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
|
|
|
|
WriteByte (MSG_MULTICAST, TE_SPIKE);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_x);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_y);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_z);
|
2001-07-23 20:52:47 +00:00
|
|
|
multicast (self.origin, MULTICAST_PVS);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dremove(self);
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Think function for Tranquilisation.
|
|
|
|
// Just remove the player's tranquilisation.
|
|
|
|
void() TranquiliserTimer =
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & TFSTATE_TRANQUILISED);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
TeamFortress_SetSpeed(self.owner);
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint(self.owner, PRINT_HIGH, "You feel more alert now\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
dremove(self);
|
|
|
|
};
|
|
|
|
//CH used for demons
|
|
|
|
void() TranquiliserTimer2 =
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.owner.tfstate & TFSTATE_TRANQUILISED) //Just in case
|
|
|
|
self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & TFSTATE_TRANQUILISED);
|
2001-07-17 05:58:10 +00:00
|
|
|
dremove(self);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Reset spy skin and color or remove invisibility
|
|
|
|
void(entity spy) Spy_RemoveDisguise =
|
|
|
|
{
|
2001-07-24 20:54:19 +00:00
|
|
|
local float tc, tc2;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (invis_only != TRUE)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (spy.cutf_items & CUTF_SPY_KIT)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
// Reset the Skin
|
|
|
|
if (spy.undercover_skin != 0)
|
|
|
|
{
|
2001-08-10 10:03:36 +00:00
|
|
|
//WK spy.items = spy.items & ~IT_INVISIBILITY;
|
2001-07-17 05:58:10 +00:00
|
|
|
makeImmune(spy,time + 4);
|
|
|
|
//spy.immune_to_check = time + 4;
|
|
|
|
spy.undercover_skin = 0;
|
|
|
|
spy.skin = 0;
|
|
|
|
TeamFortress_SetSkin(spy);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set their color
|
|
|
|
if (spy.undercover_team != 0)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
//WK spy.items = spy.items - (spy.items & IT_INVISIBILITY);
|
2001-07-17 05:58:10 +00:00
|
|
|
makeImmune(spy,time + 4);
|
|
|
|
//spy.immune_to_check = time + 4;
|
|
|
|
spy.undercover_team = 0;
|
|
|
|
|
2001-07-24 20:54:19 +00:00
|
|
|
tc = TeamGetColor (spy.team_no) - 1;
|
|
|
|
tc2 = TeamGetNiceColor (spy.team_no);
|
|
|
|
SetPlayerColor (spy, tc, tc2);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
spy.is_undercover = 0;
|
|
|
|
self.StatusRefreshTime = time + 0.1;
|
|
|
|
|
|
|
|
TeamFortress_SpyCalcName(spy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (spy.is_undercover)
|
|
|
|
{
|
|
|
|
// remove the invisibility
|
|
|
|
spy.is_undercover = 0;
|
|
|
|
spy.modelindex = modelindex_player; // return to normal
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
//WK if (spy.items & IT_INVISIBILITY)
|
2001-08-10 10:03:36 +00:00
|
|
|
//WK spy.items = spy.items & ~IT_INVISIBILITY;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
self.StatusRefreshTime = time + 0.1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|