2001-07-23 20:52:47 +00:00
# include "defs.qh"
2001-07-17 05:58:10 +00:00
/*======================================================
ACTIONS . QC Custom TeamFortress v3 .2
( c ) TeamFortress Software Pty Ltd 13 / 5 / 97
( c ) William Kerney 2 / 9 / 00
( c ) Craig Hauser 19 / 3 / 00
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Non Class - Specific Impulse Commands
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
// Prototypes
void ( ) TeamFortress_Discard ;
void ( ) TeamFortress_SaveMe ;
void ( float inAuto ) TeamFortress_ID ;
void ( ) TeamFortress_ReloadCurrentWeapon ;
//CH dropitems
void ( ) TeamFortress_DropItems ;
void ( entity Item , entity AP , float method ) tfgoalitem_RemoveFromPlayer ;
//=========================================================================
// Discard Command. Drops all ammo useless to the player's class.
void ( ) TeamFortress_Discard =
{
// Create a backpack
newmis = spawn ( ) ;
//CH to save space. Dont do class specific checks
//
//CH new setup, checks if you have weapon that uses that ammo
//and if you dont, throws it away
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
if ( ! ( self . weapons_carried & WEAP_SNIPER_RIFLE | | self . weapons_carried & WEAP_AUTO_RIFLE | | self . weapons_carried & WEAP_SHOTGUN | | self . weapons_carried & WEAP_SUPER_SHOTGUN | | self . weapons_carried & WEAP_ASSAULT_CANNON | | ( self . cutf_items & CUTF_SENTRYGUN & & self . weapons_carried & WEAP_SPANNER ) ) )
2001-07-17 05:58:10 +00:00
newmis . ammo_shells = self . ammo_shells ;
2001-07-23 20:52:47 +00:00
if ( ! ( self . weapons_carried & WEAP_NAILGUN | | self . weapons_carried & WEAP_SNG | | self . weapons_carried & WEAP_LIGHT_ASSAULT | | self . weapons_carried & WEAP_LASER | | self . weapons_carried & WEAP_TRANQ | | self . weapons_carried & WEAP_MAUSER ) ) //CH is it just me or are there not many nail weapons? //WK It's just you
2001-07-17 05:58:10 +00:00
newmis . ammo_nails = self . ammo_nails ;
2001-07-23 20:52:47 +00:00
if ( ! ( self . weapons_carried & WEAP_ROCKET_LAUNCHER | | self . weapons_carried & WEAP_INCENDIARY | | self . weapons_carried & WEAP_GRENADE_LAUNCHER | | ( self . cutf_items & CUTF_SENTRYGUN & & self . weapons_carried & WEAP_SPANNER ) | | self . job & JOB_GUERILLA ) )
2001-07-17 05:58:10 +00:00
newmis . ammo_rockets = self . ammo_rockets ;
2001-07-23 20:52:47 +00:00
if ( ! ( self . cutf_items & CUTF_CYBERAUG | | self . cutf_items & CUTF_HOLO | | self . weapons_carried & WEAP_LASERCANNON | | self . weapons_carried & WEAP_INCENDIARY | | self . weapons_carried & WEAP_LIGHTNING | | self . weapons_carried & WEAP_SUPER_SHOTGUN | | self . weapons_carried & WEAP_ASSAULT_CANNON | | self . weapons_carried & WEAP_DAEDALUS | | ( self . cutf_items & CUTF_SENTRYGUN & & self . weapons_carried & WEAP_SPANNER ) | | ( self . weapons_carried & WEAP_SPANNER & & self . tf_items & NIT_TESLA ) | | ( self . weapons_carried & WEAP_SPANNER & & self . tf_items & NIT_SECURITY_CAMERA ) | | ( self . weapons_carried & WEAP_SPANNER & & self . tf_items & NIT_TELEPORTER ) ) )
2001-07-17 05:58:10 +00:00
newmis . ammo_cells = self . ammo_cells ;
}
// If there's nothing in the backpack, remove it and return
if ( ! ( newmis . ammo_shells + newmis . ammo_nails + newmis . ammo_rockets + newmis . ammo_cells ) )
{
dremove ( newmis ) ;
return ;
}
// Remove the ammo from the player
if ( newmis . ammo_shells )
self . ammo_shells = 0 ;
if ( newmis . ammo_nails )
self . ammo_nails = 0 ;
if ( newmis . ammo_rockets )
self . ammo_rockets = 0 ;
if ( newmis . ammo_cells )
self . ammo_cells = 0 ;
W_SetCurrentAmmo ( ) ;
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_ITEM , " weapons/lock4.wav " , 1 , ATTN_NORM ) ;
2001-07-17 05:58:10 +00:00
// The backpack is treated as an ammobox, so people can't crash svrs
// by making too many of them.
if ( self . team_no ! = 0 )
{
increment_team_ammoboxes ( self . team_no ) ;
2001-07-23 20:52:47 +00:00
if ( num_team_ammoboxes ( self . team_no ) > ( MAX_WORLD_AMMOBOXES / number_of_teams ) )
2001-07-17 05:58:10 +00:00
RemoveOldAmmobox ( self . team_no ) ;
}
else
{
num_world_ammoboxes = num_world_ammoboxes + 1 ;
2001-07-23 20:52:47 +00:00
if ( num_world_ammoboxes > MAX_WORLD_AMMOBOXES )
2001-07-17 05:58:10 +00:00
RemoveOldAmmobox ( 0 ) ;
}
// Throw the backpack
newmis . enemy = self ;
newmis . health = time ;
newmis . weapon = 0 ;
2001-07-23 20:52:47 +00:00
newmis . movetype = MOVETYPE_TOSS ;
newmis . solid = SOLID_TRIGGER ;
2001-07-17 05:58:10 +00:00
newmis . classname = " ammobox " ;
newmis . team_no = self . team_no ;
makevectors ( self . v_angle ) ;
if ( self . v_angle_x )
{
newmis . velocity = v_forward * 400 + v_up * 200 ;
}
else
{
newmis . velocity = aim ( self , 10000 ) ;
newmis . velocity = newmis . velocity * 400 ;
newmis . velocity_z = 200 ;
}
newmis . avelocity = ' 0 300 0 ' ;
setsize ( newmis , ' 0 0 0 ' , ' 0 0 0 ' ) ;
setorigin ( newmis , self . origin ) ;
newmis . nextthink = time + 30 ; // remove after 30 seconds
newmis . think = SUB_Remove ;
newmis . touch = TeamFortress_AmmoboxTouch ;
setmodel ( newmis , " progs/backpack.mdl " ) ;
} ;
//=========================================================================
// Shows any medics/engineers on your team that you need help.
// Spies see all requests.
void ( ) TeamFortress_SaveMe =
{
local entity te , tl ;
if ( self . last_saveme_sound < time )
{
if ( random ( ) < 0.8 )
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_WEAPON , " speech/saveme1.wav " , 1 , ATTN_NORM ) ; // MEDIC!
2001-07-17 05:58:10 +00:00
else
2001-07-23 20:52:47 +00:00
sound ( self , CHAN_WEAPON , " speech/saveme2.wav " , 1 , ATTN_NORM ) ; // Excuse me...
2001-07-17 05:58:10 +00:00
self . last_saveme_sound = time + 4 ;
}
2001-11-02 17:00:52 +00:00
te = find ( NIL , classname , " player " ) ;
2001-07-17 05:58:10 +00:00
while ( te )
{
2001-07-23 20:52:47 +00:00
if ( self . weapons_carried & WEAP_MEDIKIT )
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
if ( self = = te | | te . weapons_carried & WEAP_MEDIKIT | | te . weapons_carried & WEAP_SPANNER | | te . cutf_items & CUTF_SPY_KIT ) //WK Custom class friendly
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
if ( Teammate ( self . team_no , te . team_no ) | | ( te . cutf_items & CUTF_SPY_KIT ) )
2001-07-17 05:58:10 +00:00
{
// If the other teammate is visible, show them I need help
if ( visible ( te ) )
{
msg_entity = te ;
tl = spawn ( ) ;
tl . origin = self . origin ;
tl . origin_z = tl . origin_z + 32 ;
2001-07-23 20:52:47 +00:00
WriteByte ( MSG_ONE , SVC_TEMPENTITY ) ;
WriteByte ( MSG_ONE , TE_LIGHTNING3 ) ;
WriteEntity ( MSG_ONE , tl ) ;
WriteCoord ( MSG_ONE , tl . origin_x ) ;
WriteCoord ( MSG_ONE , tl . origin_y ) ;
WriteCoord ( MSG_ONE , tl . origin_z + 24 ) ;
WriteCoord ( MSG_ONE , self . origin_x ) ;
WriteCoord ( MSG_ONE , self . origin_y ) ;
WriteCoord ( MSG_ONE , self . origin_z ) ;
2001-07-17 05:58:10 +00:00
dremove ( tl ) ;
}
}
}
te = find ( te , classname , " player " ) ;
}
} ;
//=========================================================================
// ID's the player in your sights, and if you're a medic or engineer,
// reports their health and armor.
void ( float inAuto ) TeamFortress_ID =
{
// OfN Returns if any menu is being displayed
2001-07-23 20:52:47 +00:00
//if (self.current_menu != MENU_DEFAULT)
2001-07-17 05:58:10 +00:00
// return; DON'T WORK
//WK All the inAuto and spacer stuff I added
local vector src ;
local string st , cls ;
local string spacer ;
src = self . origin + v_forward * 10 ;
src_z = self . absmin_z + self . size_z * 0.7 ;
if ( ! inAuto ) //WK I.e. just someone is doing it normally
2001-07-23 20:52:47 +00:00
traceline ( src , src + v_forward * 2048 , FALSE , self ) ;
2001-07-17 05:58:10 +00:00
else //WK I.e. it is an autoscan
2001-07-23 20:52:47 +00:00
traceline ( src , src + v_forward * 1024 , FALSE , self ) ;
2001-07-17 05:58:10 +00:00
if ( inAuto )
{
2001-07-23 20:52:47 +00:00
if ( trace_ent . classname = = " player " & & trace_ent . job & ( JOB_THIEF + JOB_ACTIVE ) )
2001-07-17 05:58:10 +00:00
return ;
//- ofn - auto id doesnt pertubate menus
2001-07-23 20:52:47 +00:00
//if (self.current_menu != MENU_DEFAULT)
2001-07-17 05:58:10 +00:00
// return; DOESNT WORK?
}
//if (!inAuto)
//spacer = "\n\n\n\n\n";
spacer = " \n " ;
//else
// spacer = "\n\n\n\n\n\n\n";
2001-11-02 17:00:52 +00:00
if ( trace_ent & & trace_ent . origin ! = world . origin )
2001-07-17 05:58:10 +00:00
{
if ( trace_ent . classname = = " player " & & trace_ent . health > 0 )
{
self . StatusRefreshTime = time + 1.5 ;
if ( Teammate ( trace_ent . team_no , self . team_no ) )
{
2001-07-23 20:52:47 +00:00
if ( trace_ent . playerclass = = PC_CUSTOM )
2001-07-17 05:58:10 +00:00
cls = TeamFortress_GetJobName ( trace_ent . job ) ;
else
cls = TeamFortress_GetClassName ( trace_ent . playerclass ) ;
2001-07-23 20:52:47 +00:00
if ( self . weapons_carried & WEAP_MEDIKIT ) //WK
2001-07-17 05:58:10 +00:00
{
st = ftos ( trace_ent . health ) ;
centerprint ( self , spacer , trace_ent . netname , " \n \n Friendly " , cls , " \n \n " , st , " health \n " ) ;
//centerprint(self, "\n\n\n\n", trace_ent.netname, "\nFriendly ", cls, "\n", st, //" health\n");
return ;
}
2001-07-23 20:52:47 +00:00
else if ( self . weapons_carried & WEAP_SPANNER ) //WK
2001-07-17 05:58:10 +00:00
{
st = ftos ( trace_ent . armorvalue ) ;
centerprint ( self , spacer , trace_ent . netname , " \n \n Friendly " , cls , " \n \n " , st , " armor \n " ) ;
return ;
}
else
centerprint ( self , spacer , trace_ent . netname , " \n \n Friendly " , cls , " \n " ) ;
return ;
}
if ( trace_ent . is_feigning ) //WK Can't id enemy spies feigning
return ;
2001-07-23 20:52:47 +00:00
if ( trace_ent . cutf_items & CUTF_SPY_KIT )
2001-07-17 05:58:10 +00:00
{
cls = TeamFortress_GetClassName ( trace_ent . undercover_skin ) ;
// Report a false name
if ( self . team_no ! = 0 & & ( self . team_no = = trace_ent . undercover_team ) )
{
2001-07-23 20:52:47 +00:00
if ( self . weapons_carried & WEAP_MEDIKIT )
2001-07-17 05:58:10 +00:00
{
st = ftos ( trace_ent . health ) ;
if ( trace_ent . undercover_skin ! = 0 )
centerprint ( self , spacer , trace_ent . undercover_name , " \n \n Friendly " , cls , " \n \n " , st , " health \n " ) ;
else
centerprint ( self , spacer , trace_ent . undercover_name , " \n \n Friendly Spy \n \n " , st , " health \n " ) ;
return ;
}
2001-07-23 20:52:47 +00:00
else if ( self . weapons_carried & WEAP_SPANNER )
2001-07-17 05:58:10 +00:00
{
st = ftos ( trace_ent . armorvalue ) ;
if ( trace_ent . undercover_skin ! = 0 )
centerprint ( self , spacer , trace_ent . undercover_name , " \n \n Friendly " , cls , " \n \n " , st , " armor \n " ) ;
else
centerprint ( self , spacer , trace_ent . undercover_name , " \n \n Friendly Spy \n \n " , st , " armor \n " ) ;
return ;
}
else
{
st = ftos ( trace_ent . armorvalue ) ;
if ( trace_ent . undercover_skin ! = 0 )
centerprint ( self , spacer , trace_ent . undercover_name , " \n \n Friendly " , cls , " \n " ) ;
else
centerprint ( self , spacer , trace_ent . undercover_name , " \n \n Friendly Spy \n " ) ;
return ;
}
}
2001-09-30 22:38:44 +00:00
if ( trace_ent . undercover_name )
2001-07-17 05:58:10 +00:00
{
if ( trace_ent . undercover_skin ! = 0 )
centerprint ( self , spacer , trace_ent . undercover_name , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " , cls , " \n " ) ;
else
centerprint ( self , spacer , trace_ent . undercover_name , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Spy" ) ;
}
else
{
if ( trace_ent . undercover_skin ! = 0 )
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " , cls , " \n " ) ;
else
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Spy" ) ;
}
}
else
{
2001-07-23 20:52:47 +00:00
if ( trace_ent . playerclass = = PC_CUSTOM ) {
2001-07-17 05:58:10 +00:00
cls = TeamFortress_GetJobName ( trace_ent . job ) ;
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " , cls , " \n " ) ;
}
else {
cls = TeamFortress_GetClassName ( trace_ent . playerclass ) ;
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " , cls , " \n " ) ;
}
}
}
else if ( trace_ent . classname = = " building_dispenser " )
{
self . StatusRefreshTime = time + 1.5 ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " Your Dispenser \n " ) ;
else if ( ! teamplay )
centerprint ( self , spacer , " Dispenser made by \n \n " , trace_ent . real_owner . netname ) ;
else if ( Teammate ( trace_ent . team_no , self . team_no ) )
centerprint ( self , spacer , " Friendly Dispenser made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else
centerprint ( self , spacer , " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Dispenser made by\n \n " , trace_ent . real_owner . netname , " \n " ) ;
}
else if ( trace_ent . classname = = " building_fieldgen " )
{
self . StatusRefreshTime = time + 1.5 ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " Your Field Generator. \n " ) ;
else if ( ! teamplay )
centerprint ( self , spacer , " Field Generator made by \n \n " , trace_ent . real_owner . netname ) ;
else if ( Teammate ( trace_ent . team_no , self . team_no ) )
centerprint ( self , spacer , " Friendly Field Generator made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else
centerprint ( self , spacer , " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Field Generator made by\n \n " , trace_ent . real_owner . netname , " \n " ) ;
}
else if ( trace_ent . classname = = " building_sentrygun " | | trace_ent . classname = = " building_sentrygun_base " )
{
self . StatusRefreshTime = time + 1.5 ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " Your SentryGun \n " ) ;
else if ( ! teamplay )
centerprint ( self , spacer , " Sentrygun made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else if ( Teammate ( trace_ent . team_no , self . team_no ) )
centerprint ( self , spacer , " Friendly Sentrygun made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else
centerprint ( self , spacer , " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Sentrygun made by\n \n " , trace_ent . real_owner . netname , " \n " ) ;
}
else if ( trace_ent . classname = = " building_tesla " )
{
self . StatusRefreshTime = time + 1.5 ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " Your favorite Tesla Sentry \n " ) ;
else if ( ! teamplay )
centerprint ( self , spacer , " Tesla Sentry made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else if ( Teammate ( trace_ent . team_no , self . team_no ) )
centerprint ( self , spacer , " Friendly Tesla made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else
centerprint ( self , spacer , " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Tesla made by\n \n " , trace_ent . real_owner . netname , " \n " ) ;
}
else if ( trace_ent . classname = = " building_camera " )
{
self . StatusRefreshTime = time + 1.5 ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " Your favorite Security Camera \n " ) ;
else if ( ! teamplay )
centerprint ( self , spacer , " Security Camera made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else if ( Teammate ( trace_ent . team_no , self . team_no ) )
centerprint ( self , spacer , " Friendly Security Camera made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else
centerprint ( self , spacer , " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Security Camera made by\n \n " , trace_ent . real_owner . netname , " \n " ) ;
}
else if ( trace_ent . classname = = " building_sensor " )
{
self . StatusRefreshTime = time + 1.5 ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " Your favorite Motion Sensor \n " ) ;
else if ( ! teamplay )
centerprint ( self , spacer , " Motion Sensor made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else if ( Teammate ( trace_ent . team_no , self . team_no ) )
centerprint ( self , spacer , " Friendly Motion Sensor made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else
centerprint ( self , spacer , " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Motion Sensor made by\n \n " , trace_ent . real_owner . netname , " \n " ) ;
}
else if ( trace_ent . classname = = " building_teleporter " )
{
self . StatusRefreshTime = time + 1.5 ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " One of your favorite Teleporter Pads \n " ) ; //CH b/c you have 2
else if ( ! teamplay )
centerprint ( self , spacer , " Teleporter Pad made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else if ( Teammate ( trace_ent . team_no , self . team_no ) )
centerprint ( self , spacer , " Friendly Teleporter Pad made by \n \n " , trace_ent . real_owner . netname , " \n " ) ;
else
centerprint ( self , spacer , " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Teleporter Pad made by\n \n " , trace_ent . real_owner . netname , " \n " ) ;
}
else if ( trace_ent . classname = = " monster_demon1 " )
{
custom_demon_name ( trace_ent ) ; //CH
self . StatusRefreshTime = time + 1.5 ;
st = ftos ( trace_ent . health ) ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " Your Pet Demon " , trace_ent . netname , " \n \n " , st , " health " ) ;
else if ( ! teamplay )
centerprint ( self , spacer , " Demon summoned by \n \n " , trace_ent . real_owner . netname ) ;
else if ( Teammate ( trace_ent . real_owner . team_no , self . team_no ) )
{
2001-07-23 20:52:47 +00:00
if ( self . cutf_items & CUTF_DEMONLORE )
2001-07-17 05:58:10 +00:00
centerprint ( self , spacer , trace_ent . netname , " \n \n friendly demon summoned by \n \n " , trace_ent . real_owner . netname , " \n \n " , st , " health " ) ;
else
centerprint ( self , spacer , trace_ent . netname , " \n \n friendly demon summoned by \n \n " , trace_ent . real_owner . netname ) ;
}
else
{
2001-07-23 20:52:47 +00:00
if ( self . cutf_items & CUTF_DEMONLORE )
2001-07-17 05:58:10 +00:00
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> demon summoned by\n \n " , trace_ent . real_owner . netname , " \n \n " , st , " health " ) ;
else
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> demon summoned by\n \n " , trace_ent . real_owner . netname , " \n \n " , st , " health " ) ;
}
}
else if ( trace_ent . classname = = " monster_army " )
{
custom_demon_name ( trace_ent ) ; //CH
self . StatusRefreshTime = time + 1.5 ;
st = ftos ( trace_ent . health ) ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " Your mercenary soldier " , trace_ent . netname , " \n \n " , st , " health " ) ;
else if ( ! teamplay )
centerprint ( self , spacer , " Soldier in the pay of \n \n " , trace_ent . real_owner . netname ) ;
else if ( Teammate ( trace_ent . real_owner . team_no , self . team_no ) )
{
2001-07-23 20:52:47 +00:00
if ( self . cutf_items & CUTF_DEMONLORE )
2001-07-17 05:58:10 +00:00
centerprint ( self , spacer , trace_ent . netname , " \n \n friendly soldier owned by \n \n " , trace_ent . real_owner . netname , " \n \n " , st , " health " ) ;
else
centerprint ( self , spacer , trace_ent . netname , " \n \n friendly soldier owned by \n \n " , trace_ent . real_owner . netname ) ;
}
else
{
2001-07-23 20:52:47 +00:00
if ( self . cutf_items & CUTF_DEMONLORE )
2001-07-17 05:58:10 +00:00
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> soldier owned by\n \n " , trace_ent . real_owner . netname , " \n \n " , st , " health " ) ;
else
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> soldier owned by\n \n " , trace_ent . real_owner . netname ) ;
}
}
else if ( trace_ent . classname = = " monster_shambler " )
{
custom_demon_name ( trace_ent ) ; //CH
self . StatusRefreshTime = time + 1.5 ;
st = ftos ( trace_ent . health ) ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " Your Pet Shambler " , trace_ent . netname , " \n \n " , st , " health " ) ;
else if ( ! teamplay )
centerprint ( self , spacer , " Shambler under control of \n \n " , trace_ent . real_owner . netname ) ;
else if ( Teammate ( trace_ent . real_owner . team_no , self . team_no ) )
{
2001-07-23 20:52:47 +00:00
if ( self . cutf_items & CUTF_DEMONLORE )
2001-07-17 05:58:10 +00:00
centerprint ( self , spacer , trace_ent . netname , " \n \n friendly shambler summoned by \n \n " , trace_ent . real_owner . netname , " \n \n " , st , " health " ) ;
else
centerprint ( self , spacer , trace_ent . netname , " \n \n friendly shambler summoned by \n \n " , trace_ent . real_owner . netname ) ;
}
else
{
2001-07-23 20:52:47 +00:00
if ( self . cutf_items & CUTF_DEMONLORE )
2001-07-17 05:58:10 +00:00
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> shambler summoned by\n \n " , trace_ent . real_owner . netname , " \n \n " , st , " health " ) ;
else
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> shambler summoned by\n \n " , trace_ent . real_owner . netname ) ;
}
}
else if ( trace_ent . classname = = " monster_wizard " ) //- OfN
{
custom_demon_name ( trace_ent ) ;
self . StatusRefreshTime = time + 1.5 ;
st = ftos ( trace_ent . health ) ;
if ( self = = trace_ent . real_owner )
centerprint ( self , spacer , " Your flying Scrag " , trace_ent . netname , " \n \n " , st , " health " ) ;
else if ( ! teamplay )
centerprint ( self , spacer , " Scrag under control of \n \n " , trace_ent . real_owner . netname ) ;
else if ( Teammate ( trace_ent . real_owner . team_no , self . team_no ) )
{
2001-07-23 20:52:47 +00:00
if ( self . cutf_items & CUTF_DEMONLORE )
2001-07-17 05:58:10 +00:00
centerprint ( self , spacer , trace_ent . netname , " \n \n friendly Scrag summoned by \n \n " , trace_ent . real_owner . netname , " \n \n " , st , " health " ) ;
else
centerprint ( self , spacer , trace_ent . netname , " \n \n friendly Scrag summoned by \n \n " , trace_ent . real_owner . netname ) ;
}
else
{
2001-07-23 20:52:47 +00:00
if ( self . cutf_items & CUTF_DEMONLORE )
2001-07-17 05:58:10 +00:00
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Scrag summoned by\n \n " , trace_ent . real_owner . netname , " \n \n " , st , " health " ) ;
else
centerprint ( self , spacer , trace_ent . netname , " \n \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Scrag summoned by\n \n " , trace_ent . real_owner . netname ) ;
}
}
}
} ;
//=========================================================================
// Reloads the current weapon
void ( ) TeamFortress_ReloadCurrentWeapon =
{
local float rt ;
local entity tWeapon ;
2001-07-23 20:52:47 +00:00
if ( self . current_weapon = = WEAP_SHOTGUN )
2001-07-17 05:58:10 +00:00
{
if ( self . reload_shotgun = = 0 )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Clip full. \n " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
if ( self . reload_shotgun < self . ammo_shells )
{
Attack_Finished ( 0.4 ) ;
// Calculate the reload time needed
2001-07-23 20:52:47 +00:00
rt = ( RE_SHOTGUN - self . reload_shotgun ) / RE_SHOTGUN ;
rt = RE_SHOTGUN_TIME - ( RE_SHOTGUN_TIME * rt ) ;
2001-07-17 05:58:10 +00:00
self . reload_shotgun = 0 ;
2001-07-23 20:52:47 +00:00
if ( self . ammo_shells < RE_SHOTGUN )
self . reload_shotgun = RE_SHOTGUN - self . ammo_shells ;
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " reloading... \n " ) ;
self . tfstate = ( self . tfstate | TFSTATE_RELOADING ) ;
2001-07-17 05:58:10 +00:00
tWeapon = spawn ( ) ;
tWeapon . netname = " reloadtimer " ; //WK For Judoka code
tWeapon . owner = self ;
tWeapon . classname = " timer " ;
tWeapon . nextthink = time + rt ;
tWeapon . think = W_Reload_shotgun ;
self . weaponmodel = " " ;
self . weaponframe = 0 ;
}
else
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " not enough ammo to reload \n " ) ;
2001-07-17 05:58:10 +00:00
}
}
2001-07-23 20:52:47 +00:00
else if ( self . current_weapon = = WEAP_SUPER_SHOTGUN )
2001-07-17 05:58:10 +00:00
{
if ( self . reload_super_shotgun = = 0 )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Clip full. \n " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
if ( self . reload_super_shotgun < self . ammo_shells )
{
Attack_Finished ( 0.7 ) ;
// Calculate the reload time needed
2001-07-23 20:52:47 +00:00
rt = ( RE_SUPER_SHOTGUN - self . reload_super_shotgun ) / RE_SUPER_SHOTGUN ;
rt = RE_SUPER_SHOTGUN_TIME - ( RE_SUPER_SHOTGUN_TIME * rt ) ;
2001-07-17 05:58:10 +00:00
self . reload_super_shotgun = 0 ;
2001-07-23 20:52:47 +00:00
if ( self . ammo_shells < RE_SUPER_SHOTGUN )
self . reload_super_shotgun = RE_SUPER_SHOTGUN - self . ammo_shells ;
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " reloading... \n " ) ;
self . tfstate = ( self . tfstate | TFSTATE_RELOADING ) ;
2001-07-17 05:58:10 +00:00
tWeapon = spawn ( ) ;
tWeapon . netname = " reloadtimer " ; //WK For Judoka code
tWeapon . owner = self ;
tWeapon . classname = " timer " ;
tWeapon . nextthink = time + rt ;
tWeapon . think = W_Reload_super_shotgun ;
self . weaponmodel = " " ;
self . weaponframe = 0 ;
}
else
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " not enough ammo to reload \n " ) ;
2001-07-17 05:58:10 +00:00
}
}
2001-07-23 20:52:47 +00:00
else if ( self . current_weapon = = WEAP_LASERCANNON )
2001-07-17 05:58:10 +00:00
{
if ( self . reload_laser_cannon = = 0 )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Cannon already in full charge. \n " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
if ( self . reload_laser_cannon < self . ammo_cells )
{
Attack_Finished ( 2 ) ;
// Calculate the reload time needed
2001-07-23 20:52:47 +00:00
rt = ( RE_LASER_CANNON - self . reload_laser_cannon ) / RE_LASER_CANNON ;
rt = RE_LASER_CANNON_TIME - ( RE_LASER_CANNON_TIME * rt ) ;
2001-07-17 05:58:10 +00:00
self . reload_laser_cannon = 0 ;
2001-07-23 20:52:47 +00:00
if ( self . ammo_cells < RE_LASER_CANNON )
self . reload_laser_cannon = RE_LASER_CANNON - self . ammo_cells ;
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Charging cannon... \n " ) ;
self . tfstate = ( self . tfstate | TFSTATE_RELOADING ) ;
2001-07-17 05:58:10 +00:00
tWeapon = spawn ( ) ;
tWeapon . netname = " reloadtimer " ; //WK For Judoka code
tWeapon . owner = self ;
tWeapon . classname = " timer " ;
tWeapon . nextthink = time + rt ;
tWeapon . think = W_Reload_laser_cannon ;
self . weaponmodel = " " ;
self . weaponframe = 0 ;
}
else
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " not enough ammo to reload \n " ) ;
2001-07-17 05:58:10 +00:00
}
}
2001-07-23 20:52:47 +00:00
else if ( self . current_weapon = = WEAP_LIGHT_ASSAULT )
2001-07-17 05:58:10 +00:00
{
if ( self . reload_light_assault = = 0 )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Clip full. \n " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
if ( self . reload_light_assault < self . ammo_nails )
{
Attack_Finished ( 2 ) ;
// Calculate the reload time needed
2001-07-23 20:52:47 +00:00
rt = ( RE_LIGHT_ASSAULT - self . reload_light_assault ) / RE_LIGHT_ASSAULT ;
rt = RE_LIGHT_ASSAULT_TIME - ( RE_LIGHT_ASSAULT_TIME * rt ) ;
2001-07-17 05:58:10 +00:00
self . reload_light_assault = 0 ;
2001-07-23 20:52:47 +00:00
if ( self . ammo_nails < RE_LIGHT_ASSAULT )
self . reload_light_assault = RE_LIGHT_ASSAULT - self . ammo_nails ;
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " reloading... \n " ) ;
self . tfstate = ( self . tfstate | TFSTATE_RELOADING ) ;
2001-07-17 05:58:10 +00:00
tWeapon = spawn ( ) ;
tWeapon . netname = " reloadtimer " ; //WK For Judoka code
tWeapon . owner = self ;
tWeapon . classname = " timer " ;
tWeapon . nextthink = time + rt ;
tWeapon . think = W_Reload_light_assault ;
self . weaponmodel = " " ;
self . weaponframe = 0 ;
}
else
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " not enough ammo to reload \n " ) ;
2001-07-17 05:58:10 +00:00
}
}
2001-07-23 20:52:47 +00:00
else if ( self . current_weapon = = WEAP_GRENADE_LAUNCHER )
2001-07-17 05:58:10 +00:00
{
if ( self . reload_grenade_launcher = = 0 )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Clip full. \n " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
if ( self . reload_grenade_launcher < self . ammo_rockets )
{
Attack_Finished ( 0.6 ) ;
// Calculate the reload time needed
2001-07-23 20:52:47 +00:00
rt = ( RE_GRENADE_LAUNCHER - self . reload_grenade_launcher ) / RE_GRENADE_LAUNCHER ;
rt = RE_GRENADE_LAUNCHER_TIME - ( RE_GRENADE_LAUNCHER_TIME * rt ) ;
2001-07-17 05:58:10 +00:00
self . reload_grenade_launcher = 0 ;
2001-07-23 20:52:47 +00:00
if ( self . ammo_rockets < RE_GRENADE_LAUNCHER )
self . reload_grenade_launcher = RE_GRENADE_LAUNCHER - self . ammo_rockets ;
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " reloading... \n " ) ;
self . tfstate = ( self . tfstate | TFSTATE_RELOADING ) ;
2001-07-17 05:58:10 +00:00
tWeapon = spawn ( ) ;
tWeapon . netname = " reloadtimer " ; //WK For Judoka code
tWeapon . owner = self ;
tWeapon . classname = " timer " ;
tWeapon . nextthink = time + rt ;
tWeapon . think = W_Reload_grenade_launcher ;
self . weaponmodel = " " ;
self . weaponframe = 0 ;
}
else {
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " not enough ammo to reload \n " ) ;
2001-07-17 05:58:10 +00:00
}
}
2001-07-23 20:52:47 +00:00
else if ( self . current_weapon = = WEAP_ROCKET_LAUNCHER )
2001-07-17 05:58:10 +00:00
{
if ( self . reload_rocket_launcher = = 0 )
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Clip full. \n " ) ;
2001-07-17 05:58:10 +00:00
return ;
}
if ( self . reload_rocket_launcher < self . ammo_rockets )
{
Attack_Finished ( 0.8 ) ;
// Calculate the reload time needed
2001-07-23 20:52:47 +00:00
rt = ( RE_ROCKET_LAUNCHER - self . reload_rocket_launcher ) / RE_ROCKET_LAUNCHER ;
rt = RE_ROCKET_LAUNCHER_TIME - ( RE_ROCKET_LAUNCHER_TIME * rt ) ;
2001-07-17 05:58:10 +00:00
self . reload_rocket_launcher = 0 ;
2001-07-23 20:52:47 +00:00
if ( self . ammo_rockets < RE_ROCKET_LAUNCHER )
self . reload_rocket_launcher = RE_ROCKET_LAUNCHER - self . ammo_rockets ;
2001-07-17 05:58:10 +00:00
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " reloading... \n " ) ;
self . tfstate = ( self . tfstate | TFSTATE_RELOADING ) ;
2001-07-17 05:58:10 +00:00
tWeapon = spawn ( ) ;
tWeapon . netname = " reloadtimer " ; //WK For Judoka code
tWeapon . owner = self ;
tWeapon . classname = " timer " ;
tWeapon . nextthink = time + rt ;
tWeapon . think = W_Reload_rocket_launcher ;
self . weaponmodel = " " ;
self . weaponframe = 0 ;
}
}
} ;
//CH drops an item TF goal if the bits are set to allow it.
void ( ) TeamFortress_DropItems =
{
local entity tg ;
2003-11-30 01:06:48 +00:00
local string st = infokey ( NIL , " ad " ) ;
local float always = FALSE ;
if ( ! st )
st = infokey ( NIL , " always_drop " ) ;
if ( st = = " on " | | st = = " yes " | | st = = " 1 " )
always = TRUE ;
2001-11-02 17:00:52 +00:00
tg = find ( NIL , classname , " item_tfgoal " ) ;
2001-07-17 05:58:10 +00:00
while ( tg )
{
2001-11-02 17:00:52 +00:00
if ( tg . owner = = self & & tg & & tg . classname = = " item_tfgoal " )
2001-07-17 05:58:10 +00:00
{
2003-11-30 01:06:48 +00:00
if ( ( tg . goal_activation & TFGI_DROPITEMS ) | | always )
2001-07-17 05:58:10 +00:00
{
2001-07-23 20:52:47 +00:00
sprint ( self , PRINT_HIGH , " Dropping item: " ) ;
sprint ( self , PRINT_HIGH , tg . netname ) ;
sprint ( self , PRINT_HIGH , " \n " ) ;
2001-07-17 05:58:10 +00:00
tfgoalitem_RemoveFromPlayer ( tg , self , 0 ) ;
//CH it treats it as though you died. And if bits are set, you throw it, or it gets removed etc.
}
}
tg = find ( tg , classname , " item_tfgoal " ) ;
}
} ;