2001-07-17 05:58:10 +00:00
/*======================================================
CLIENT . QC Custom TeamFortress v3 .2
( c ) TeamFortress Software Pty Ltd 29 / 2 / 97
( c ) William Kerney 16 / 9 / 00
( c ) Craig Hauser 19 / 3 / 00
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Handles obituaries , what happens when a client dies , respawns ,
connects & disconnects , and when a map changes levels
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
2001-07-23 20:52:47 +00:00
# include "defs.qh"
2001-07-17 05:58:10 +00:00
// prototypes
void ( ) W_WeaponFrame ;
void ( ) W_SetCurrentAmmo ;
void ( ) player_pain ;
void ( ) player_stand1 ;
void ( vector org ) spawn_tfog ;
void ( vector org , entity death_owner ) spawn_tdeath ;
float modelindex_eyes , modelindex_player , modelindex_null ;
float ( float v ) anglemod ;
//void () SetUpChrisRound;//-
void ( ) PrematchBegin ;
void ( ) TeamAllPlayers ;
//void (float winner) RoundStop;//-
//void () UpdateScores;
//void () roundtimer_think;//-
//void () EndRound;//-
// TeamFortress prototypes
void ( ) TeamFortress_MOTD ;
void ( ) TeamFortress_CheckTeamCheats ;
2001-07-24 16:03:08 +00:00
//float(float tno) TeamGetColor; //- OfN - not used here
2001-07-17 05:58:10 +00:00
void ( entity Viewer , float pc , float rpc ) TeamFortress_PrintClassName ;
void ( entity Viewer , float pc ) TeamFortress_PrintJobName ;
void ( ) TeamFortress_RemoveTimers ;
void ( float Suicided ) TeamFortress_SetupRespawn ;
void ( ) TeamFortress_ShowTF ;
float ( float pc ) IsLegalClass ;
void ( ) SetupTeamEqualiser ;
void ( entity p ) SetTeamName ;
void ( float number ) decrement_team_ammoboxes ;
void ( ) TeamFortress_DetonatePipebombs ;
void ( float f ) decrement_team_pipebombs ;
void ( ) PlayerObserverMode ;
// Hook prototypes
void ( ) Service_Grapple ;
// TeamFortressMap prototypes
void ( entity AD ) ParseTFDetect ;
entity ( float ino ) Finditem ;
void ( entity Item , entity AP , entity Goal ) tfgoalitem_GiveToPlayer ;
void ( entity Goal , entity AP , entity ActivatingGoal ) AttemptToActivate ;
void ( ) CTF_FlagCheck ;
//WK
void ( ) DropToCustomClassGen ;
void ( entity p ) TeamFortress_SetSpeed ;
void ( ) kill_my_demon ;
void ( ) DetonateAllGuns ; // SB
void ( ) Boot_Flamer_stream_touch ;
void ( entity foo , float bar ) makeImmune ;
// SB Extern
void ( entity targ ) GetRank ;
//void() SwitchFromCamera;
//==============// ofn
void ( entity mine_owner ) DetonateMines ;
void ( entity player ) RemoveHolo ;
string ( entity thebuilding ) GetBuildingName ;
string ( entity themonster ) GetMonsterName ;
void ( entity attacker ) MonsterKill ;
void ( ) DetonateAllGunsForced ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
LEVEL CHANGING / INTERMISSION
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
string nextmap ;
float intermission_running ;
float intermission_exittime ;
/*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
This is the camera point for the intermission .
Use mangle instead of angle , so you can set pitch or roll as well as yaw . ' pitch roll yaw '
*/
void ( ) info_intermission =
{
2001-07-23 20:52:47 +00:00
if ( CheckExistence ( ) = = FALSE )
2001-07-17 05:58:10 +00:00
{
dremove ( self ) ;
return ;
}
} ;
void ( ) SetChangeParms =
{
if ( self . health < = 0 )
{
SetNewParms ( ) ;
return ;
}
// remove items
2001-08-10 10:03:36 +00:00
self . items = self . items & ~ ( IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD ) ;
2001-07-17 05:58:10 +00:00
// cap super health
if ( self . health > 100 )
self . health = 100 ;
if ( self . health < 50 )
self . health = 50 ;
parm1 = self . items ;
parm2 = self . health ;
parm3 = self . armorvalue ;
if ( self . ammo_shells < 25 )
parm4 = 25 ;
else
parm4 = self . ammo_shells ;
parm5 = self . ammo_nails ;
parm6 = self . ammo_rockets ;
parm7 = self . ammo_cells ;
parm8 = self . current_weapon ;
parm9 = self . armortype * 100 ;
// TeamFortress Parameters
parm10 = toggleflags ; // Store the global ToggleFlag settings
parm11 = 0 ; // Random Playerclass
parm12 = 0 ;
# ifdef COOP_MODE
2001-07-23 20:52:47 +00:00
if ( toggleflags & TFLAG_CLASS_PERSIST )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
if ( self . tfstate & TFSTATE_RANDOMPC )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
parm11 = ( parm11 | TFSTATE_RANDOMPC ) ;
self . playerclass = 1 + floor ( random ( ) * ( PC_RANDOM - 1 ) ) ;
2001-07-17 05:58:10 +00:00
while ( ! IsLegalClass ( self . playerclass ) )
2001-07-23 20:52:47 +00:00
self . playerclass = 1 + floor ( random ( ) * ( PC_RANDOM - 1 ) ) ;
2001-07-17 05:58:10 +00:00
}
parm12 = self . playerclass ; // save the playerclass between levels in parm12
} // if the toggleflag CLASS_PERSIST is set
# endif
# ifdef STATUSBAR
parm13 = self . StatusBarRes ;
parm14 = self . StatusBarSize ;
# endif
parm15 = self . admin_flag ; //CH Pass along admin status :)
} ;
void ( ) SetNewParms =
{
parm1 = 0 ;
parm2 = 100 ;
parm3 = 0 ;
parm4 = 25 ;
parm5 = 0 ;
parm6 = 0 ;
parm6 = 0 ;
parm8 = 1 ;
parm9 = 0 ;
// TeamFortress Parameters
parm10 = 0 ;
parm11 = 0 ;
parm12 = 0 ;
parm13 = 0 ;
parm14 = 0 ;
parm15 = 0 ;
} ;
// This think kicks in 30 seconds into the map to
// turn autoteam on.
void ( ) autoteam_think =
{
// if (chris)
// SetUpChrisRound();
// if (!chris)
PrematchBegin ( ) ;
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags | TFLAG_AUTOTEAM ;
2001-07-17 05:58:10 +00:00
dremove ( self ) ;
} ;
void ( ) PrematchBegin =
{
if ( prematch )
{
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " <EFBFBD> The game has now started! <10> \n " ) ;
2001-07-17 05:58:10 +00:00
other = find ( world , classname , " player " ) ;
while ( other ! = world )
{
2001-07-23 20:52:47 +00:00
other . is_abouttodie = TRUE ;
2001-08-10 10:03:36 +00:00
other . items = other . items & ~ IT_INVULNERABILITY ;
2001-07-17 05:58:10 +00:00
other . invincible_time = 0 ;
other . invincible_finished = 0 ;
2001-07-23 20:52:47 +00:00
other . effects = other . effects - ( other . effects & EF_DIMLIGHT ) ;
TF_T_Damage ( other , world , world , other . health + 20 , TF_TD_IGNOREARMOUR , TF_TD_OTHER ) ;
2001-07-17 05:58:10 +00:00
other = find ( other , classname , " player " ) ;
}
// - OfN - wtf
/*other = find(world, classname, "grunty");
while ( other ! = world )
{
2001-07-23 20:52:47 +00:00
other . is_abouttodie = TRUE ;
2001-08-10 10:03:36 +00:00
other . items = other . items & ~ IT_INVULNERABILITY ;
2001-07-17 05:58:10 +00:00
other . invincible_time = 0 ;
other . invincible_finished = 0 ;
2001-07-23 20:52:47 +00:00
other . effects = other . effects - ( other . effects & EF_DIMLIGHT ) ;
TF_T_Damage ( other , world , world , other . health + 20 , TF_TD_IGNOREARMOUR , TF_TD_OTHER ) ;
2001-07-17 05:58:10 +00:00
other = find ( other , classname , " grunty " ) ;
} */
}
/* if (chris)
{
if ( self . classname = = " prematch_timer " )
dremove ( self ) ;
else
SetUpChrisRound ( ) ;
} */
} ;
/*void () SetUpChrisRound =
{
local entity other , oself ;
// Make sure everyone is on a team
TeamAllPlayers ( ) ;
// Clean up team player counts
team1total = 0 ;
team2total = 0 ;
team3total = 0 ;
team4total = 0 ;
oself = self ;
other = find ( world , classname , " player " ) ;
while ( other ! = world )
{
if ( livesperguy > 0 )
{
if ( other . team_no = = 1 ) team1total = team1total + livesperguy ;
if ( other . team_no = = 2 ) team2total = team2total + livesperguy ;
if ( other . team_no = = 3 ) team3total = team3total + livesperguy ;
if ( other . team_no = = 4 ) team4total = team4total + livesperguy ;
other . lives = livesperguy ;
}
self = other ;
kill_my_demon ( ) ;
DetonateAllGuns ( ) ;
2001-07-23 20:52:47 +00:00
TF_T_Damage ( other , world , world , other . health + 20 , TF_TD_IGNOREARMOUR , TF_TD_OTHER ) ;
2001-07-17 05:58:10 +00:00
other = find ( other , classname , " player " ) ;
}
newmis = spawn ( ) ;
newmis . classname = " chris_round_timer " ;
newmis . nextthink = time + roundtime ;
newmis . think = roundtimer_think ;
} ; */
/*void() roundtimer_think =
{
RoundStop ( 0 ) ;
dremove ( self ) ;
} ; */
void ( ) TeamAllPlayers =
{
local entity other , oself ;
other = find ( world , classname , " player " ) ;
while ( other ! = world )
{
if ( other . team_no < = 0 & & ! other . has_disconnected )
{
oself = self ;
self = other ;
Menu_Team_Input ( 5 ) ;
self = oself ;
}
other = find ( other , classname , " player " ) ;
}
} ;
/*void (float winner) RoundStop =
{
if ( winner = = 0 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , " The round has ended due to time. \n " ) ;
2001-07-17 05:58:10 +00:00
else
{
if ( winner = = 1 )
{
team1rounds = team1rounds + 1 ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , " The blue team wins the round. \n " ) ;
2001-07-17 05:58:10 +00:00
}
if ( winner = = 2 )
{
team2rounds = team2rounds + 1 ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , " This round goes to the red team. \n " ) ;
2001-07-17 05:58:10 +00:00
}
if ( winner = = 3 )
{
team3rounds = team3rounds + 1 ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , " The yellow team are sponsored by SB-1 Tech and have won this round. \n " ) ;
2001-07-17 05:58:10 +00:00
}
if ( winner = = 4 )
{
team4rounds = team4rounds + 1 ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , " The green team are the winners of this round. \n " ) ;
2001-07-17 05:58:10 +00:00
}
}
UpdateScores ( ) ;
newmis = spawn ( ) ;
newmis . nextthink = time + 1 ;
newmis . think = EndRound ;
} ; */
/*void() UpdateScores =
{
local entity guy ;
guy = find ( other , classname , " player " ) ;
while ( guy ! = world )
{
if ( guy . team_no = = 1 )
{
guy . frags = team1rounds * 10 ;
guy . real_frags = team1rounds * 10 ;
}
else if ( guy . team_no = = 2 )
{
guy . frags = team2rounds * 10 ;
guy . real_frags = team2rounds * 10 ;
}
else if ( guy . team_no = = 3 )
{
guy . frags = team3rounds * 10 ;
guy . real_frags = team3rounds * 10 ;
}
else if ( guy . team_no = = 4 )
{
guy . frags = team4rounds * 10 ;
guy . real_frags = team4rounds * 10 ;
}
guy = find ( guy , classname , " other " ) ;
}
} ; */ /////////////??/////////////7
/*void() EndRound =
{
local entity roundtimer , prematchtimer ;
local float winner , prematchtime ;
local string st ;
// Kill the round timer
other = find ( world , classname , " chris_round_timer " ) ;
// I deliberately don't do a contingency check here - if it screws up I wanna know about it
dremove ( other ) ;
st = infokey ( world , " pm " ) ;
if ( st = = string_null ) // if 'pm' isn't set, try 'prematch'
st = infokey ( world , " prematch " ) ;
if ( st = = " on " ) // if it reads 'on', do a 30 second prematch
prematchtime = time + 30 ;
else // if it doesn't read 'on'...
prematchtime = stof ( st ) ; // turn the string into a float
if ( prematchtime ) // if we have prematch
{
prematch = time + prematchtime ; // set it
}
else
2001-07-23 20:52:47 +00:00
prematch = FALSE ; // otherwise, no prematch
2001-07-17 05:58:10 +00:00
// Kill everyone
/* other = find(world, classname, "player");
while ( other ! = world )
{
2001-07-23 20:52:47 +00:00
TF_T_Damage ( other , world , world , other . health + 20 , TF_TD_IGNOREARMOUR , TF_TD_OTHER ) ;
2001-07-17 05:58:10 +00:00
other = find ( other , classname , " player " ) ;
} Don ' t kill everyone here or it drops the flag
*/
// Set up the timer
/*- if (team1rounds < roundstowin && team2rounds < roundstowin && team3rounds < roundstowin && team4rounds < roundstowin)
{
roundtimer = spawn ( ) ;
roundtimer . think = SetUpChrisRound ;
roundtimer . nextthink = time + 5 ;
prematchtimer = spawn ( ) ;
prematchtimer . classname = = " prematch_timer " ;
prematchtimer . nextthink = time + prematch ;
prematchtimer . think = PrematchBegin ;
}
else
{
newmis = spawn ( ) ;
newmis . nextthink = time + 5 ;
newmis . think = execute_changelevel ;
}
} ; */
void ( ) DecodeLevelParms =
{
local string st ;
local entity ent ;
local float prematchtime ;
if ( serverflags )
{
if ( world . model = = " maps/start.bsp " )
SetNewParms ( ) ; // take away all stuff on starting new episode
}
self . items = parm1 ;
self . health = parm2 ;
self . armorvalue = parm3 ;
self . ammo_shells = parm4 ;
self . ammo_nails = parm5 ;
self . ammo_rockets = parm6 ;
self . ammo_cells = parm7 ;
self . current_weapon = parm8 ;
self . armortype = parm9 * 0.01 ;
2001-08-01 06:08:35 +00:00
SetTeamName ( self ) ;
2001-08-13 12:20:39 +00:00
SetPlayerColor ( self , TeamGetNiceColor ( self . team_no ) , TeamGetColor ( self . team_no ) - 1 ) ;
2001-08-01 06:08:35 +00:00
2001-07-17 05:58:10 +00:00
// TeamFortress Parameters
// Detect whether this is the first entrance into a map
if ( toggleflags = = 0 )
{
toggleflags = parm10 ;
allow_hook = 0 ;
2001-07-23 20:52:47 +00:00
invis_only = SPY_INVIS_ONLY ;
2001-07-17 05:58:10 +00:00
if ( coop | | ! deathmatch )
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags | TFLAG_CLASS_PERSIST ;
2001-07-17 05:58:10 +00:00
nextmap = mapname ;
# ifdef GRAPPLING_HOOK
2001-07-23 20:52:47 +00:00
allow_hook = TRUE ;
2001-07-17 05:58:10 +00:00
# endif
// Is this a FortressMap?
ent = find ( world , classname , " info_tfdetect " ) ;
if ( ent ! = world )
{
// Turn on Teamplay
if ( teamplay = = 0 )
cvar_set ( " teamplay " , " 21?TeamFortress " ) ;
// Parse the rest of the Detection details
ParseTFDetect ( ent ) ;
// If the number_of_teams wasn't set, then there's not TF
// spawnpoints on this lvl... so guess at 4 teams.
if ( number_of_teams < = 0 | | number_of_teams > = 5 )
number_of_teams = 4 ;
}
else
{
// Is this a CTF map?
ent = find ( world , classname , " info_player_team1 " ) ;
2001-07-23 20:52:47 +00:00
if ( ( ent ! = world ) | | ( CTF_Map = = TRUE ) )
2001-07-17 05:58:10 +00:00
{
// Turn on CTF MAP
2001-07-23 20:52:47 +00:00
CTF_Map = TRUE ;
2001-07-17 05:58:10 +00:00
// Turn on Teamplay
if ( teamplay = = 0 )
cvar_set ( " teamplay " , " 21?TeamFortress " ) ;
// Setup the CTF FlagCheck Timer
ent = spawn ( ) ;
ent . nextthink = time + 30 ;
ent . think = CTF_FlagCheck ;
number_of_teams = 2 ;
}
else // Normal map
{
number_of_teams = 4 ;
}
// set aiming level
# ifndef NET_SERVER
cvar_set ( " sv_aim " , " 1 " ) ;
# endif
// Set life limits
team1lives = - 1 ;
team2lives = - 1 ;
team3lives = - 1 ;
team4lives = - 1 ;
// WK Clear our nextspam counters
team1nextspam = - 1 ;
team2nextspam = - 1 ;
team3nextspam = - 1 ;
team4nextspam = - 1 ;
// Set illegal playerclasses
illegalclasses1 = 0 ;
illegalclasses2 = 0 ;
illegalclasses3 = 0 ;
illegalclasses4 = 0 ;
// Set Team Limits
team1maxplayers = 100 ;
team2maxplayers = 100 ;
team3maxplayers = 100 ;
team4maxplayers = 100 ;
civilianteams = 0 ;
}
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> : " ) ;
bprint ( PRINT_HIGH , mapname ) ;
bprint ( PRINT_HIGH , " \n " ) ;
2001-07-17 05:58:10 +00:00
SetupTeamEqualiser ( ) ;
2001-07-23 20:52:47 +00:00
if ( NEVER_TEAMFRAGS )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags - ( toggleflags & TFLAG_TEAMFRAGS ) ;
2001-07-17 05:58:10 +00:00
}
2001-07-23 20:52:47 +00:00
if ( ALWAYS_TEAMFRAGS )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags | TFLAG_TEAMFRAGS ;
2001-07-17 05:58:10 +00:00
}
2001-07-23 20:52:47 +00:00
if ( CHECK_SPEEDS )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags | TFLAG_CHEATCHECK ;
2001-07-17 05:58:10 +00:00
}
st = infokey ( world , " temp1 " ) ;
2001-07-23 20:52:47 +00:00
toggleflags = ( toggleflags | TFLAG_FIRSTENTRY | stof ( st ) ) ;
2001-07-17 05:58:10 +00:00
local float autoteam_time ;
autoteam_time = 30 ;
// check all serverinfo settings, to set the appropriate toggleflags
// AUTOTEAM
st = infokey ( world , " a " ) ;
if ( st = = string_null )
st = infokey ( world , " autoteam " ) ;
if ( st = = " on " )
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags | TFLAG_AUTOTEAM ;
2001-07-17 05:58:10 +00:00
else if ( st = = " off " )
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags - ( toggleflags & TFLAG_AUTOTEAM ) ;
2001-07-17 05:58:10 +00:00
else if ( stof ( st ) ! = 0 )
{
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags | TFLAG_AUTOTEAM ;
2001-07-17 05:58:10 +00:00
autoteam_time = stof ( st ) ;
}
// TEAMFRAGS
st = infokey ( world , " t " ) ;
if ( st = = string_null )
st = infokey ( world , " teamfrags " ) ;
if ( st = = " on " )
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags | TFLAG_TEAMFRAGS ;
2001-07-17 05:58:10 +00:00
else if ( st = = " off " )
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags - ( toggleflags & TFLAG_TEAMFRAGS ) ;
2001-07-17 05:58:10 +00:00
//WK JELLO WATER
st = infokey ( world , " j " ) ;
if ( st = = string_null )
st = infokey ( world , " jello " ) ;
if ( st = = " on " )
2001-07-23 20:52:47 +00:00
jello = TRUE ;
2001-07-17 05:58:10 +00:00
else {
local float numba ;
numba = stof ( st ) ;
if ( numba )
jello = numba ;
else
2001-07-23 20:52:47 +00:00
jello = FALSE ;
2001-07-17 05:58:10 +00:00
}
//WK JELLO WATER
2001-07-23 20:52:47 +00:00
light_damage = FALSE ;
2001-07-17 05:58:10 +00:00
st = infokey ( world , " ld " ) ;
if ( st = = string_null )
st = infokey ( world , " lightdamage " ) ;
if ( st = = " on " )
2001-07-23 20:52:47 +00:00
light_damage = TRUE ;
2001-07-17 05:58:10 +00:00
// SB New, improved TF 2.9 fake prematch mode!
// We can make a class, come in, run around, play tag the flag, but can't do anything
// useful until the prematch is over!
st = infokey ( world , " pm " ) ;
if ( st = = string_null ) // if 'pm' isn't set, try 'prematch'
st = infokey ( world , " prematch " ) ;
if ( st = = " on " ) // if it reads 'on', do a 30 second prematch
prematchtime = time + 30 ;
else // if it doesn't read 'on'...
prematchtime = stof ( st ) ; // turn the string into a float
if ( prematchtime ) // if we have prematch
{
prematch = time + prematchtime ; // set it
autoteam_time = prematchtime ;
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags | TFLAG_AUTOTEAM ;
2001-07-17 05:58:10 +00:00
}
else
2001-07-23 20:52:47 +00:00
prematch = FALSE ; // otherwise, no prematch
2001-07-17 05:58:10 +00:00
//WK Bounty System
st = infokey ( world , " bounty " ) ;
if ( st = = string_null )
st = infokey ( world , " moola " ) ;
if ( st = = " on " )
2001-07-23 20:52:47 +00:00
bounty = TRUE ;
2001-07-17 05:58:10 +00:00
else
2001-07-23 20:52:47 +00:00
bounty = FALSE ;
2001-07-17 05:58:10 +00:00
//CH Sets the starting amount of money :)
st = infokey ( world , " m " ) ;
if ( st = = string_null )
st = infokey ( world , " money " ) ;
local float numba ;
numba = stof ( st ) ;
if ( numba )
custom_money = numba ;
else
2001-07-23 20:52:47 +00:00
custom_money = SPENDING_LIMIT ;
2001-07-17 05:58:10 +00:00
// GRAPPLING HOOK
st = infokey ( world , " g " ) ;
if ( st = = string_null )
st = infokey ( world , " grapple " ) ;
if ( st = = " off " )
2001-07-23 20:52:47 +00:00
allow_hook = FALSE ;
if ( ! ( toggleflags & TFLAG_GRAPPLE ) & & st ! = " on " )
allow_hook = FALSE ;
2001-07-17 05:58:10 +00:00
// SPY OFF
st = infokey ( world , " spy " ) ;
if ( st = = " off " )
2001-07-23 20:52:47 +00:00
spy_off = TRUE ;
2001-07-17 05:58:10 +00:00
// SPY INVIS ONLY
st = infokey ( world , " s " ) ;
if ( st = = string_null )
st = infokey ( world , " spyinvis " ) ;
2001-07-23 20:52:47 +00:00
if ( st = = " on " | | toggleflags & TFLAG_SPYINVIS )
invis_only = TRUE ;
2001-07-17 05:58:10 +00:00
else if ( st = = " off " )
2001-07-23 20:52:47 +00:00
invis_only = FALSE ;
2001-07-17 05:58:10 +00:00
// RespawnDelay
st = infokey ( world , " rd " ) ;
if ( st = = string_null )
st = infokey ( world , " respawn_delay " ) ;
respawn_delay_time = stof ( st ) ;
if ( respawn_delay_time )
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags | TFLAG_RESPAWNDELAY ;
2001-07-17 05:58:10 +00:00
// If no Respawndelay has been specified, set the default
2001-07-23 20:52:47 +00:00
if ( toggleflags & TFLAG_RESPAWNDELAY & & respawn_delay_time = = 0 )
respawn_delay_time = RESPAWN_DELAY_TIME ;
2001-07-17 05:58:10 +00:00
// Prevent autoteam from kicking in for 30 seconds.
// Allows restructuring of the teams from the last map nicely.
2001-07-23 20:52:47 +00:00
if ( toggleflags & TFLAG_AUTOTEAM )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
toggleflags = toggleflags - ( toggleflags & TFLAG_AUTOTEAM ) ;
2001-07-17 05:58:10 +00:00
ent = spawn ( ) ;
ent . nextthink = time + autoteam_time ;
ent . think = autoteam_think ;
}
2001-09-22 18:38:45 +00:00
st = infokey ( world , " improve_respawns " ) ;
if ( st = = " 1 " | | st = = " on " ) {
local entity ent = world ;
while ( ent = find ( ent , classname , " info_tfgoal " ) ) {
if ( ent . ammo_shells & & ent . ammo_nails
& & ent . ammo_rockets & & ent . ammo_cells
& & ent . armorvalue & & ent . health ) {
if ( ent . ammo_shells < 200 )
ent . ammo_shells = 200 ;
if ( ent . ammo_nails < 200 )
ent . ammo_nails = 200 ;
if ( ent . ammo_rockets < 200 )
ent . ammo_rockets = 200 ;
if ( ent . ammo_cells < 200 )
ent . ammo_cells = 200 ;
if ( ent . ammo_medikit < 100 )
ent . ammo_medikit = 100 ;
if ( ent . ammo_detpack < 2 )
ent . ammo_detpack = 2 ;
if ( ent . armortype < 0.8 )
ent . armortype = 0.8 ;
if ( ent . armorvalue < 300 )
ent . armorvalue = 300 ;
if ( ent . health < 200 )
ent . health = 200 ;
if ( ent . wait > 0 )
ent . wait = 0.5 ;
if ( ent . no_grenades_1 < 2 )
ent . no_grenades_1 = 2 ;
if ( ent . no_grenades_2 < 2 )
ent . no_grenades_2 = 2 ;
}
}
}
2001-07-17 05:58:10 +00:00
}
if ( parm11 )
self . tfstate = parm11 ;
if ( self . playerclass = = 0 )
self . playerclass = parm12 ;
# ifdef STATUSBAR
if ( parm13 )
self . StatusBarRes = parm13 ;
if ( parm14 )
self . StatusBarSize = parm14 ;
# endif
if ( parm15 )
self . admin_flag = parm15 ; //CH Admin status :)
} ;
/*
= = = = = = = = = = = =
FindIntermission
Returns the entity to view from
= = = = = = = = = = = =
*/
entity ( ) FindIntermission =
{
local entity spot ;
local float cyc ;
// look for info_intermission first
spot = find ( world , classname , " info_intermission " ) ;
if ( spot )
{ // pick a random one
cyc = random ( ) * 1 ;
// Following removed for the observer code
/*while (cyc > 1)
{
spot = find ( spot , classname , " info_intermission " ) ;
if ( ! spot )
spot = find ( spot , classname , " info_intermission " ) ;
cyc = cyc - 1 ;
} */
return spot ;
}
// then look for the start position
spot = find ( world , classname , " info_player_start " ) ;
if ( spot )
return spot ;
// then look through the deathmatch starts
spot = find ( world , classname , " info_player_deathmatch " ) ;
if ( spot )
{
// pick a random one
cyc = random ( ) * 6 ;
while ( cyc > 1 )
{
spot = find ( spot , classname , " info_player_deathmatch " ) ;
if ( ! spot )
spot = find ( spot , classname , " info_player_deathmatch " ) ;
cyc = cyc - 1 ;
}
return spot ;
}
objerror ( " FindIntermission: no spot " ) ;
} ;
/*===========================
FindNextIntermission
returns the next intermission point
= = = = = = = = = = = = = = = = = = = = = = = = = = = */
entity ( entity start_point ) FindNextIntermission =
{
local entity spot ;
if ( deathmatch )
{
// look through info_intermission first
if ( start_point . classname = = " info_intermission " | | start_point = = world )
{
spot = find ( start_point , classname , " info_intermission " ) ;
if ( spot )
return spot ;
else
start_point = world ;
}
// then look through the deathmatch starts
if ( start_point . classname = = " info_player_deathmatch " | | start_point = = world )
{
spot = find ( start_point , classname , " info_player_deathmatch " ) ;
if ( spot )
return spot ;
}
// at the end of the list
spot = find ( world , classname , " info_intermission " ) ;
if ( spot )
return spot ;
spot = find ( world , classname , " info_player_deathmatch " ) ;
if ( spot )
return spot ;
}
else // do not cycle though in co-op or single
{
spot = find ( world , classname , " info_player_start " ) ;
if ( spot )
return spot ;
}
// it should never reach this point
return FindIntermission ( ) ;
} ;
/*==================================================
TF_MovePlayer
Moves the player to another intermission viewpoint
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
void ( ) TF_MovePlayer =
{
local entity place ;
place = FindNextIntermission ( self . observer_list ) ;
self . observer_list = place ;
setorigin ( self , place . origin + ' 0 0 1 ' ) ;
self . angles = place . angles ;
2001-07-23 20:52:47 +00:00
self . fixangle = TRUE ; // turn this way immediately
2001-07-17 05:58:10 +00:00
} ;
float ( ) GetNoPlayers ;
# define CYCLED 2
float ( ) DoExtraCycle =
{
//-------------------------------------------------//
//- OfN - I tried to make this work like in tf2.8 -//
local string nfmap , temp ;
nfmap = infokey ( world , " nmap " ) ;
if ( nfmap ! = string_null )
{
local float minplayers , maxplayers , itsok , currentpl ;
if ( infokey ( world , " minp " ) ! = " " )
minplayers = stof ( infokey ( world , " minp " ) ) ;
else
minplayers = 0 ;
if ( infokey ( world , " maxp " ) ! = " " )
maxplayers = stof ( infokey ( world , " maxp " ) ) ;
else
maxplayers = 32 ;
2001-07-23 20:52:47 +00:00
itsok = TRUE ;
2001-07-17 05:58:10 +00:00
currentpl = GetNoPlayers ( ) ;
//check conditions
if ( minplayers > currentpl )
{
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " Map " ) ;
2001-07-17 05:58:10 +00:00
nfmap = infokey ( world , " nmap " ) ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , nfmap ) ;
bprint ( PRINT_HIGH , " skipped - minimum players " ) ;
2001-07-17 05:58:10 +00:00
temp = ftos ( minplayers ) ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , temp ) ;
bprint ( PRINT_HIGH , " (currently " ) ;
2001-07-17 05:58:10 +00:00
temp = ftos ( currentpl ) ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , temp ) ;
bprint ( PRINT_HIGH , " ) \n " ) ;
itsok = FALSE ;
2001-07-17 05:58:10 +00:00
}
else
{
if ( maxplayers < currentpl )
{
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " Map " ) ;
2001-07-17 05:58:10 +00:00
nfmap = infokey ( world , " nmap " ) ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , nfmap ) ;
bprint ( PRINT_HIGH , " skipped - maximum players " ) ;
2001-07-17 05:58:10 +00:00
temp = ftos ( maxplayers ) ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , temp ) ;
bprint ( PRINT_HIGH , " (currently " ) ;
2001-07-17 05:58:10 +00:00
temp = ftos ( currentpl ) ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , temp ) ;
bprint ( PRINT_HIGH , " ) \n " ) ;
itsok = FALSE ;
2001-07-17 05:58:10 +00:00
}
}
//cleanup..
localcmd ( " localinfo minp \" \" \n " ) ;
localcmd ( " localinfo maxp \" \" \n " ) ;
//locals clean
//execute map conditions ok
if ( itsok )
{
nfmap = infokey ( world , " nmap " ) ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " \n Loading " ) ;
bprint ( PRINT_HIGH , nfmap ) ;
bprint ( PRINT_HIGH , " map file... \n " ) ;
2001-07-17 05:58:10 +00:00
localcmd ( " localinfo nmap \" \" \n " ) ;
localcmd ( " map " ) ;
localcmd ( nfmap ) ;
localcmd ( " \n " ) ;
2001-07-23 20:52:47 +00:00
return TRUE ;
2001-07-17 05:58:10 +00:00
}
else //conditions not passed...
{
localcmd ( " localinfo nmap \" \" \n " ) ;
2001-07-23 20:52:47 +00:00
return FALSE ;
2001-07-17 05:58:10 +00:00
}
}
2001-07-23 20:52:47 +00:00
return FALSE ;
2001-07-17 05:58:10 +00:00
} ;
void ( ) GotoNextMap ;
void ( ) cycle_timer_think =
{
GotoNextMap ( ) ;
dremove ( self ) ;
} ;
void ( ) SetCycleTimer =
{
newmis = spawn ( ) ;
newmis . classname = " cyclemap_timer " ;
newmis . nextthink = time + 0.1 ;
newmis . think = cycle_timer_think ;
} ;
2001-07-23 15:08:39 +00:00
float ( ) GetNextMapNum =
{
local float desc ;
local string st ;
local string infostring ;
local float infonum ;
infostring = infokey ( world , " n " ) ;
infonum = stof ( infostring ) ;
if ( infostring ! = " " ) // always use info when available
return infonum ;
if ( cvar ( " crudefile_quota " ) < 0 )
return infonum ;
desc = cfopen ( " nextmapnum " , " r " ) ;
if ( desc < 0 )
return infonum ;
st = cfread ( desc ) ;
if ( st = = " " )
{
cfclose ( desc ) ;
return infonum ;
}
cfclose ( desc ) ;
return stof ( st ) ;
} ;
void ( float mapnum ) SetNextMapNum =
{
local float desc ;
local string mapstring ;
mapstring = ftos ( mapnum ) ;
if ( cvar ( " crudefile_quota " ) > = 0 )
{
desc = cfopen ( " nextmapnum " , " w " ) ;
// if nextmapnum has a num in it, but we can't modify it.. stuck in a loop
if ( desc > = 0 )
{
cfwrite ( desc , mapstring ) ;
cfclose ( desc ) ;
}
}
localcmd ( " serverinfo n \" \" \n " ) ; // use localinfo instead
localcmd ( " localinfo n " ) ;
localcmd ( mapstring ) ;
localcmd ( " \n " ) ;
} ;
void ( ) LoadNextMap =
2001-07-17 05:58:10 +00:00
{
local float nextlevel ;
local string cyc ;
2001-07-23 15:08:39 +00:00
local float desc ;
local float mapcount ;
local string map ;
nextlevel = GetNextMapNum ( ) ;
nextlevel = nextlevel + 1 ; // next level
SetNextMapNum ( nextlevel ) ;
// get count of maps
mapcount = 0 ;
desc = cfopen ( " mapcycle " , " r " ) ;
while ( cfread ( desc ) ! = " " )
mapcount = mapcount + 1 ;
2001-07-23 18:54:41 +00:00
cfclose ( desc ) ;
2001-07-23 15:08:39 +00:00
if ( mapcount > 0 )
{
if ( nextlevel > mapcount )
{
while ( nextlevel > mapcount )
nextlevel = nextlevel - mapcount ;
SetNextMapNum ( nextlevel ) ;
}
desc = cfopen ( " mapcycle " , " r " ) ;
local float i ;
i = 0 ;
while ( i < nextlevel )
{
i = i + 1 ;
map = cfread ( desc ) ;
}
if ( map = = " " )
mapcount = 0 ; // fall back to old mapcycle method
else
localcmd ( " map " + map + " \n " ) ;
}
if ( mapcount = = 0 )
{
cyc = infokey ( world , " cycledir " ) ;
if ( cyc = = string_null )
cyc = " qwmcycle " ;
localcmd ( " exec " ) ;
localcmd ( cyc ) ;
localcmd ( " /map " ) ;
localcmd ( ftos ( nextlevel ) ) ;
localcmd ( " .cfg \n " ) ;
2001-07-23 20:52:47 +00:00
already_chosen_map = CYCLED ;
2001-07-23 15:08:39 +00:00
}
} ;
void ( ) GotoNextMap =
{
2001-07-17 05:58:10 +00:00
if ( nextmap ! = mapname )
{
changelevel ( nextmap ) ;
2001-07-23 20:52:47 +00:00
already_chosen_map = TRUE ;
2001-07-17 05:58:10 +00:00
}
2001-07-23 20:52:47 +00:00
if ( already_chosen_map = = FALSE | | already_chosen_map = = CYCLED )
2001-07-17 05:58:10 +00:00
{
if ( DoExtraCycle ( ) )
2001-07-23 20:52:47 +00:00
already_chosen_map = TRUE ;
2001-07-17 05:58:10 +00:00
else
2001-07-23 20:52:47 +00:00
already_chosen_map = FALSE ;
2001-07-17 05:58:10 +00:00
}
//- OfN - super new map cycling code :)
2001-07-23 20:52:47 +00:00
if ( already_chosen_map = = FALSE )
2001-07-23 15:08:39 +00:00
LoadNextMap ( ) ;
2001-07-17 05:58:10 +00:00
2001-07-23 15:08:39 +00:00
if ( GetNextMapNum ( ) = = 0 )
2001-07-23 20:52:47 +00:00
already_chosen_map = FALSE ;
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
if ( already_chosen_map = = FALSE ) // nothing was done yet, so set the damn timer..
2001-07-17 05:58:10 +00:00
{
SetCycleTimer ( ) ;
return ;
}
2001-07-23 20:52:47 +00:00
if ( already_chosen_map = = CYCLED ) // if we executed a mapx.cfg
2001-07-17 05:58:10 +00:00
SetCycleTimer ( ) ; // set the timer to check the real map afte 0.1 seconds
} ;
void ( ) ExitIntermission =
{
RPrint ( " Exiting intermission... \n " ) ;
// skip any text in deathmatch
if ( deathmatch )
{
RPrint ( " Exit Intermission in Deathmatch. \n " ) ;
GotoNextMap ( ) ;
return ;
}
intermission_exittime = time + 1 ;
intermission_running = intermission_running + 1 ;
//
// run some text if at the end of an episode
//
if ( intermission_running = = 2 )
{
if ( world . model = = " maps/e1m7.bsp " )
{
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_CDTRACK ) ;
WriteByte ( MSG_ALL , 2 ) ;
WriteByte ( MSG_ALL , 3 ) ;
2001-07-17 05:58:10 +00:00
if ( ! cvar ( " registered " ) )
{
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_FINALE ) ;
WriteString ( MSG_ALL , " As the corpse of the monstrous entity \n Chthon sinks back into the lava whence \n it rose, you grip the Rune of Earth \n Magic tightly. Now that you have \n conquered the Dimension of the Doomed, \n realm of Earth Magic, you are ready to \n complete your task in the other three \n haunted lands of Quake. Or are you? If \n you don't register Quake, you'll never \n know what awaits you in the Realm of \n Black Magic, the Netherworld, and the \n Elder World! " ) ;
2001-07-17 05:58:10 +00:00
}
else
{
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_FINALE ) ;
WriteString ( MSG_ALL , " As the corpse of the monstrous entity \n Chthon sinks back into the lava whence \n it rose, you grip the Rune of Earth \n Magic tightly. Now that you have \n conquered the Dimension of the Doomed, \n realm of Earth Magic, you are ready to \n complete your task. A Rune of magic \n power lies at the end of each haunted \n land of Quake. Go forth, seek the \n totality of the four Runes! " ) ;
2001-07-17 05:58:10 +00:00
}
return ;
}
else if ( world . model = = " maps/e2m6.bsp " )
{
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_CDTRACK ) ;
WriteByte ( MSG_ALL , 2 ) ;
WriteByte ( MSG_ALL , 3 ) ;
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_FINALE ) ;
WriteString ( MSG_ALL , " The Rune of Black Magic throbs evilly in \n your hand and whispers dark thoughts \n into your brain. You learn the inmost \n lore of the Hell-Mother; Shub-Niggurath! \n You now know that she is behind all the \n terrible plotting which has led to so \n much death and horror. But she is not \n inviolate! Armed with this Rune, you \n realize that once all four Runes are \n combined, the gate to Shub-Niggurath's \n Pit will open, and you can face the \n Witch-Goddess herself in her frightful \n otherworld cathedral. " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
else if ( world . model = = " maps/e3m6.bsp " )
{
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_CDTRACK ) ;
WriteByte ( MSG_ALL , 2 ) ;
WriteByte ( MSG_ALL , 3 ) ;
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_FINALE ) ;
WriteString ( MSG_ALL , " The charred viscera of diabolic horrors \n bubble viscously as you seize the Rune \n of Hell Magic. Its heat scorches your \n hand, and its terrible secrets blight \n your mind. Gathering the shreds of your \n courage, you shake the devil's shackles \n from your soul, and become ever more \n hard and determined to destroy the \n hideous creatures whose mere existence \n threatens the souls and psyches of all \n the population of Earth. " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
else if ( world . model = = " maps/e4m7.bsp " )
{
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_CDTRACK ) ;
WriteByte ( MSG_ALL , 2 ) ;
WriteByte ( MSG_ALL , 3 ) ;
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_FINALE ) ;
WriteString ( MSG_ALL , " Despite the awful might of the Elder \n World, you have achieved the Rune of \n Elder Magic, capstone of all types of \n arcane wisdom. Beyond good and evil, \n beyond life and death, the Rune \n pulsates, heavy with import. Patient and \n potent, the Elder Being Shub-Niggurath \n weaves her dire plans to clear off all \n life from the Earth, and bring her own \n foul offspring to our world! For all the \n dwellers in these nightmare dimensions \n are her descendants! Once all Runes of \n magic power are united, the energy \n behind them will blast open the Gateway \n to Shub-Niggurath, and you can travel \n there to foil the Hell-Mother's plots \n in person. " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
GotoNextMap ( ) ;
}
if ( intermission_running = = 3 )
{
if ( ! cvar ( " registered " ) )
{ // shareware episode has been completed, go to sell screen
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_SELLSCREEN ) ;
2001-07-17 05:58:10 +00:00
return ;
}
if ( ( serverflags & 15 ) = = 15 )
{
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_FINALE ) ;
WriteString ( MSG_ALL , " Now, you have all four Runes. You sense \n tremendous invisible forces moving to \n unseal ancient barriers. Shub-Niggurath \n had hoped to use the Runes Herself to \n clear off the Earth, but now instead, \n you will use them to enter her home and \n confront her as an avatar of avenging \n Earth-life. If you defeat her, you will \n be remembered forever as the savior of \n the planet. If she conquers, it will be \n as if you had never been born. " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
}
RPrint ( " Exit Intermission. \n " ) ;
GotoNextMap ( ) ;
} ;
/*
= = = = = = = = = = = =
IntermissionThink
When the player presses attack or jump , change to the next level
= = = = = = = = = = = =
*/
void ( ) IntermissionThink =
{
if ( time < intermission_exittime )
return ;
if ( ! self . button0 & & ! self . button1 & & ! self . button2 )
return ;
if ( ! triggered_cycle )
{
RPrint ( " Intermission think. \n " ) ;
2001-07-23 20:52:47 +00:00
triggered_cycle = TRUE ;
2001-07-17 05:58:10 +00:00
GotoNextMap ( ) ;
}
} ;
void ( ) PrintResults ;
void ( ) execute_changelevel =
{
local entity pos ;
RPrint ( " execute_changelevel() \n " ) ;
PrintResults ( ) ;
intermission_running = 1 ;
// enforce a wait time before allowing changelevel
intermission_exittime = time + 5 ;
pos = FindIntermission ( ) ;
// play intermission music
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ALL , SVC_CDTRACK ) ;
WriteByte ( MSG_ALL , 3 ) ;
WriteByte ( MSG_ALL , SVC_INTERMISSION ) ;
WriteCoord ( MSG_ALL , pos . origin_x ) ;
WriteCoord ( MSG_ALL , pos . origin_y ) ;
WriteCoord ( MSG_ALL , pos . origin_z ) ;
WriteAngle ( MSG_ALL , pos . mangle_x ) ;
WriteAngle ( MSG_ALL , pos . mangle_y ) ;
WriteAngle ( MSG_ALL , pos . mangle_z ) ;
2001-07-17 05:58:10 +00:00
other = find ( world , classname , " player " ) ;
while ( other ! = world )
{
2001-07-23 20:52:47 +00:00
other . takedamage = DAMAGE_NO ;
other . solid = SOLID_NOT ;
other . movetype = MOVETYPE_NONE ;
2001-07-17 05:58:10 +00:00
other . modelindex = 0 ;
other = find ( other , classname , " player " ) ;
}
} ;
void ( ) changelevel_touch =
{
if ( other . classname ! = " player " )
return ;
if ( cvar ( " samelevel " ) = = 2 | | ( cvar ( " samelevel " ) = = 3 & & mapname ! = " start " ) )
return ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , other . netname ) ;
bprint ( PRINT_HIGH , " exited the level \n " ) ;
2001-07-17 05:58:10 +00:00
nextmap = self . map ;
SUB_UseTargets ( ) ;
if ( ( self . spawnflags & 1 ) & & ( deathmatch = = 0 ) )
{ // NO_INTERMISSION
GotoNextMap ( ) ;
return ;
}
self . touch = SUB_Null ;
// we can't move people right now, because touch functions are called
// in the middle of C movement code, so set a think time to do it
self . think = execute_changelevel ;
self . nextthink = time + 0.1 ;
} ;
/*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
When the player touches this , he gets sent to the map listed in the " map " variable . Unless the NO_INTERMISSION flag is set , the view will go to the info_intermission spot and display stats .
*/
void ( ) trigger_changelevel =
{
2001-07-23 20:52:47 +00:00
if ( CheckExistence ( ) = = FALSE )
2001-07-17 05:58:10 +00:00
{
dremove ( self ) ;
return ;
}
if ( ! self . map )
objerror ( " changelevel trigger doesn't have map " ) ;
InitTrigger ( ) ;
self . touch = changelevel_touch ;
} ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
PLAYER GAME EDGE FUNCTIONS
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
void ( ) set_suicide_frame ;
// called by ClientKill and DeadThink
void ( ) respawn =
{
2001-07-23 20:52:47 +00:00
/* if (!(self.done_custom == 0 || (self.done_custom & CUSTOM_ON_SPAWN))) // do not spawn in prematch
2001-07-17 05:58:10 +00:00
if ( prematch < time )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Sorry, there are still " ) ;
sprint ( self , PRINT_HIGH , prematch - time ) ;
sprint ( self , PRINT_HIGH , " seconds of prematch remaining. Type custom to recreate your class. \n " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
*/
if ( coop )
{
// make a copy of the dead body for appearances sake
CopyToBodyQue ( self ) ;
// get the spawn parms as they were at level start
setspawnparms ( self ) ;
// respawn
PutClientInServer ( ) ;
}
else if ( deathmatch )
{
// make a copy of the dead body for appearances sake
CopyToBodyQue ( self ) ;
// set default spawn parms
SetNewParms ( ) ;
// respawn
PutClientInServer ( ) ;
}
else
{ // restart the entire server
localcmd ( " restart \n " ) ;
}
} ;
/*
= = = = = = = = = = = =
ClientKill
Player entered the suicide command
= = = = = = = = = = = =
*/
void ( ) ClientKill =
{
local float finished ;
local entity te ;
//WK Stop music
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_MUSIC , " items/r_item1.wav " , 0.1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
if ( self . suicide_time > time )
return ;
if ( self . deadflag )
return ;
// players can't suicide again for 10 seconds
self . suicide_time = time + 5 + ( random ( ) * 5 ) ;
//WK If building class, remove flag and start over
2001-07-23 20:52:47 +00:00
if ( self . playerclass = = PC_CUSTOM & & ( self . done_custom & CUSTOM_BUILDING ) )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " You can type 'custom' again to start over! \n " ) ;
2001-07-17 05:58:10 +00:00
return ;
2001-07-23 20:52:47 +00:00
//WK self.done_custom = CUSTOM_ON_SPAWN | CUSTOM_FINISHED;
2001-07-17 05:58:10 +00:00
}
2001-07-23 20:52:47 +00:00
if ( self . playerclass = = PC_UNDEFINED )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " You aren't alive! \n " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
if ( prematch < time )
{
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , self . netname ) ;
bprint ( PRINT_MEDIUM , " suicides \n " ) ;
2001-07-17 05:58:10 +00:00
}
set_suicide_frame ( ) ;
self . modelindex = modelindex_player ;
// If infected, give the medic a frag
2001-07-23 20:52:47 +00:00
if ( self . tfstate & TFSTATE_INFECTED )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
finished = FALSE ;
2001-07-17 05:58:10 +00:00
te = find ( world , classname , " timer " ) ;
while ( te )
{
if ( te . owner = = self & & te . think = = BioInfection_Decay )
{
logfrag ( te , self ) ;
te . enemy . real_frags = te . enemy . real_frags + 1 ;
2001-07-23 20:52:47 +00:00
if ( ! ( toggleflags & TFLAG_TEAMFRAGS ) )
2001-07-17 05:58:10 +00:00
te . enemy . frags = te . enemy . real_frags ;
2001-07-23 20:52:47 +00:00
finished = TRUE ; //Thanks lostman
2001-07-17 05:58:10 +00:00
}
te = find ( te , classname , " timer " ) ;
if ( finished ) te = world ;
}
2001-07-25 21:10:26 +00:00
} else
2001-07-17 05:58:10 +00:00
logfrag ( self , self ) ;
self . real_frags = self . real_frags - 1 ;
2001-07-23 20:52:47 +00:00
if ( teamplay & TEAMPLAY_VAMPIRE ) //WK
2001-07-17 05:58:10 +00:00
self . real_frags = self . real_frags - 1 ;
2001-07-23 20:52:47 +00:00
if ( ! ( toggleflags & TFLAG_TEAMFRAGS ) )
2001-07-17 05:58:10 +00:00
self . frags = self . real_frags ;
self . weaponmodel = " " ;
self . view_ofs = ' 0 0 - 8 ' ;
2001-07-23 20:52:47 +00:00
self . movetype = MOVETYPE_NONE ;
2001-07-17 05:58:10 +00:00
//WK If building class, remove flag and start over
2001-07-23 20:52:47 +00:00
if ( self . playerclass = = PC_CUSTOM & & ( self . done_custom & CUSTOM_BUILDING ) )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " You can type 'custom' again to start over! \n " ) ;
self . done_custom = CUSTOM_ON_SPAWN | CUSTOM_FINISHED ;
2001-07-17 05:58:10 +00:00
return ; //ch
}
// Remove all timers for this player
TeamFortress_RemoveTimers ( ) ;
2001-07-23 20:52:47 +00:00
TeamFortress_SetupRespawn ( TRUE ) ;
2001-07-17 05:58:10 +00:00
self . health = - 1 ;
self . th_die ( ) ;
2001-07-23 20:52:47 +00:00
self . deadflag = DEAD_RESPAWNABLE ;
self . tfstate = self . tfstate | TFSTATE_RESPAWN_READY ;
2001-07-17 05:58:10 +00:00
// self.respawn_time = time;
} ;
////////////////////////////////////
// FindTeamSpawnPoint
//////////
entity lastspawn_team1 ;
entity lastspawn_team2 ;
entity lastspawn_team3 ;
entity lastspawn_team4 ;
entity ( float team_num ) FindTeamSpawnPoint =
{
local entity spot ;
local entity at_spot ;
local float spot_found ;
local float attempts ;
if ( team_num = = 1 )
{
spot = lastspawn_team1 ;
attempts = 0 ;
// search through until found or end-of-list
while ( 1 )
{
attempts = attempts + 1 ;
spot = find ( spot , team_str_home , " ts1 " ) ;
if ( spot = = world )
spot = find ( world , team_str_home , " ts1 " ) ;
if ( spot = = world )
return world ;
at_spot = findradius ( spot . origin , 40 ) ;
2001-07-23 20:52:47 +00:00
spot_found = TRUE ;
2001-07-17 05:58:10 +00:00
while ( at_spot ! = world )
{
2001-07-23 20:52:47 +00:00
if ( at_spot . classname = = " player " & & at_spot . deadflag = = DEAD_NO )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
spot_found = FALSE ;
2001-07-17 05:58:10 +00:00
}
at_spot = at_spot . chain ;
}
// Check the Criteria of the spawnpoint
if ( ! Activated ( spot , self ) )
2001-07-23 20:52:47 +00:00
spot_found = FALSE ;
2001-07-17 05:58:10 +00:00
if ( ( spot_found ) | | ( attempts > = 30 ) )
{
lastspawn_team1 = spot ;
return spot ;
}
}
}
else if ( team_num = = 2 )
{
spot = lastspawn_team2 ;
attempts = 0 ;
// search through until found or end-of-list
while ( 1 )
{
attempts = attempts + 1 ;
spot = find ( spot , team_str_home , " ts2 " ) ;
if ( spot = = world )
spot = find ( world , team_str_home , " ts2 " ) ;
if ( spot = = world )
return world ;
at_spot = findradius ( spot . origin , 40 ) ;
2001-07-23 20:52:47 +00:00
spot_found = TRUE ;
2001-07-17 05:58:10 +00:00
while ( at_spot ! = world )
{
2001-07-23 20:52:47 +00:00
if ( at_spot . classname = = " player " & & at_spot . deadflag = = DEAD_NO )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
spot_found = FALSE ;
2001-07-17 05:58:10 +00:00
}
at_spot = at_spot . chain ;
}
// Check the Criteria of the spawnpoint
if ( ! Activated ( spot , self ) )
2001-07-23 20:52:47 +00:00
spot_found = FALSE ;
2001-07-17 05:58:10 +00:00
if ( ( spot_found ) | | ( attempts > = 30 ) )
{
lastspawn_team2 = spot ;
return spot ;
}
}
}
else if ( team_num = = 3 )
{
spot = lastspawn_team3 ;
attempts = 0 ;
// search through until found or end-of-list
while ( 1 )
{
attempts = attempts + 1 ;
spot = find ( spot , team_str_home , " ts3 " ) ;
if ( spot = = world )
spot = find ( world , team_str_home , " ts3 " ) ;
if ( spot = = world )
return world ;
at_spot = findradius ( spot . origin , 40 ) ;
2001-07-23 20:52:47 +00:00
spot_found = TRUE ;
2001-07-17 05:58:10 +00:00
while ( at_spot ! = world )
{
2001-07-23 20:52:47 +00:00
if ( at_spot . classname = = " player " & & at_spot . deadflag = = DEAD_NO )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
spot_found = FALSE ;
2001-07-17 05:58:10 +00:00
}
at_spot = at_spot . chain ;
}
// Check the Criteria of the spawnpoint
if ( ! Activated ( spot , self ) )
2001-07-23 20:52:47 +00:00
spot_found = FALSE ;
2001-07-17 05:58:10 +00:00
if ( ( spot_found ) | | ( attempts > = 30 ) )
{
lastspawn_team3 = spot ;
return spot ;
}
}
}
else if ( team_num = = 4 )
{
spot = lastspawn_team4 ;
attempts = 0 ;
// search through until found or end-of-list
while ( 1 )
{
attempts = attempts + 1 ;
spot = find ( spot , team_str_home , " ts4 " ) ;
if ( spot = = world )
spot = find ( world , team_str_home , " ts4 " ) ;
if ( spot = = world )
return world ;
at_spot = findradius ( spot . origin , 40 ) ;
2001-07-23 20:52:47 +00:00
spot_found = TRUE ;
2001-07-17 05:58:10 +00:00
while ( at_spot ! = world )
{
2001-07-23 20:52:47 +00:00
if ( at_spot . classname = = " player " & & at_spot . deadflag = = DEAD_NO )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
spot_found = FALSE ;
2001-07-17 05:58:10 +00:00
}
at_spot = at_spot . chain ;
}
// Check the Criteria of the spawnpoint
if ( ! Activated ( spot , self ) )
2001-07-23 20:52:47 +00:00
spot_found = FALSE ;
2001-07-17 05:58:10 +00:00
if ( ( spot_found ) | | ( attempts > = 30 ) )
{
lastspawn_team4 = spot ;
return spot ;
}
}
}
// failure
return world ;
} ;
/*
= = = = = = = = = = = =
SelectSpawnPoint
Returns the entity to spawn at
= = = = = = = = = = = =
*/
entity ( ) SelectSpawnPoint =
{
local entity spot ;
local entity at_spot ;
local float spot_found ;
local float attempts ;
// testinfo_player_start is only found in regioned levels
/*
spot = find ( world , classname , " testplayerstart " ) ;
if ( spot )
return spot ;
*/
// If FortressMap option is on, we want to make the player spawn on a
// spawnpoint marked as being one for his/her team.
// The team that owns a spawnpoint is kept in the spawnpoints's teamno
if ( self . team_no ! = 0 )
{
spot = FindTeamSpawnPoint ( self . team_no ) ;
if ( spot ! = world )
return spot ;
// failure to find a team spawn point for that player
// just move on
}
// choose a info_player_deathmatch point
if ( coop )
{
lastspawn = find ( lastspawn , classname , " info_player_coop " ) ;
if ( lastspawn = = world )
lastspawn = find ( world , classname , " info_player_coop " ) ;
if ( lastspawn ! = world )
return lastspawn ;
}
else if ( deathmatch )
{
// search through
spot = find ( lastspawn , classname , " info_player_deathmatch " ) ;
if ( spot = = world )
spot = find ( world , classname , " info_player_deathmatch " ) ;
attempts = 0 ;
while ( spot ! = world & & attempts < 100 )
{
attempts = attempts + 1 ;
// reject spot if other players are found at point
at_spot = findradius ( spot . origin , 40 ) ;
2001-07-23 20:52:47 +00:00
spot_found = TRUE ;
2001-07-17 05:58:10 +00:00
while ( at_spot )
{
2001-07-23 20:52:47 +00:00
if ( at_spot . classname = = " player " & & at_spot . deadflag = = DEAD_NO )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
spot_found = FALSE ;
2001-07-17 05:58:10 +00:00
}
at_spot = at_spot . chain ;
}
// Make sure we don't get locked by people standing on all
// the spawnpoints.
if ( ( spot_found ) | | ( attempts > = 10 ) )
{
lastspawn = spot ;
return spot ;
}
spot = find ( spot , classname , " info_player_deathmatch " ) ;
if ( spot = = world )
spot = find ( world , classname , " info_player_deathmatch " ) ;
}
}
if ( serverflags )
{ // return with a rune to start
spot = find ( world , classname , " info_player_start2 " ) ;
if ( spot )
return spot ;
}
spot = find ( world , classname , " info_player_start " ) ;
if ( ! spot )
error ( " PutClientInServer: no info_player_start on level \n " ) ;
return spot ;
} ;
/*
= = = = = = = = = = =
PutClientInServer
called each time a player is spawned
= = = = = = = = = = = =
*/
void ( ) DecodeLevelParms ;
void ( ) PlayerDie ;
void ( ) TeamFortress_SetHealth ;
void ( ) TeamFortress_SetEquipment ;
void ( ) player_touch ;
void ( entity p ) TeamFortress_SetSpeed ;
void ( entity p ) TeamFortress_SetSkin ;
void ( ) PutClientInServer =
{
local float iszoom , oldclass ;
local entity spot , te ;
self . touch = player_touch ;
self . classname = " player " ;
2001-07-23 20:52:47 +00:00
if ( self . playerclass ! = PC_CUSTOM )
2001-07-17 05:58:10 +00:00
{
self . max_health = 100 ;
self . health = 100 ;
}
//Check_Admin_Password(self); //CH check pass and sets flags
2001-07-23 20:52:47 +00:00
self . takedamage = DAMAGE_AIM ;
self . solid = SOLID_SLIDEBOX ;
self . movetype = MOVETYPE_WALK ;
2001-07-17 05:58:10 +00:00
self . show_hostile = 0 ;
self . is_malfunctioning = 0 ;
self . is_abouttodie = 0 ;
// OfN
self . has_holo = 0 ;
2001-07-23 20:52:47 +00:00
self . is_killed = FALSE ;
2001-07-17 05:58:10 +00:00
//////////////////
/* if (self.is_cameraviewing)
SwitchFromCamera ( ) ; */
self . FlashTime = 0 ;
2001-07-23 20:52:47 +00:00
self . flags = FL_CLIENT ;
2001-07-17 05:58:10 +00:00
self . aura = 0 ; //- OfN
self . crusader_inspirator = world ; // OfN - needed?
self . gravity = 1 ; //WK
self . air_finished = time + 12 ;
self . dmg = 2 ; // initial water damage
self . super_damage_finished = 0 ;
self . radsuit_finished = 0 ;
self . invisible_finished = 0 ;
self . invincible_finished = 0 ;
self . effects = 0 ;
self . invincible_time = 0 ;
self . reload_shotgun = 0 ;
self . reload_super_shotgun = 0 ;
self . reload_grenade_launcher = 0 ;
self . reload_rocket_launcher = 0 ;
self . reload_light_assault = 0 ;
self . reload_laser_cannon = 0 ;
//self.is_undercover = 0;
//self.undercover_team = 0;
self . last_attacked_time = 0 ; //WK For chaplan healing purposes
makeImmune ( self , time + 5 ) ;
// grapple stuff
2001-07-23 20:52:47 +00:00
self . on_hook = FALSE ;
self . hook_out = FALSE ;
self . fire_held_down = FALSE ;
2001-07-17 05:58:10 +00:00
DecodeLevelParms ( ) ;
# ifdef COOP_MODE
// Force all players to be on the same team in Coop mode
if ( coop )
{
teamplay = 21 ;
cvar_set ( " teamplay " , " 21?TeamFortress " ) ;
TeamFortress_TeamSet ( 1 ) ;
}
# endif
// Set the Civilian Class of anyone in a Civilian Team
2001-07-23 20:52:47 +00:00
if ( self . playerclass = = PC_UNDEFINED )
2001-07-17 05:58:10 +00:00
{
if ( TeamFortress_TeamIsCivilian ( self . team_no ) )
{
self . impulse = 1 ;
TeamFortress_ChangeClass ( ) ;
}
}
// For players who've changed their classes in deathmatch 3,
// their class may be PC_RANDOM, in which case we set the toggleflag
if ( ( deathmatch = = 3 ) & & ( self . nextpc ! = 0 ) )
{
self . playerclass = self . nextpc ;
2001-07-23 20:52:47 +00:00
if ( self . nextpc = = PC_RANDOM )
self . tfstate = self . tfstate | TFSTATE_RANDOMPC ;
2001-07-17 05:58:10 +00:00
else
2001-07-23 20:52:47 +00:00
self . tfstate = self . tfstate - ( self . tfstate & TFSTATE_RANDOMPC ) ;
2001-07-17 05:58:10 +00:00
}
// some states are kept
iszoom = 0 ;
2001-07-23 20:52:47 +00:00
if ( self . tfstate & TFSTATE_ZOOMOFF )
2001-07-17 05:58:10 +00:00
iszoom = 1 ;
// Reset all tfstate flags, except for RANDOMPC
2001-07-23 20:52:47 +00:00
if ( self . tfstate & TFSTATE_RANDOMPC )
2001-07-17 05:58:10 +00:00
{
oldclass = self . playerclass ;
2001-07-23 20:52:47 +00:00
self . playerclass = 1 + floor ( random ( ) * ( PC_RANDOM - 1 ) ) ;
2001-07-17 05:58:10 +00:00
while ( ! IsLegalClass ( self . playerclass ) | | ( self . playerclass = = oldclass ) )
2001-07-23 20:52:47 +00:00
self . playerclass = 1 + floor ( random ( ) * ( PC_RANDOM - 1 ) ) ;
self . tfstate = TFSTATE_RANDOMPC ;
2001-07-17 05:58:10 +00:00
}
else
self . tfstate = 0 ;
if ( iszoom = = 1 )
2001-07-23 20:52:47 +00:00
self . tfstate = self . tfstate | TFSTATE_ZOOMOFF ;
2001-07-17 05:58:10 +00:00
// Display the Player's Class
2001-07-23 20:52:47 +00:00
if ( ! ( self . done_custom = = 0 | | ( self . done_custom & CUSTOM_ON_SPAWN ) ) )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
if ( self . playerclass ! = PC_CUSTOM )
TeamFortress_PrintClassName ( self , self . playerclass , ( self . tfstate & TFSTATE_RANDOMPC ) ) ;
2001-07-17 05:58:10 +00:00
else
TeamFortress_PrintJobName ( self , self . job ) ;
}
// Set the weapons and ammo for the player based on class
TeamFortress_SetEquipment ( ) ;
// Set the health for the player based on class
TeamFortress_SetHealth ( ) ;
// Set the speed for the player based on class
TeamFortress_SetSpeed ( self ) ;
// Set the skin for the player based on class
TeamFortress_SetSkin ( self ) ;
stuffcmd ( self , " v_idlescale 0 \n " ) ;
stuffcmd ( self , " v_cshift 0 0 0 0 \n " ) ;
//WK Clear Bastard Rotation
stuffcmd ( self , " -left;-right;cl_yawspeed 140 \n " ) ;
//WK Again, since they could lose their sentrygun in SetEquip...
DetonateAllGuns ( ) ;
SetTeamName ( self ) ;
W_SetCurrentAmmo ( ) ;
self . attack_finished = time + 0.3 ;
self . th_pain = player_pain ;
self . th_die = PlayerDie ;
// make sure that autozoom is reset
if ( self . height ! = 0 )
{
self . height = 0 ;
TF_zoom ( 90 ) ;
}
2001-07-23 20:52:47 +00:00
self . deadflag = DEAD_NO ;
2001-07-17 05:58:10 +00:00
// pausetime is set by teleporters to keep the player from moving a while
self . pausetime = 0 ;
spot = SelectSpawnPoint ( ) ;
2001-07-23 20:52:47 +00:00
if ( self . playerclass ! = PC_UNDEFINED )
2001-07-17 05:58:10 +00:00
spawn_tdeath ( spot . origin , self ) ;
self . observer_list = spot ;
self . origin = spot . origin + ' 0 0 1 ' ;
self . angles = spot . angles ;
2001-07-23 20:52:47 +00:00
self . fixangle = TRUE ; // turn this way immediately
2001-07-17 05:58:10 +00:00
# ifdef MAP_DEBUG
RPrint ( self . netname ) ;
RPrint ( " spawned at a " ) ;
RPrint ( spot . classname ) ;
if ( spot . team_no ! = 0 )
{
RPrint ( " , team_no of " ) ;
st = ftos ( spot . team_no ) ;
RPrint ( st ) ;
}
RPrint ( " \n " ) ;
# endif
// If this is a TeamSpawnpoint, check to see if it
// gives out a GoalItem, or displays a message
if ( spot . classname = = " info_player_teamspawn " )
{
if ( spot . items ! = 0 )
{
te = Finditem ( spot . items ) ;
if ( te )
tfgoalitem_GiveToPlayer ( te , self , self ) ;
2001-07-23 20:52:47 +00:00
if ( ! ( spot . goal_activation & TFSP_MULTIPLEITEMS ) )
2001-07-17 05:58:10 +00:00
spot . items = 0 ;
}
// Display teamspawn message
if ( spot . message )
{
CenterPrint ( self , spot . message ) ;
2001-07-23 20:52:47 +00:00
if ( ! ( spot . goal_activation & TFSP_MULTIPLEMSGS ) )
2001-07-17 05:58:10 +00:00
spot . message = string_null ;
}
// Activate a Goal if needed
if ( spot . activate_goal_no ! = 0 )
{
te = Findgoal ( spot . activate_goal_no ) ;
if ( te )
AttemptToActivate ( te , self , spot ) ;
}
// TeamSpawn points can remove themselves after being spawned on
2001-07-23 20:52:47 +00:00
if ( spot . goal_effects = = TFSP_REMOVESELF )
2001-07-17 05:58:10 +00:00
{
spot . classname = " deadpoint " ;
spot . team_str_home = string_null ;
spot . nextthink = time + 1 ;
spot . think = SUB_Remove ;
}
}
setmodel ( self , string_null ) ;
modelindex_null = self . modelindex ;
setmodel ( self , " progs/eyes.mdl " ) ;
modelindex_eyes = self . modelindex ;
setmodel ( self , " progs/player.mdl " ) ;
modelindex_player = self . modelindex ;
2001-07-23 20:52:47 +00:00
if ( self . playerclass = = PC_UNDEFINED )
2001-07-17 05:58:10 +00:00
{
self . modelindex = modelindex_null ;
self . current_menu = 1 ;
self . gravity = 0 ;
}
//WK DropIntoCustomClassGeneration
2001-07-23 20:52:47 +00:00
if ( self . playerclass = = PC_CUSTOM )
2001-07-17 05:58:10 +00:00
{
//WK Done_custom is initialized to 0, hackish yes.
//There are two entries, unintialized 0, or a person having issued a 'custom' command
2001-07-23 20:52:47 +00:00
//which sets the CUSTOM_ON_SPAWN flag
if ( self . done_custom = = 0 | | ( self . done_custom & CUSTOM_ON_SPAWN ) )
2001-07-17 05:58:10 +00:00
{
DropToCustomClassGen ( ) ;
}
else
{
self . maxspeed = self . custom_speed ; //Reset our speed
}
}
else {
self . done_custom = 0 ; //Unitialize this. Maybe set to ON_SPAWN...
}
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 ' ;
player_stand1 ( ) ;
if ( deathmatch | | coop )
{
makevectors ( self . angles ) ;
2001-07-23 20:52:47 +00:00
if ( self . playerclass ! = PC_UNDEFINED )
2001-07-17 05:58:10 +00:00
spawn_tfog ( self . origin + v_forward * 10 ) ;
}
// Set Rocket Jump Modifiers
if ( stof ( infokey ( world , " rj " ) ) ! = 0 )
rj = stof ( infokey ( world , " rj " ) ) ;
else
rj = 1 ;
//This code is in three places. client,custom & tfort.qc
//WK Give them invincibility if they are a normal class or bought it
2001-07-23 20:52:47 +00:00
if ( ( self . playerclass > = PC_SCOUT & & self . playerclass < = PC_RANDOM ) | |
self . tf_items & NIT_RESPAWN_GUARD ) {
2001-08-10 10:03:36 +00:00
self . items = self . items & IT_INVULNERABILITY ;
2001-07-17 05:58:10 +00:00
self . invincible_time = 1 ;
2001-07-23 20:52:47 +00:00
self . invincible_finished = time + RESPAWN_GUARD_TIME ;
2001-07-17 05:58:10 +00:00
if ( self . custom_speed > 300 )
self . invincible_finished = self . invincible_finished - 1 ;
if ( self . custom_speed > 400 )
self . invincible_finished = self . invincible_finished - 1 ;
}
} ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
QUAKED FUNCTIONS
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
/*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
The normal starting point for a level .
*/
void ( ) info_player_start =
{
2001-07-23 20:52:47 +00:00
if ( CheckExistence ( ) = = FALSE )
2001-07-17 05:58:10 +00:00
{
dremove ( self ) ;
return ;
}
} ;
/*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
Only used on start map for the return point from an episode .
*/
void ( ) info_player_start2 =
{
2001-07-23 20:52:47 +00:00
if ( CheckExistence ( ) = = FALSE )
2001-07-17 05:58:10 +00:00
{
dremove ( self ) ;
return ;
}
} ;
/*
saved out by quaked in region mode
*/
void ( ) testplayerstart =
{
2001-07-23 20:52:47 +00:00
if ( CheckExistence ( ) = = FALSE )
2001-07-17 05:58:10 +00:00
{
dremove ( self ) ;
return ;
}
} ;
/*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
potential spawning position for deathmatch games
*/
void ( ) info_player_deathmatch =
{
2001-07-23 20:52:47 +00:00
if ( CheckExistence ( ) = = FALSE )
2001-07-17 05:58:10 +00:00
{
dremove ( self ) ;
return ;
}
} ;
/*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
potential spawning position for coop games
*/
void ( ) info_player_coop =
{
2001-07-23 20:52:47 +00:00
if ( CheckExistence ( ) = = FALSE )
2001-07-17 05:58:10 +00:00
{
dremove ( self ) ;
return ;
}
} ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
RULES
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
void ( entity c ) PrintClientScore =
{
if ( c . frags > - 10 & & c . frags < 0 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , " " ) ;
2001-07-17 05:58:10 +00:00
else if ( c . frags > = 0 )
{
if ( c . frags < 100 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , " " ) ;
2001-07-17 05:58:10 +00:00
if ( c . frags < 10 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , " " ) ;
2001-07-17 05:58:10 +00:00
}
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , ftos ( c . frags ) ) ;
bprint ( PRINT_MEDIUM , " " ) ;
bprint ( PRINT_MEDIUM , c . netname ) ;
bprint ( PRINT_MEDIUM , " \n " ) ;
2001-07-17 05:58:10 +00:00
} ;
void ( ) DumpScore =
{
local entity e , sort , walk ;
if ( world . chain )
error ( " DumpScore: world.chain is set " ) ;
// build a sorted lis
e = find ( world , classname , " player " ) ;
sort = world ;
while ( e )
{
if ( ! sort )
{
sort = e ;
e . chain = world ;
}
else
{
if ( e . frags > sort . frags )
{
e . chain = sort ;
sort = e ;
}
else
{
walk = sort ;
do
{
if ( ! walk . chain )
{
e . chain = world ;
walk . chain = e ;
}
else if ( walk . chain . frags < e . frags )
{
e . chain = walk . chain ;
walk . chain = e ;
}
else
walk = walk . chain ;
} while ( walk . chain ! = e ) ;
}
}
e = find ( e , classname , " player " ) ;
}
// print the list
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , " \n " ) ;
2001-07-17 05:58:10 +00:00
while ( sort )
{
PrintClientScore ( sort ) ;
sort = sort . chain ;
}
2001-07-23 20:52:47 +00:00
bprint ( PRINT_MEDIUM , " \n " ) ;
2001-07-17 05:58:10 +00:00
} ;
/*
go to the next level for deathmatch
*/
float already_cycled ;
void ( ) NextLevel =
{
local entity o ;
if ( already_cycled )
return ;
2001-07-23 20:52:47 +00:00
already_cycled = TRUE ;
2001-07-17 05:58:10 +00:00
o = spawn ( ) ;
o . map = nextmap ;
o . think = execute_changelevel ;
o . nextthink = time + 0.1 ;
} ;
2001-07-23 15:08:39 +00:00
float cyclenow ;
2001-07-17 05:58:10 +00:00
/*
= = = = = = = = = = = =
CheckRules
Exit deathmatch games upon conditions
= = = = = = = = = = = =
*/
void ( ) CheckRules =
{
2001-07-23 15:08:39 +00:00
local string st ;
st = infokey ( world , " cyclenow " ) ;
if ( ! cyclenow & & ( st = = " 1 " | | st = = " on " ) )
{
cyclenow = 1 ;
localcmd ( " serverinfo cyclenow \" \" \n " ) ;
localcmd ( " localinfo cyclenow \" \" \n " ) ;
dprint ( " Cycling Map. \n " ) ;
2001-07-17 05:58:10 +00:00
NextLevel ( ) ;
2001-07-23 15:08:39 +00:00
}
else if ( cyclenow
| | ( timelimit & & time > = timelimit )
| | ( fraglimit & & self . frags > = fraglimit ) )
2001-07-17 05:58:10 +00:00
NextLevel ( ) ;
} ;
//============================================================================
void ( ) PlayerDeathThink =
{
local float forward ;
2001-07-23 20:52:47 +00:00
if ( ( self . flags & FL_ONGROUND ) )
2001-07-17 05:58:10 +00:00
{
forward = vlen ( self . velocity ) ;
forward = forward - 20 ;
if ( forward < = 0 )
self . velocity = ' 0 0 0 ' ;
else
self . velocity = forward * normalize ( self . velocity ) ;
}
// wait for all buttons released
2001-07-23 20:52:47 +00:00
if ( self . deadflag = = DEAD_DEAD )
2001-07-17 05:58:10 +00:00
{
if ( self . button2 | | self . button1 | | self . button0 )
return ;
2001-07-23 20:52:47 +00:00
self . deadflag = DEAD_RESPAWNABLE ;
2001-07-17 05:58:10 +00:00
// make sure that respawn flag has not been set
2001-07-23 20:52:47 +00:00
self . tfstate = self . tfstate - ( self . tfstate & TFSTATE_RESPAWN_READY ) ;
2001-07-17 05:58:10 +00:00
return ;
}
// wait for any button down
if ( ! self . button2 & & ! self . button1 & & ! self . button0 )
{
// if no buttons, but respawn_ready flag is set, respawn
2001-07-23 20:52:47 +00:00
if ( self . tfstate & TFSTATE_RESPAWN_READY )
2001-07-17 05:58:10 +00:00
{
if ( self . respawn_time < = time )
{
self . button0 = 0 ;
self . button1 = 0 ;
self . button2 = 0 ;
respawn ( ) ;
}
}
return ;
}
else
{
// button has been pressed, player is ready to respawn
2001-07-23 20:52:47 +00:00
self . tfstate = self . tfstate | TFSTATE_RESPAWN_READY ;
2001-07-17 05:58:10 +00:00
if ( self . respawn_time < = time )
{
self . button0 = 0 ;
self . button1 = 0 ;
self . button2 = 0 ;
respawn ( ) ;
}
return ;
}
} ;
void ( ) PlayerJump =
{
2001-07-23 20:52:47 +00:00
if ( self . flags & FL_WATERJUMP )
2001-07-17 05:58:10 +00:00
return ;
if ( self . waterlevel > = 2 )
{
2001-07-31 17:08:59 +00:00
if ( self . watertype = = CONTENTS_WATER )
2001-07-17 05:58:10 +00:00
self . velocity_z = 100 ;
2001-07-31 17:08:59 +00:00
else if ( self . watertype = = CONTENTS_SLIME )
2001-07-17 05:58:10 +00:00
self . velocity_z = 80 ;
else
self . velocity_z = 50 ;
//WK
2001-07-23 20:52:47 +00:00
if ( self . tf_items & NIT_SCUBA )
2001-07-17 05:58:10 +00:00
self . velocity_z = 250 ;
// play swiming sound
2001-07-23 20:52:47 +00:00
if ( self . cutf_items & CUTF_STEALTH ) // SB no noise if we have stealth
2001-07-17 05:58:10 +00:00
return ;
if ( self . swim_flag < time )
{
self . swim_flag = time + 1 ;
if ( random ( ) < 0.5 )
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_BODY , " misc/water1.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
else
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_BODY , " misc/water2.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
}
return ;
}
2001-07-23 20:52:47 +00:00
if ( ! ( self . flags & FL_ONGROUND ) )
2001-07-17 05:58:10 +00:00
return ;
2001-07-23 20:52:47 +00:00
if ( ! ( self . flags & FL_JUMPRELEASED ) )
2001-07-17 05:58:10 +00:00
return ; // don't pogo stick
2001-07-23 20:52:47 +00:00
self . flags = self . flags - ( self . flags & FL_JUMPRELEASED ) ;
2001-07-17 05:58:10 +00:00
self . button2 = 0 ;
// player jumping sound
2001-07-23 20:52:47 +00:00
if ( ! ( self . cutf_items & CUTF_STEALTH ) ) // Only play it if we don't have stealth
sound ( self , CHAN_BODY , " player/plyrjmp8.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
//WK Sprinters jump higher
//SB No, people with high jump do
2001-07-23 20:52:47 +00:00
if ( self . cutf_items & CUTF_HIGHJUMP )
2001-07-17 05:58:10 +00:00
self . velocity_z = self . velocity_z + 400 ;
} ;
/*
= = = = = = = = = = =
WaterMove
= = = = = = = = = = = =
*/
. float dmgtime ;
void ( ) WaterMove =
{
// RPrint (ftos(self.waterlevel));
2001-07-23 20:52:47 +00:00
if ( self . movetype = = MOVETYPE_NOCLIP )
2001-07-17 05:58:10 +00:00
return ;
if ( self . health < 0 )
return ;
//WK Poison attacks
2001-07-23 20:52:47 +00:00
if ( self . tfstate & ( TFSTATE_HALLUCINATING | TFSTATE_TRANQUILISED ) )
2001-07-17 05:58:10 +00:00
{
if ( self . air_finished < time )
{ // drown!
if ( self . pain_finished < time )
{
self . dmg = self . dmg + 0.5 ;
if ( self . dmg = = 2.5 ) //Initial damage is 2
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Your lungs are still paralyzed. Try to minimize your exposure to poison \n " ) ;
2001-07-17 05:58:10 +00:00
if ( self . dmg > 6 )
self . dmg = 2.2 ;
if ( self . dmg < self . health - 1 )
2001-07-23 20:52:47 +00:00
TF_T_Damage ( self , world , world , self . dmg , TF_TD_IGNOREARMOUR , TF_TD_OTHER ) ;
2001-07-17 05:58:10 +00:00
self . pain_finished = time + 1 ;
}
}
}
else if ( self . waterlevel ! = 3 )
{
if ( self . air_finished < time )
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_VOICE , " player/gasp2.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
else if ( self . air_finished < time + 9 )
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_VOICE , " player/gasp1.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
self . air_finished = time + 12 ;
self . dmg = 2 ;
}
else if ( self . air_finished < time )
{ // drown!
if ( self . pain_finished < time )
{
self . dmg = self . dmg + 2 ;
if ( self . dmg > 15 )
self . dmg = 10 ;
2001-07-23 20:52:47 +00:00
TF_T_Damage ( self , world , world , self . dmg , TF_TD_IGNOREARMOUR , TF_TD_OTHER ) ;
2001-07-17 05:58:10 +00:00
self . pain_finished = time + 1 ;
}
}
if ( ! self . waterlevel )
{
2001-07-23 20:52:47 +00:00
if ( self . flags & FL_INWATER )
2001-07-17 05:58:10 +00:00
{
// play leave water sound
2001-07-23 20:52:47 +00:00
if ( ! ( self . cutf_items & CUTF_STEALTH ) ) // SB only if no stealth
sound ( self , CHAN_BODY , " misc/outwater.wav " , 1 , ATTN_NORM ) ;
self . flags = self . flags - FL_INWATER ;
2001-07-17 05:58:10 +00:00
//WK Setspeed for Scuba commando
2001-07-23 20:52:47 +00:00
if ( self . tf_items & NIT_SCUBA )
2001-07-17 05:58:10 +00:00
TeamFortress_SetSpeed ( self ) ;
}
return ;
}
2001-07-31 17:08:59 +00:00
if ( self . watertype = = CONTENTS_LAVA )
2001-07-17 05:58:10 +00:00
{ // do damage
if ( self . dmgtime < time )
{
if ( self . radsuit_finished > time )
self . dmgtime = time + 1 ;
else
self . dmgtime = time + 0.2 ;
// Asbestos armor helps against lava, but I doubt it'll save you :)
2001-07-23 20:52:47 +00:00
TF_T_Damage ( self , world , world , 10 * self . waterlevel , 0 , TF_TD_FIRE ) ;
2001-07-17 05:58:10 +00:00
}
}
2001-07-31 17:08:59 +00:00
else if ( self . watertype = = CONTENTS_SLIME )
2001-07-17 05:58:10 +00:00
{ // do damage
if ( self . dmgtime < time & & self . radsuit_finished < time )
{
self . dmgtime = time + 1 ;
//T_Damage (self, world, world, 4*self.waterlevel);
2001-07-23 20:52:47 +00:00
TF_T_Damage ( self , world , world , 4 * self . waterlevel , 0 , TF_TD_ELECTRICITY ) ;
2001-07-17 05:58:10 +00:00
}
}
2001-07-23 20:52:47 +00:00
if ( ! ( self . flags & FL_INWATER ) )
2001-07-17 05:58:10 +00:00
{
// player enter water sound
2001-07-23 20:52:47 +00:00
if ( ! ( self . cutf_items & CUTF_STEALTH ) )
2001-07-31 17:08:59 +00:00
if ( self . watertype = = CONTENTS_LAVA )
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_BODY , " player/inlava.wav " , 1 , ATTN_NORM ) ;
2001-07-31 17:08:59 +00:00
else if ( self . watertype = = CONTENTS_WATER )
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_BODY , " player/inh2o.wav " , 1 , ATTN_NORM ) ;
2001-07-31 17:08:59 +00:00
else if ( self . watertype = = CONTENTS_SLIME )
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_BODY , " player/slimbrn2.wav " , 1 , ATTN_NORM ) ;
self . flags = self . flags + FL_INWATER ;
2001-07-17 05:58:10 +00:00
self . dmgtime = 0 ;
//WK Setspeed for scuba commando
2001-07-23 20:52:47 +00:00
if ( self . tf_items & NIT_SCUBA )
2001-07-17 05:58:10 +00:00
TeamFortress_SetSpeed ( self ) ;
}
} ;
void ( ) CheckWaterJump =
{
local vector start , end ;
// check for a jump-out-of-water
makevectors ( self . angles ) ;
start = self . origin ;
start_z = start_z + 8 ;
v_forward_z = 0 ;
normalize ( v_forward ) ;
end = start + v_forward * 24 ;
2001-07-23 20:52:47 +00:00
traceline ( start , end , TRUE , self ) ;
2001-07-17 05:58:10 +00:00
if ( trace_fraction < 1 )
{ // solid at waist
start_z = start_z + self . maxs_z - 8 ;
end = start + v_forward * 24 ;
self . movedir = trace_plane_normal * - 50 ;
2001-07-23 20:52:47 +00:00
traceline ( start , end , TRUE , self ) ;
2001-07-17 05:58:10 +00:00
if ( trace_fraction = = 1 )
{ // open at eye level
2001-07-23 20:52:47 +00:00
self . flags = self . flags | FL_WATERJUMP ;
2001-07-17 05:58:10 +00:00
self . velocity_z = 225 ;
2001-07-23 20:52:47 +00:00
self . flags = self . flags - ( self . flags & FL_JUMPRELEASED ) ;
2001-07-17 05:58:10 +00:00
self . teleport_time = time + 2 ; // safety net
return ;
}
}
} ;
/*
= = = = = = = = = = = = = = = =
PlayerPreThink
Called every frame before physics are run
= = = = = = = = = = = = = = = =
*/
void ( ) PlayerPreThink =
{
local vector src ;
//WK -- For LPB calculation
local string foo ;
local float ping ;
if ( self . is_feigning & & self . waterlevel = = 1 )
{
2001-07-31 17:08:59 +00:00
self . watertype = CONTENTS_WATER ;
2001-07-17 05:58:10 +00:00
self . waterlevel = 3 ;
}
if ( self . cheat_level > 0 )
self . cheat_level = self . cheat_level - 1 ;
if ( self . speed_level > 0 ) //Cyto
self . speed_level = self . speed_level - 1 ;
if ( intermission_running )
{
IntermissionThink ( ) ; // otherwise a button could be missed between
return ; // the think tics
}
makevectors ( self . v_angle ) ; // is this still used?
if ( infokey ( world , " ceasefire " ) = = " on " ) //Cyto
{
# ifndef ceasefire_allows_to_move
if ( self . lip )
self . origin = self . oldorigin ;
else
{
self . velocity_z = - 5000 ;
self . velocity_x = 0 ;
self . velocity_y = 0 ;
2001-07-23 20:52:47 +00:00
if ( self . flags & FL_ONGROUND )
2001-07-17 05:58:10 +00:00
{
self . oldorigin = self . origin ;
2001-07-23 20:52:47 +00:00
self . lip = TRUE ;
2001-07-17 05:58:10 +00:00
}
}
# endif
CenterPrint ( self , " Ceasefire Applies " ) ;
if ( ! Good_Impulse ( self . impulse ) ) //See admin.qc
self . impulse = 0 ;
self . button0 = 0 ;
self . button1 = 0 ;
self . button2 = 0 ;
}
else if ( self . lip )
{
2001-07-23 20:52:47 +00:00
self . lip = FALSE ;
2001-07-17 05:58:10 +00:00
centerprint ( self , " " ) ;
}
// End Cyt0
CheckRules ( ) ;
//xxxx
//WK Supercharged observer mode!
2001-07-23 20:52:47 +00:00
if ( self . playerclass = = PC_UNDEFINED )
2001-07-17 05:58:10 +00:00
{
if ( self . button0 )
{
//WK Nifty code to push through walls only if we really want to
if ( vlen ( self . velocity ) < 200 )
{
src = self . origin + normalize ( v_forward ) * 5 ;
setorigin ( self , src ) ;
}
self . velocity = normalize ( v_forward ) * 400 ;
}
else
{
foo = infokey ( self , " ping " ) ;
ping = 200 ;
if ( foo ! = string_null )
ping = stof ( foo ) ;
if ( ping < 300 ) {
self . velocity_x = floor ( ( 3 * self . velocity_x ) / 4 ) ;
self . velocity_y = floor ( ( 3 * self . velocity_y ) / 4 ) ;
self . velocity_z = floor ( ( 3 * self . velocity_z ) / 4 ) ;
}
}
if ( self . button2 )
self . velocity = ' 0 0 0 ' ;
return ;
//WK Removed jump == autoteam
//WK Removed all the demo stuff stuff.
}
if ( self . view_ofs = = ' 0 0 0 ' )
return ; // intermission or finale
2001-07-23 20:52:47 +00:00
if ( self . playerclass ! = PC_UNDEFINED )
2001-07-17 05:58:10 +00:00
WaterMove ( ) ;
2001-07-23 20:52:47 +00:00
if ( self . deadflag > = DEAD_DEAD )
2001-07-17 05:58:10 +00:00
{
PlayerDeathThink ( ) ;
return ;
}
if ( self . undercover_team | | self . undercover_skin | | self . is_undercover )
{
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 , " The glowing removes your disguise. \n " ) ;
2001-07-17 05:58:10 +00:00
Spy_RemoveDisguise ( self ) ;
}
}
2001-07-23 20:52:47 +00:00
/*if (self.job & JOB_THIEF && self.job & JOB_FULL_HIDE)
2001-07-17 05:58:10 +00:00
{
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 , " The glowing removes your full invisibility. \n " ) ;
self . job = self . job - ( self . job & JOB_FULL_HIDE ) ;
self . job = self . job | JOB_ACTIVE ;
2001-07-17 05:58:10 +00:00
}
} */
2001-07-23 20:52:47 +00:00
if ( self . deadflag = = DEAD_DYING )
2001-07-17 05:58:10 +00:00
return ; // dying, so do nothing
if ( ! self . is_feigning )
{
if ( self . button2 )
{
PlayerJump ( ) ; //WK This just does noises for jumps
}
else
2001-07-23 20:52:47 +00:00
self . flags = self . flags | FL_JUMPRELEASED ;
2001-07-17 05:58:10 +00:00
}
//WK Scuba commando treads water :)
2001-07-23 20:52:47 +00:00
if ( ( self . tf_items & NIT_SCUBA ) & & self . waterlevel > 1 ) {
2001-07-17 05:58:10 +00:00
if ( self . velocity_z > = - 25 & & self . velocity_z < 0 )
self . velocity_z = 10 ; //Tread water if near a stop
}
//Jello Water :)
else if ( jello & & self . waterlevel > 1 ) {
2001-07-23 20:52:47 +00:00
if ( jello = = TRUE ) //Binary on/off
2001-07-17 05:58:10 +00:00
self . velocity_z = 1000 ; //900 is a better number for 2forts
else
self . velocity_z = jello ;
}
// teleporters can force a non-moving pause time
if ( time < self . pausetime )
self . velocity = ' 0 0 0 ' ;
2001-07-23 20:52:47 +00:00
if ( time > self . attack_finished & & self . currentammo = = 0 & & self . weapon > WEAP_AXE )
2001-07-17 05:58:10 +00:00
{
self . weapon = W_BestWeapon ( ) ;
W_SetCurrentAmmo ( ) ;
}
// Do grapple stuff if I'm on a hook
if ( self . on_hook )
{
Service_Grapple ( ) ;
if ( self . button2 & & self . velocity_z > 10 )
self . velocity_z = 10 ; //WK Allow more creative physics with hook
}
//WK Add Hover Boot Support
2001-07-23 20:52:47 +00:00
if ( self . tf_items & NIT_HOVER_BOOTS ) {
2001-07-17 05:58:10 +00:00
if ( self . button2 & & self . velocity_z < 0 & & self . hover_time > 0 & & self . waterlevel = = 0 )
{ //Try to hover
self . velocity_z = 100 ; //+10 == hover
self . hover_time = self . hover_time - 0.25 ; //0.1 == tick time
if ( self . hover_time < = 0 ) {
self . hover_time = - 5 ; //3 second penalty for draining it
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Your boots are out of fuel, let them recharge \n " ) ;
2001-07-17 05:58:10 +00:00
}
//Spit out fire from them!
if ( self . search_time < time ) {
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_AUTO , " weapons/flmfire2.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
local entity flame ;
flame = spawn ( ) ;
2001-07-23 20:52:47 +00:00
flame . owner = self ; flame . movetype = MOVETYPE_FLYMISSILE ;
flame . solid = SOLID_BBOX ; flame . classname = " flamerflame " ;
2001-07-17 05:58:10 +00:00
makevectors ( self . v_angle ) ;
flame . velocity = - 1 * v_up ; flame . velocity = flame . velocity * 600 ;
flame . touch = Boot_Flamer_stream_touch ; flame . think = s_explode1 ;
flame . nextthink = time + 0.1 ; setmodel ( flame , " progs/s_explod.spr " ) ;
setsize ( flame , ' 0 0 0 ' , ' 0 0 0 ' ) ;
setorigin ( flame , self . origin + v_up * - 16 ) ;
self . search_time = time + 0.15 ;
}
}
else { //Recharger <- That's French for "recharge"
self . hover_time = self . hover_time + 0.01 ; //0.05 is a half-tick
2001-07-23 20:52:47 +00:00
if ( self . hover_time > MAX_HOVER_FUEL & & ( ! ( self . tf_items & NIT_HOVER_BOOTS_UPGRADE ) ) )
self . hover_time = MAX_HOVER_FUEL ;
if ( self . hover_time > ( MAX_HOVER_FUEL * 2 ) & & self . tf_items & NIT_HOVER_BOOTS_UPGRADE )
self . hover_time = ( MAX_HOVER_FUEL * 2 ) ;
2001-07-17 05:58:10 +00:00
}
}
} ;
/*
= = = = = = = = = = = = = = = =
CheckPowerups
Check for turning off powerups
= = = = = = = = = = = = = = = =
*/
void ( ) CheckPowerups =
{
local float lighton ;
local entity te ;
if ( self . health < = 0 )
return ;
// Invisibility
//WK Made people invis during building, and during thief's full hide
//WK And while being inspired by chaplan
2001-08-11 10:02:18 +00:00
if ( self . done_custom & CUSTOM_BUILDING //We are building a custom class
| | self . playerclass = = PC_UNDEFINED //Or we're in observer mode
| | ( self . job & JOB_THIEF & & self . job & JOB_FULL_HIDE ) //Or we are fully hiding thieves
// || (self.tfstate & TFSTATE_INSPIRED && !(self.job & JOB_CHAPLAN)) //ofN comented by
| | self . aura = = AURA_INVIS ) //- OfN
2001-07-17 05:58:10 +00:00
{
self . modelindex = modelindex_null ; // don't use eyes
}
2001-07-23 20:52:47 +00:00
else if ( ( self . is_undercover = = 1 & & invis_only = = TRUE ) | | ( self . job & JOB_THIEF & & self . job & JOB_ACTIVE ) )
2001-07-17 05:58:10 +00:00
{
self . frame = 0 ;
self . modelindex = modelindex_eyes ;
}
else if ( self . invisible_finished )
{
// If this is being given by a goalitem, extend the time
2001-07-23 20:52:47 +00:00
if ( self . tfstate & TFSTATE_INVISIBLE )
2001-07-17 05:58:10 +00:00
{
if ( self . invisible_finished < time + 10 )
self . invisible_finished = time + 666 ;
}
// sound and screen flash when items starts to run out
if ( self . invisible_sound < time )
{
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_AUTO , " items/inv3.wav " , 0.5 , ATTN_IDLE ) ;
2001-07-17 05:58:10 +00:00
self . invisible_sound = time + ( ( random ( ) * 3 ) + 1 ) ;
}
if ( self . invisible_finished < time + 3 )
{
if ( self . invisible_time = = 1 )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Ring of Shadows magic is fading \n " ) ;
2001-07-17 05:58:10 +00:00
stuffcmd ( self , " bf \n " ) ;
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_AUTO , " items/inv2.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
self . invisible_time = time + 1 ;
}
if ( self . invisible_time < time )
{
self . invisible_time = time + 1 ;
stuffcmd ( self , " bf \n " ) ;
}
}
if ( self . invisible_finished < time )
{ // just stopped
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 . invisible_time = 0 ;
}
// use the eyes
self . frame = 0 ;
self . modelindex = modelindex_eyes ;
}
else
self . modelindex = modelindex_player ; // don't use eyes
// invincibility
if ( self . invincible_finished )
{
// If this is being given by a goalitem, extend the time
2001-07-23 20:52:47 +00:00
if ( self . tfstate & TFSTATE_INVINCIBLE )
2001-07-17 05:58:10 +00:00
{
if ( self . invincible_finished < time + 10 )
self . invincible_finished = time + 666 ;
}
// sound and screen flash when items starts to run out
if ( self . invincible_finished < time + 3 )
{
if ( self . invincible_time = = 1 )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Protection is almost burned out \n " ) ;
2001-07-17 05:58:10 +00:00
stuffcmd ( self , " bf \n " ) ;
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_AUTO , " items/protect2.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
self . invincible_time = time + 1 ;
}
if ( self . invincible_time < time )
{
self . invincible_time = time + 1 ;
stuffcmd ( self , " bf \n " ) ;
}
}
if ( self . invincible_finished < time )
{ // just stopped
2001-08-10 10:03:36 +00:00
self . items = self . items & ~ IT_INVULNERABILITY ;
2001-07-17 05:58:10 +00:00
self . invincible_time = 0 ;
self . invincible_finished = 0 ;
}
if ( self . invincible_finished > time )
2001-07-23 20:52:47 +00:00
self . effects = self . effects | EF_DIMLIGHT ;
2001-07-17 05:58:10 +00:00
else
{
// Only remove dimlight if it's not being supplied by a GoalItem
2001-07-23 20:52:47 +00:00
lighton = FALSE ;
2001-07-17 05:58:10 +00:00
te = find ( world , classname , " item_tfgoal " ) ;
while ( te )
{
if ( te . owner = = self )
{
2001-07-23 20:52:47 +00:00
if ( te . goal_activation & TFGI_GLOW )
lighton = TRUE ;
2001-07-17 05:58:10 +00:00
}
te = find ( te , classname , " item_tfgoal " ) ;
}
if ( ! lighton )
2001-07-23 20:52:47 +00:00
self . effects = self . effects - ( self . effects & EF_DIMLIGHT ) ;
2001-07-17 05:58:10 +00:00
}
}
// super damage
if ( self . super_damage_finished )
{
// If this is being given by a goalitem, extend the time
2001-07-23 20:52:47 +00:00
if ( self . tfstate & TFSTATE_QUAD )
2001-07-17 05:58:10 +00:00
{
if ( self . super_damage_finished = = time + 10 )
self . super_damage_finished = time + 666 ;
}
// sound and screen flash when items starts to run out
2001-07-23 20:52:47 +00:00
if ( self . super_damage_finished < time + 3 & & ! ( self . tfstate & TFSTATE_INSPIRED ) )
2001-07-17 05:58:10 +00:00
{
if ( self . super_time = = 1 )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Quad Damage is wearing off \n " ) ;
2001-07-17 05:58:10 +00:00
stuffcmd ( self , " bf \n " ) ;
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_AUTO , " items/damage2.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
self . super_time = time + 1 ;
}
if ( self . super_time < time )
{
self . super_time = time + 1 ;
stuffcmd ( self , " bf \n " ) ;
}
}
if ( self . super_damage_finished < time )
{ // just stopped
2001-08-10 10:03:36 +00:00
self . items = self . items & ~ IT_QUAD ;
2001-07-17 05:58:10 +00:00
self . super_damage_finished = 0 ;
self . super_time = 0 ;
//WK If inspired, remove inspiration
2001-07-23 20:52:47 +00:00
self . tfstate = self . tfstate - ( self . tfstate & TFSTATE_INSPIRED ) ;
2001-07-17 05:58:10 +00:00
}
if ( self . super_damage_finished > time )
2001-07-23 20:52:47 +00:00
self . effects = self . effects | EF_DIMLIGHT ;
2001-07-17 05:58:10 +00:00
else
{
// Only remove dimlight if it's not being supplied by a GoalItem
2001-07-23 20:52:47 +00:00
lighton = FALSE ;
2001-07-17 05:58:10 +00:00
te = find ( world , classname , " item_tfgoal " ) ;
while ( te )
{
if ( te . owner = = self )
{
2001-07-23 20:52:47 +00:00
if ( te . goal_activation & TFGI_GLOW )
lighton = TRUE ;
2001-07-17 05:58:10 +00:00
}
te = find ( te , classname , " item_tfgoal " ) ;
}
if ( ! lighton )
2001-07-23 20:52:47 +00:00
self . effects = self . effects - ( self . effects & EF_DIMLIGHT ) ;
2001-07-17 05:58:10 +00:00
}
}
// suit
if ( self . radsuit_finished )
{
self . air_finished = time + 12 ; // don't drown
// If this is being given by a goalitem, extend the time
2001-07-23 20:52:47 +00:00
if ( self . tfstate & TFSTATE_RADSUIT | | self . tf_items & NIT_SCUBA )
2001-07-17 05:58:10 +00:00
{
//WK Do we need this? if (self.radsuit_finished == time + 10)
self . radsuit_finished = time + 666 ;
}
// sound and screen flash when items starts to run out
if ( self . radsuit_finished < time + 3 )
{
if ( self . rad_time = = 1 )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Air supply in Biosuit expiring \n " ) ;
2001-07-17 05:58:10 +00:00
stuffcmd ( self , " bf \n " ) ;
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_AUTO , " items/suit2.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
self . rad_time = time + 1 ;
}
if ( self . rad_time < time )
{
self . rad_time = time + 1 ;
stuffcmd ( self , " bf \n " ) ;
}
}
if ( self . radsuit_finished < time )
{ // just stopped
2001-08-10 10:03:36 +00:00
self . items = self . items & ~ IT_SUIT ;
2001-07-17 05:58:10 +00:00
self . rad_time = 0 ;
self . radsuit_finished = 0 ;
}
}
2001-07-23 20:52:47 +00:00
if ( self . aura = = AURA_INVIS )
2001-07-17 05:58:10 +00:00
if ( self . aura_time < time )
{
if ( self . invisible_finished < time )
2001-08-10 10:03:36 +00:00
self . items = self . items & ~ IT_INVISIBILITY ;
2001-07-17 05:58:10 +00:00
self . aura = 0 ;
}
} ;
void ( ) DeadImpulses ;
/*
= = = = = = = = = = = = = = = =
Called every frame after physics are run
= = = = = = = = = = = = = = = =
*/
void ( ) PlayerPostThink =
{
if ( self . view_ofs = = ' 0 0 0 ' )
return ; // intermission or finale
if ( infokey ( world , " ceasefire " ) = = " on " ) //Cyto
if ( ! Good_Impulse ( self . impulse ) ) //See admin.qc
self . impulse = 0 ;
if ( self . deadflag )
{
DeadImpulses ( ) ; // check for dead-only commands
self . impulse = 0 ;
return ;
}
// check to see if player landed and play landing sound
2001-07-23 20:52:47 +00:00
if ( self . takedamage & & ( self . jump_flag < - 300 ) & & ( self . flags & FL_ONGROUND ) & & ( self . health > 0 ) )
2001-07-17 05:58:10 +00:00
{
2001-07-31 17:08:59 +00:00
if ( self . watertype = = CONTENTS_WATER )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
if ( ! ( self . cutf_items & CUTF_STEALTH ) )
sound ( self , CHAN_BODY , " player/h2ojump.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
}
else if ( self . jump_flag < - 650 )
{
2001-07-23 20:52:47 +00:00
if ( ! ( self . cutf_items & CUTF_STEALTH ) ) { //WK Judo teaches falling... SB ceaf judo
2001-07-17 05:58:10 +00:00
self . deathtype = " falling " ;
T_Damage ( self , world , world , 5 ) ;
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_VOICE , " player/land2.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
}
}
else
2001-07-23 20:52:47 +00:00
if ( ! ( self . cutf_items & CUTF_STEALTH ) ) //WK Judo teaches falling... SB ceaf judo
sound ( self , CHAN_VOICE , " player/land.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
}
2001-07-19 11:56:52 +00:00
self . netname = infokey ( self , " name " ) ;
2001-07-17 05:58:10 +00:00
self . jump_flag = self . velocity_z ;
CheckPowerups ( ) ;
W_WeaponFrame ( ) ;
// Display MOTD
// Sync this with tforthlp.qc and menu.qc
2001-08-11 10:02:18 +00:00
TeamFortress_MOTD ( ) ;
if ( self . cheat_check = = 0 )
2001-07-17 05:58:10 +00:00
self . cheat_check = time + 10 ;
# ifdef STATUSBAR
else if ( time > self . StatusRefreshTime & & self . StatusBarSize ! = 0 )
{
if ( self . StatusBarScreen = = 1 )
RefreshStatusBar1 ( self ) ; //Sentry screen
else if ( self . StatusBarScreen = = 2 )
RefreshStatusBar2 ( self ) ; //Spy screen
else if ( self . StatusBarScreen = = 3 )
RefreshStatusBar3 ( self ) ; //Misc screen
else if ( self . StatusBarScreen = = 4 )
RefreshStatusBar4 ( self ) ; //Tesla screen
else if ( self . StatusBarScreen = = 5 )
RefreshStatusBar5 ( self ) ; //Scanner screen
else
RefreshStatusBar ( self ) ; //Normal scores and clip
}
# endif
// Check for Team Cheats
if ( self . cheat_check < = time )
{
TeamFortress_CheckTeamCheats ( ) ;
self . cheat_check = time + 5 ;
}
} ;
/*
= = = = = = = = = = =
ClientConnect
called when a player connects to a server
= = = = = = = = = = = =
*/
void ( ) ClientConnect =
{
local string st ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , self . netname ) ;
bprint ( PRINT_HIGH , " has joined the server \n " ) ;
2001-07-17 05:58:10 +00:00
//- OfN - shouldnt be needed anyway...
self . admin_kick = world ;
// Set Default autozoom
2001-07-23 20:52:47 +00:00
if ( DEFAULT_AUTOZOOM = = OFF )
self . tfstate = self . tfstate | TFSTATE_ZOOMOFF ;
2001-07-17 05:58:10 +00:00
// Set the MOTD on
self . motd = 0 ;
// Clear the Alias Flag
self . got_aliases = 0 ;
self . ff_count = 0 ; //WK Clear the friendly-fire counter
//RJM
st = infokey ( self , " sbr " ) ;
if ( st = = string_null )
//RJM
st = infokey ( self , " sbar_res " ) ;
if ( st = = " 768 " )
self . StatusBarRes = 8 ;
else if ( st = = " 600 " )
self . StatusBarRes = 7 ;
else if ( st = = " 480 " )
self . StatusBarRes = 6 ;
else if ( st = = " 400 " )
self . StatusBarRes = 5 ;
else if ( st = = " 384 " )
self . StatusBarRes = 4 ;
else if ( st = = " 350 " )
self . StatusBarRes = 3 ;
else if ( st = = " 300 " )
self . StatusBarRes = 2 ;
else if ( st = = " 240 " )
self . StatusBarRes = 1 ;
else
self . StatusBarRes = 0 ;
//RJM
st = infokey ( self , " sbs " ) ;
if ( st = = string_null )
//RJM
st = infokey ( self , " sbar_size " ) ;
self . StatusBarSize = stof ( st ) ;
if ( self . StatusBarSize > 2 | | self . StatusBarSize < 0 )
self . StatusBarSize = 0 ;
2001-07-23 20:52:47 +00:00
self . has_disconnected = FALSE ;
2001-07-17 05:58:10 +00:00
//PlayerObserverMode(); //ofn already commented out
self . gravity = 0 ;
2001-07-23 20:52:47 +00:00
self . movetype = MOVETYPE_FLY ;
2001-07-17 05:58:10 +00:00
// a client connecting during an intermission can cause problems
if ( intermission_running )
GotoNextMap ( ) ;
//- OfN
if ( mapname = = " huntedr " )
{
local float result ;
2001-07-23 20:52:47 +00:00
result = floor ( TeamFortress_TeamGetNoPlayers ( 2 ) * HUNTED_YELLOWTEAM_FACTOR ) ;
2001-07-17 05:58:10 +00:00
team3maxplayers = result ;
if ( team3maxplayers < 1 ) team3maxplayers = 1 ;
}
} ;
/*
= = = = = = = = = = =
ClientDisconnect
called when a player disconnects from a server
= = = = = = = = = = = =
*/
void ( ) ClientDisconnect =
{
local entity te ;
local string st ;
st = ftos ( floor ( self . real_frags ) ) ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , self . netname ) ;
bprint ( PRINT_HIGH , " has left the game with " ) ;
bprint ( PRINT_HIGH , st ) ;
bprint ( PRINT_HIGH , " frags and " ) ;
2001-07-17 05:58:10 +00:00
st = ftos ( floor ( self . ff_count ) ) ;
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , st ) ;
bprint ( PRINT_HIGH , " teamkills \n " ) ;
2001-07-17 05:58:10 +00:00
//- he got significant score?
/*local float temp_scr;
local float avr_team_scr ;
avr_team_scr = ( team1score + team2score + team3score + team4score ) / number_of_teams ;
temp_scr = fabs ( self . real_frags ) + self . ff_count ;
if ( ( temp_scr > time | | time > 20 ) & & time < 60 * 60 & & deathmatch = = 3 )
{
local float final_score ;
final_score = self . real_frags - self . ff_count * 3 - avr_team_scr / 2 ;
if ( final_score < - 50 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " bad enough to ban him! hehe \n " ) ;
2001-07-17 05:58:10 +00:00
else if ( final_score < 0 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " damn newbie! \n " ) ;
2001-07-17 05:58:10 +00:00
else if ( final_score < 10 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " he was not doing much \n " ) ;
2001-07-17 05:58:10 +00:00
else if ( final_score < 30 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " a regular player \n " ) ;
2001-07-17 05:58:10 +00:00
else if ( final_score < 50 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " not bad! \n " ) ;
2001-07-17 05:58:10 +00:00
else if ( final_score < 75 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " good score \n " ) ;
2001-07-17 05:58:10 +00:00
else if ( final_score < 100 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " cool score! \n " ) ;
2001-07-17 05:58:10 +00:00
else if ( final_score < 125 )
2001-07-23 20:52:47 +00:00
bprint ( PRINT_HIGH , " he is a real master of customTF! \n " ) ;
else bprint ( PRINT_HIGH , " omg! did he cheat? awesome score! \n " ) ;
2001-07-17 05:58:10 +00:00
} */
//- OfN
if ( mapname = = " huntedr " )
{
local float result ;
2001-07-23 20:52:47 +00:00
result = floor ( TeamFortress_TeamGetNoPlayers ( 2 ) * HUNTED_YELLOWTEAM_FACTOR ) ;
2001-07-17 05:58:10 +00:00
team3maxplayers = result ;
if ( team3maxplayers < 1 ) team3maxplayers = 1 ;
}
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_BODY , " player/tornoff2.wav " , 1 , ATTN_NONE ) ;
self . has_disconnected = TRUE ;
2001-07-17 05:58:10 +00:00
if ( debug_target = = self )
debug_target = world ;
// Remove Timers
TeamFortress_RemoveTimers ( ) ;
// Remove Buildings
DetonateAllGunsForced ( ) ;
/*Find_And_Dmg("building_dispenser", self, 1);
Find_And_Dmg ( " building_sentrygun " , self , 1 ) ;
Find_And_Dmg ( " building_tesla " , self , 1 ) ;
Find_And_Dmg ( " building_camera " , self , 1 ) ;
Find_And_Dmg ( " building_teleporter " , self , 1 ) ;
Find_And_Dmg ( " building_sensor " , self , 1 ) ; //sb*/
//WK Added demon cleanup
kill_my_demon ( ) ;
//WK Added ammobox/pipebomb fix
te = find ( world , classname , " ammobox " ) ;
while ( te )
{
if ( te . enemy = = self ) {
num_world_ammoboxes = num_world_ammoboxes - 1 ;
if ( te . enemy . team_no ! = 0 )
decrement_team_ammoboxes ( self . team_no ) ;
}
te . think = SUB_Remove ;
te . nextthink = time + 0.1 ;
te = find ( te , classname , " ammobox " ) ;
}
te = find ( world , classname , " pipebomb " ) ;
while ( te )
{
if ( te . owner = = self ) {
num_world_pipebombs = num_world_pipebombs - 1 ;
decrement_team_pipebombs ( self . team_no ) ;
te . think = SUB_Remove ;
te . nextthink = time + 0.1 ;
}
te = find ( te , classname , " pipebomb " ) ;
}
// OfN - Remove holograph if player disconnects!
if ( self . has_holo > 0 ) RemoveHolo ( self ) ;
DetonateMines ( self ) ;
RemoveArmyTimer ( ) ;
// Remove Detpacks
te = find ( world , classname , " detpack " ) ;
while ( te )
{
if ( te . owner = = self )
{
if ( te . weaponmode = = 1 ) // Detpack was being disarmed
{
2001-07-23 20:52:47 +00:00
te . enemy . tfstate = te . enemy . tfstate - ( te . enemy . tfstate & TFSTATE_CANT_MOVE ) ;
2001-07-17 05:58:10 +00:00
TeamFortress_SetSpeed ( te . enemy ) ;
dremove ( te . oldenemy ) ; // CountDown
dremove ( te . observer_list ) ; // Disarm timer
}
dremove ( te ) ;
te = world ;
}
te = find ( te , classname , " detpack " ) ;
}
2001-07-27 20:48:54 +00:00
// Clear anything that thinks he attacked/hacked it
local entity mrmartyr ;
mrmartyr = world ;
do {
mrmartyr = nextent ( mrmartyr ) ;
2001-07-28 02:47:17 +00:00
if ( mrmartyr & & mrmartyr . martyr_enemy = = te )
2001-07-27 20:48:54 +00:00
mrmartyr . martyr_enemy = world ;
} while ( mrmartyr ! = world ) ;
2001-07-17 05:58:10 +00:00
set_suicide_frame ( ) ;
self . netname = string_null ;
self . team_no = 0 ;
2001-07-23 20:52:47 +00:00
self . solid = SOLID_NOT ;
self . movetype = MOVETYPE_NONE ; //WK Stop crashing MOVETYPE_WALK bug?
2001-07-17 05:58:10 +00:00
setsize ( self , ' 0 0 0 ' , ' 0 0 0 ' ) ;
} ;