2006-01-01 00:37:52 +00:00
/*
*/
2009-11-05 03:40:39 +00:00
void ( ) show_light_level ;
void ( ) UseStimpack ;
void ( ) UseSuperStim ;
void ( ) UseMedicalBag ;
void ( entity chest , float iid , float num ) DropFromChest ;
void ( ) AddClone ;
void ( ) SpawnGModel ;
void ( string snd , float type ) function_radio ;
void ( ) MapInfo ;
2006-01-01 00:37:52 +00:00
void ( entity targ , entity inflictor , entity attacker , float damage ) T_Damage ;
void ( ) player_run ;
2009-11-15 02:36:24 +00:00
void ( ) walkmonster_start ;
2006-01-01 00:37:52 +00:00
void ( entity bomb , entity attacker , float rad , entity ignore , string dtype ) T_RadiusDamage ;
2009-11-05 03:40:39 +00:00
void ( entity bomb , entity attacker , float rad , entity ignore , float xrange ) T_RadiusDamage2 ;
void ( ) ZoomIn ;
void ( float dam , float xrecoil , string snd , float rng , float rate ) FireMinigun ;
void ( float db ) loud_noise ;
void ( ) player_auto_duck1 ;
void ( ) player_auto_ducka1 ;
2006-01-01 00:37:52 +00:00
void ( vector org , float damage ) SpawnBlood ;
2009-11-05 03:40:39 +00:00
void ( vector org , float damage ) SpawnNonBlood ;
2006-01-01 00:37:52 +00:00
void ( ) SuperDamageSound ;
2009-11-05 03:40:39 +00:00
void ( float rec , float speed , float dam , float type ) FirePulseRifle ;
void ( float rec , float number , float dam , float var , float ran , float auto , string snd ) W_FireShotgun ;
2006-01-01 00:37:52 +00:00
void ( float dam , float rec , string snd , float rng , float rate ) FireAssaultRifle ;
void ( float dam , float rec , string snd , float rng , float rate ) FirePistol ;
void ( float dam , float rec , string snd , float rng , float rate ) FireSMG ;
2006-01-04 20:45:08 +00:00
float ( ) FireToolkit ;
2009-11-05 03:40:39 +00:00
void ( ) HostageReport ;
void ( entity jeb , float time ) spawn_excla ;
2009-11-15 02:36:24 +00:00
void ( entity jeb , float time ) spawn_stop ;
2006-01-05 01:56:45 +00:00
void ( ) FireAlienBlaster ;
2006-01-01 00:37:52 +00:00
void ( ) W_PlayerMenu ;
2009-11-05 03:40:39 +00:00
void ( ) player_single_shot ;
void ( ) player_single_shot_duck ;
2006-01-02 22:04:05 +00:00
//void () UseChem;
2006-01-01 21:33:21 +00:00
void ( ) Special ;
void ( ) BuyMenu ;
2006-01-01 00:37:52 +00:00
void ( ) Sneak ;
2006-01-02 22:04:05 +00:00
//void() Bandage;
2006-01-01 00:37:52 +00:00
void ( ) Shield ;
2009-11-05 03:40:39 +00:00
void ( ) player_pull1 ;
void ( ) player_dragon_kick ;
void ( ) player_kick1 ;
void ( ) player_kick1a ;
void ( ) player_swing1 ;
void ( ) player_swing1a ;
void ( ) player_punch1 ;
void ( ) player_punch2 ;
2006-01-01 21:33:21 +00:00
void ( ) player_knife1 ;
void ( ) player_knifea ;
2009-11-05 03:40:39 +00:00
void ( ) player_spear1 ;
void ( ) player_spear1a ;
void ( ) player_axe1 ;
void ( ) player_axeb1 ;
2006-01-01 21:33:21 +00:00
void ( ) ExitScreen ;
void ( ) CharacterSheet ;
void ( ) UseEquipment ;
2006-01-02 03:58:02 +00:00
void ( float slot , float snd , float drop ) DropFromSlot ;
2006-01-02 00:14:21 +00:00
void ( ) PositionControl ;
2006-01-02 05:40:11 +00:00
void ( ) autofire ;
void ( ) autofire_s ;
2006-01-02 22:04:05 +00:00
float ( float iid ) UseBoostingChem ;
float ( float iid ) UseHealingChem ;
float ( float slotno ) DecreaseDestroySlot ;
2006-01-15 01:38:45 +00:00
void ( ) DropAmmo ;
2009-11-05 03:40:39 +00:00
void ( ) player_singlex ;
void ( ) player_singley ;
void ( string arg1 ) Cmd_InvUse ;
2006-01-01 00:37:52 +00:00
2006-01-02 03:58:02 +00:00
# define weightx() (self.weight)
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
2006-01-01 00:37:52 +00:00
// called by worldspawn
void ( ) W_Precache =
{
precache_sound ( " weapons/r_exp3.wav " ) ; // new rocket explosion
precache_sound ( " weapons/rocket1i.wav " ) ; // spike gun
precache_sound ( " weapons/sgun1.wav " ) ;
precache_sound ( " weapons/guncock.wav " ) ; // player shotgun
precache_sound ( " weapons/ric1.wav " ) ; // ricochet (used in c code)
precache_sound ( " weapons/ric2.wav " ) ; // ricochet (used in c code)
precache_sound ( " weapons/ric3.wav " ) ; // ricochet (used in c code)
precache_sound ( " weapons/ric4.wav " ) ; // ricochet (used in c code)
precache_sound ( " weapons/ric5.wav " ) ; // ricochet (used in c code)
precache_sound ( " weapons/spike2.wav " ) ; // super spikes
precache_sound ( " weapons/tink1.wav " ) ; // spikes tink (used in c code)
precache_sound ( " weapons/grenade.wav " ) ; // grenade launcher
precache_sound ( " weapons/bounce.wav " ) ; // grenade bounce
precache_sound ( " weapons/shotgn2.wav " ) ; // super shotgun
} ;
float ( ) crandom =
{
return 2 * ( random ( ) - 0.5 ) ;
} ;
2009-11-13 05:05:32 +00:00
2009-11-16 17:42:41 +00:00
void ( ) healing_bob =
{
local float rnd1 , rnd2 , rnd3 ;
self . cnt = self . cnt + 1 ;
if ( self . cnt = = 20 )
remove ( self ) ;
rnd1 = self . velocity_x + ( - 30 + ( random ( ) * 20 ) ) ;
rnd2 = self . velocity_y + ( - 30 + ( random ( ) * 20 ) ) ;
rnd3 = self . velocity_z + 30 + random ( ) * 10 ;
if ( random ( ) * 100 > 50 )
rnd1 = 24 ;
else
rnd1 = - 24 ;
if ( random ( ) * 100 > 50 )
rnd2 = 24 ;
else
rnd2 = - 24 ;
if ( random ( ) * 100 > 50 )
rnd3 = - 5 ;
else
rnd3 = 10 ;
self . velocity_x = rnd1 ;
self . velocity_y = rnd2 ;
self . velocity_z = rnd3 ;
self . think = healing_bob ;
self . nextthink = time + 0.2 ;
} ;
void ( entity spot ) spawn_healing =
{
local entity hologram ;
hologram = spawn ( ) ;
hologram . movetype = MOVETYPE_FLY ;
hologram . solid = SOLID_NOT ;
hologram . owner = spot ;
setmodel ( hologram , " progs/healing.spr " ) ;
setorigin ( hologram , spot . origin + ' 0 0 48 ' ) ;
setsize ( hologram , VEC_ORIGIN , VEC_ORIGIN ) ;
hologram . angles = spot . angles ;
hologram . think = healing_bob ;
hologram . nextthink = time + 0.1 ;
} ;
2009-11-13 05:05:32 +00:00
void ( float slotno ) UsePerk =
{
2009-11-15 17:06:53 +00:00
local float x , mcount ;
2009-11-13 05:05:32 +00:00
local string y , timeleft ;
local entity te ;
if ( slotno = = 1 & & self . perk1timer > 0 )
{
timeleft = ftos ( self . perk1timer ) ;
sprint ( self , 2 , " ability is not ready yet. [ " ) ;
sprint ( self , 2 , timeleft ) ;
sprint ( self , 2 , " ] \n " ) ;
sound ( self , CHAN_BODY , " misc/beep1.wav " , 1 , ATTN_NORM ) ;
return ;
}
if ( slotno = = 2 & & self . perk2timer > 0 )
{
timeleft = ftos ( self . perk2timer ) ;
sprint ( self , 2 , " ability is not ready yet. [ " ) ;
sprint ( self , 2 , timeleft ) ;
sprint ( self , 2 , " ] \n " ) ;
sound ( self , CHAN_BODY , " misc/beep1.wav " , 1 , ATTN_NORM ) ;
return ;
}
2009-11-15 02:36:24 +00:00
if ( ( self . perk1 = = 7 & & slotno = = 1 ) | | ( self . perk2 = = 7 & & slotno = = 2 ) )
2009-11-13 05:05:32 +00:00
{
if ( slotno = = 1 )
self . perk1timer = 2000 ;
if ( slotno = = 2 )
self . perk2timer = 2000 ;
sound ( self , CHAN_BODY , " misc/r_tele4.wav " , 1 , ATTN_NORM ) ;
te = findradius ( self . origin , 6000 ) ;
while ( te )
{
if ( te . classname = = " monster " )
2009-11-15 02:36:24 +00:00
{
2009-11-15 17:06:53 +00:00
te . hold = 160 ;
2009-11-15 02:36:24 +00:00
spawn_stop ( te , 10 ) ;
2009-11-15 17:06:53 +00:00
mcount = mcount + 1 ;
2009-11-15 02:36:24 +00:00
}
2009-11-13 05:05:32 +00:00
te = te . chain ;
}
}
} ;
2009-11-05 03:40:39 +00:00
void ( ) muzzleflash =
{
WriteByte ( MSG_MULTICAST , SVC_MUZZLEFLASH ) ;
WriteEntity ( MSG_MULTICAST , self ) ;
multicast ( self . origin , MULTICAST_PVS ) ;
} ;
float ( entity healer , entity saved ) RevivePlayer =
{
local entity oself ;
oself = self ;
self = saved ;
/* if (!walkmove(0, 0))
{
//too close?
return FALSE ;
}
*/
saved . deadflag = DEAD_NO ;
saved . takedamage = DAMAGE_AIM ;
saved . movetype = MOVETYPE_WALK ;
// saved.solid = SOLID_NOT;
self = oself ;
// saved.materialize = 200;
saved . ghost = 0 ;
2009-11-10 13:57:08 +00:00
saved . health = 20 + ( healer . skill_doctor ) ;
2009-11-05 03:40:39 +00:00
saved . air_finished = time + 10 ;
saved . view_ofs = ' 0 0 22 ' ;
self = saved ;
player_run ( ) ;
self = oself ;
stuffcmd ( saved , " impulse 1 \n " ) ;
if ( healer . classname = = " player " )
{
sprint ( healer , PRINT_HIGH , " you revive " ) ;
sprint ( healer , PRINT_HIGH , trace_ent . netname ) ;
sprint ( healer , PRINT_HIGH , " . \n " ) ;
}
sprint ( saved , PRINT_HIGH , healer . netname ) ;
sprint ( saved , PRINT_HIGH , " saves you from death. \n " ) ;
saved . view2 = world ;
saved . flags ( - ) FL_FINDABLE_NONSOLID ;
return TRUE ;
} ;
2006-01-01 00:37:52 +00:00
/*
= = = = = = = = = = = = = = = =
W_FireMelee
= = = = = = = = = = = = = = = =
*/
void ( float damage , float dist , float rate ) FireMelee =
{
2009-11-05 03:40:39 +00:00
local vector source , org , vec , dir ;
local float weap , dot , tdam ;
local string sdam ;
2009-11-13 05:05:32 +00:00
if ( getperk ( 5 ) ) //living anatomy
2009-11-05 03:40:39 +00:00
{
if ( self . steadyaim = = 0 )
2009-11-13 05:05:32 +00:00
damage = damage + self . skill_doctor ;
2009-11-05 03:40:39 +00:00
}
self . recoil = self . recoil + 5 ;
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
2006-01-01 00:37:52 +00:00
makevectors ( self . v_angle ) ;
source = self . origin + ' 0 0 16 ' ;
traceline ( source , source + v_forward * dist , FALSE , self ) ;
if ( trace_fraction = = 1.0 )
return ;
org = trace_endpos - v_forward * 4 ;
2009-11-05 03:40:39 +00:00
if ( self . sneak > 0 & & weap = = IID_WP_KNIFE )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
makevectors ( trace_ent . angles ) ;
vec = normalize ( ( self . origin - trace_ent . origin ) ) ;
dot = ( vec * v_forward ) ;
if ( dot < 0.5 & & trace_ent . takedamage )
{
2009-11-13 05:05:32 +00:00
tdam = 20 + ( 20 * self . skill_sneak ) ;
2009-11-07 03:43:48 +00:00
2009-11-13 05:05:32 +00:00
if ( getperk ( 9 ) )
tdam = 900 ;
2009-11-05 03:40:39 +00:00
if ( self . steadyaim = = 0 )
2009-11-07 03:43:48 +00:00
tdam = tdam + 10 ;
2009-11-05 03:40:39 +00:00
2009-11-07 03:43:48 +00:00
if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " )
2009-11-05 03:40:39 +00:00
SpawnBlood ( org , 1 ) ;
else
SpawnNonBlood ( org , 1 ) ;
T_Damage ( trace_ent , self , self , tdam ) ;
self . attack_finished = time + 2 ;
if ( trace_ent . health > 0 ) //victim survived the attack
{
bprint ( 2 , self . netname ) ;
bprint ( 2 , " ambushes " ) ;
bprint ( 2 , trace_ent . netname ) ;
bprint ( 2 , " ! \n " ) ;
if ( random ( ) * 4 < 2 )
sound ( trace_ent , CHAN_WEAPON , " player/headshot.wav " , 1 , ATTN_NONE ) ;
else
sound ( trace_ent , CHAN_WEAPON , " player/udeath.wav " , 1 , ATTN_NONE ) ;
loud_noise ( 15 ) ;
self . equipment_slot = 0 ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Uncloaked <20> \n " ) ;
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
spawn_excla ( self , 3 ) ;
}
else
{
bprint ( 2 , self . netname ) ;
bprint ( 2 , " assassinates " ) ;
bprint ( 2 , trace_ent . netname ) ;
bprint ( 2 , " ! \n " ) ;
2009-11-07 03:43:48 +00:00
self . score = self . score + 5 ;
2009-11-05 03:40:39 +00:00
if ( random ( ) * 4 < 2 )
sound ( trace_ent , CHAN_WEAPON , " player/headshot.wav " , 0.25 , ATTN_IDLE ) ;
else
sound ( trace_ent , CHAN_WEAPON , " player/udeath.wav " , 0.25 , ATTN_IDLE ) ;
}
return ;
}
else if ( trace_ent . takedamage )
{
loud_noise ( 15 ) ;
tdam = ( 30 * ( random ( ) * 30 ) ) ;
sdam = ftos ( tdam ) ;
if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & ( trace_ent . islot3 = = 0 | | self . critical = = 3 ) )
SpawnBlood ( org , 1 ) ;
else
SpawnNonBlood ( org , 1 ) ; T_Damage ( trace_ent , self , self , tdam ) ;
self . equipment_slot = 0 ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Uncloaked <20> \n " ) ;
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
spawn_excla ( self , 3 ) ;
return ;
}
}
else if ( trace_ent . takedamage )
{
//soldiers and assassins do more melee damage
if ( self . class = = 2 | | self . class = = 3 )
damage = damage * 1.25 ;
2009-11-09 04:48:58 +00:00
if ( weap = = IID_WP_SLEDGE | | weap = = IID_WP_SPEAR | | weap = = IID_WP_KNIFE )
2009-11-05 03:40:39 +00:00
SpawnBlood ( org , 1 ) ;
2006-01-01 00:37:52 +00:00
trace_ent . axhitme = 1 ;
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname ! = " car " )
{
if ( weap = = IID_NONE )
{
if ( random ( ) < 0.5 )
sound ( self , CHAN_BODY , " weapons/brawl-1.wav " , 1 , ATTN_NORM ) ;
else
sound ( self , CHAN_BODY , " weapons/brawl-2.wav " , 1 , ATTN_NORM ) ;
}
else
sound ( trace_ent , CHAN_VOICE , " player/headshot.wav " , 0.5 , ATTN_IDLE ) ;
}
2006-01-01 00:37:52 +00:00
T_Damage ( trace_ent , self , self , damage + random ( ) * damage ) ;
}
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_NONE )
{
if ( random ( ) < 0.5 )
sound ( self , CHAN_BODY , " weapons/brawl-1.wav " , 1 , ATTN_NORM ) ;
else
sound ( self , CHAN_BODY , " weapons/brawl-2.wav " , 1 , ATTN_NORM ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_SLEDGE | | weap = = IID_WP_WRENCH )
2009-11-05 03:40:39 +00:00
{
if ( random ( ) < 0.5 )
sound ( self , CHAN_BODY , " effects/axe_hit1.wav " , 1 , ATTN_NORM ) ;
else
sound ( self , CHAN_BODY , " effects/axe_hit2.wav " , 1 , ATTN_NORM ) ;
}
else if ( weap = = IID_WP_SPEAR )
{
if ( random ( ) < 0.5 )
sound ( self , CHAN_BODY , " effects/spear_hit1.wav " , 1 , ATTN_NORM ) ;
else
sound ( self , CHAN_BODY , " effects/spear_hit2.wav " , 1 , ATTN_NORM ) ;
}
else
sound ( self , CHAN_WEAPON , " weapons/knifehit.wav " , 1 , ATTN_NORM ) ;
2006-01-01 00:37:52 +00:00
} ;
2006-01-02 22:04:05 +00:00
void ( ) W_FireMelee =
{
local float iid ;
iid = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
2006-01-04 20:45:08 +00:00
if ( iid = = IID_NONE )
2009-11-05 03:40:39 +00:00
FireMelee ( 5 + random ( ) * 10 , 64 , 0.6 ) ;
else if ( iid = = IID_WP_WRENCH )
FireMelee ( 5 + random ( ) * 30 , 64 , 1.2 ) ;
2006-01-04 20:45:08 +00:00
else if ( iid = = IID_WP_KNIFE )
2009-11-05 03:40:39 +00:00
FireMelee ( 5 + random ( ) * 20 , 64 , 0.4 ) ;
2009-11-09 04:48:58 +00:00
else if ( iid = = IID_WP_SLEDGE )
2009-11-05 03:40:39 +00:00
FireMelee ( 5 + random ( ) * 80 , 96 , 1 ) ;
else if ( iid = = IID_WP_SPEAR )
FireMelee ( 5 + random ( ) * 60 , 160 , 0.8 ) ;
2006-01-02 22:04:05 +00:00
else if ( iid = = IID_CHEM_STIMPACK | |
iid = = IID_CHEM_MEDICALBAG | |
2009-11-05 03:40:39 +00:00
iid = = IID_CHEM_SUPERSTIM | |
iid = = IID_MISC_NUKACOLA )
2006-01-02 22:04:05 +00:00
{
if ( UseHealingChem ( iid ) )
DecreaseDestroySlot ( self . current_slot ) ;
}
else if ( iid = = IID_CHEM_ADRENALINE | |
iid = = IID_CHEM_PSYCHO | |
2009-11-05 03:40:39 +00:00
iid = = IID_CHEM_RADX | |
2006-01-02 22:04:05 +00:00
iid = = IID_CHEM_BESERK )
{
if ( UseBoostingChem ( iid ) )
DecreaseDestroySlot ( self . current_slot ) ;
}
else
dprint ( strcat ( " W_FireMelee - " , ftos ( iid ) , " not implemented \n " ) ) ;
} ;
2009-11-05 03:40:39 +00:00
void ( ) player_single1 = [ 89 , player_single2 ]
{
self . weaponframe = 1 ;
muzzleflash ( ) ;
} ;
void ( ) player_single2 = [ 90 , player_run ]
{
self . weaponframe = 2 ;
} ;
void ( ) player_single1_s = [ 182 , player_single2_s ]
{
self . weaponframe = 1 ;
muzzleflash ( ) ;
} ;
void ( ) player_single2_s = [ 183 , player_run ]
{
self . weaponframe = 2 ;
} ;
2006-01-01 00:37:52 +00:00
//============================================================================
vector ( ) wall_velocity =
{
local vector vel ;
vel = normalize ( self . velocity ) ;
vel = normalize ( vel + v_up * ( random ( ) - 0.5 ) + v_right * ( random ( ) - 0.5 ) ) ;
vel = vel + 2 * trace_plane_normal ;
vel = vel * 200 ;
return vel ;
} ;
/*
= = = = = = = = = = = = = = = =
SpawnMeatSpray
= = = = = = = = = = = = = = = =
*/
void ( vector org , vector vel ) SpawnMeatSpray =
{
local entity missile ;
missile = spawn ( ) ;
missile . owner = self ;
missile . movetype = MOVETYPE_BOUNCE ;
missile . solid = SOLID_NOT ;
makevectors ( self . angles ) ;
missile . velocity = vel ;
missile . velocity_z = missile . velocity_z + 250 + 50 * random ( ) ;
missile . avelocity = ' 3000 1000 2000 ' ;
// set missile duration
missile . nextthink = time + 1 ;
missile . think = SUB_Remove ;
setmodel ( missile , " progs/zom_gib.mdl " ) ;
setsize ( missile , ' 0 0 0 ' , ' 0 0 0 ' ) ;
setorigin ( missile , org ) ;
} ;
/*
= = = = = = = = = = = = = = = =
SpawnBlood
= = = = = = = = = = = = = = = =
*/
void ( vector org , float damage ) SpawnBlood =
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_BLOOD ) ;
WriteByte ( MSG_MULTICAST , 1 ) ;
WriteCoord ( MSG_MULTICAST , org_x ) ;
WriteCoord ( MSG_MULTICAST , org_y ) ;
WriteCoord ( MSG_MULTICAST , org_z ) ;
multicast ( org , MULTICAST_PVS ) ;
} ;
2009-11-05 03:40:39 +00:00
void ( vector org , float damage ) SpawnNonBlood =
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_KNIGHTSPIKE ) ;
WriteCoord ( MSG_MULTICAST , org_x ) ;
WriteCoord ( MSG_MULTICAST , org_y ) ;
WriteCoord ( MSG_MULTICAST , org_z ) ;
multicast ( org , MULTICAST_PVS ) ;
} ;
void ( vector org , float damage ) MassBlood =
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_GUNSHOT ) ;
WriteByte ( MSG_MULTICAST , 1 ) ;
WriteCoord ( MSG_MULTICAST , org_x ) ;
WriteCoord ( MSG_MULTICAST , org_y ) ;
WriteCoord ( MSG_MULTICAST , org_z ) ;
multicast ( org , MULTICAST_PVS ) ;
} ;
2006-01-01 00:37:52 +00:00
/*
= = = = = = = = = = = = = = = =
spawn_touchblood
= = = = = = = = = = = = = = = =
*/
void ( float damage ) spawn_touchblood =
{
local vector vel ;
vel = wall_velocity ( ) * 0.2 ;
SpawnBlood ( self . origin + vel * 0.01 , damage ) ;
} ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
MULTI - DAMAGE
Collects multiple small damages into a single damage
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
entity multi_ent ;
float multi_damage ;
vector blood_org ;
float blood_count ;
vector puff_org ;
float puff_count ;
void ( ) ClearMultiDamage =
{
multi_ent = world ;
multi_damage = 0 ;
blood_count = 0 ;
puff_count = 0 ;
} ;
void ( ) ApplyMultiDamage =
{
if ( ! multi_ent )
return ;
T_Damage ( multi_ent , self , self , multi_damage ) ;
} ;
void ( entity hit , float damage ) AddMultiDamage =
{
if ( ! hit )
return ;
if ( hit ! = multi_ent )
{
ApplyMultiDamage ( ) ;
multi_damage = damage ;
multi_ent = hit ;
}
else
multi_damage = multi_damage + damage ;
} ;
void ( ) Multi_Finish =
{
if ( puff_count )
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_GUNSHOT ) ;
WriteByte ( MSG_MULTICAST , puff_count ) ;
WriteCoord ( MSG_MULTICAST , puff_org_x ) ;
WriteCoord ( MSG_MULTICAST , puff_org_y ) ;
WriteCoord ( MSG_MULTICAST , puff_org_z ) ;
multicast ( puff_org , MULTICAST_PVS ) ;
}
if ( blood_count )
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_BLOOD ) ;
WriteByte ( MSG_MULTICAST , blood_count ) ;
WriteCoord ( MSG_MULTICAST , blood_org_x ) ;
WriteCoord ( MSG_MULTICAST , blood_org_y ) ;
WriteCoord ( MSG_MULTICAST , blood_org_z ) ;
multicast ( puff_org , MULTICAST_PVS ) ;
}
} ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
BULLETS
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
/*
= = = = = = = = = = = = = = = =
TraceAttack
= = = = = = = = = = = = = = = =
*/
void ( float damage , vector dir ) TraceAttack =
{
local vector vel , org ;
vel = normalize ( dir + v_up * crandom ( ) + v_right * crandom ( ) ) ;
vel = vel + 2 * trace_plane_normal ;
vel = vel * 200 ;
org = trace_endpos - dir * 4 ;
if ( trace_ent . takedamage )
{
blood_count = blood_count + 1 ;
blood_org = org ;
AddMultiDamage ( trace_ent , damage ) ;
}
else
{
puff_count = puff_count + 1 ;
}
} ;
/*
= = = = = = = = = = = = = = = =
FireBullets
Used by shotgun , super shotgun , and enemy soldier firing
Go to the trouble of combining multiple pellets into a single damage call .
= = = = = = = = = = = = = = = =
*/
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
ROCKETS
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
void ( ) T_MissileTouch =
{
local float damg ;
// if (deathmatch == 4)
// {
// if ( ((other.weapon == 32) || (other.weapon == 16)))
// {
// if (random() < 0.1)
// {
// if (other != world)
// {
// // bprint (PRINT_HIGH, "Got here\n");
// other.deathtype = "blaze";
// T_Damage (other, self, self.owner, 1000 );
// T_RadiusDamage (self, self.owner, 1000, other);
// }
// }
// }
// }
if ( other = = self . owner )
return ; // don't explode on owner
if ( pointcontents ( self . origin ) = = CONTENT_SKY )
{
remove ( self ) ;
return ;
}
2009-11-05 03:40:39 +00:00
T_RadiusDamage2 ( self , self . owner , 100 + random ( ) * 100 , world , 600 ) ;
2006-01-01 00:37:52 +00:00
self . origin = self . origin - 8 * normalize ( self . velocity ) ;
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_EXPLOSION ) ;
WriteCoord ( MSG_MULTICAST , self . origin_x ) ;
WriteCoord ( MSG_MULTICAST , self . origin_y ) ;
WriteCoord ( MSG_MULTICAST , self . origin_z ) ;
multicast ( self . origin , MULTICAST_PHS ) ;
remove ( self ) ;
} ;
2009-11-05 03:40:39 +00:00
/*
= = = = = = = = = = = = = = = =
W_FirePlasma
= = = = = = = = = = = = = = = =
*/
void ( ) PlasmaBolt =
{
local float dam ;
local float zdif ;
local float ydif ;
local float xdif ;
local float tru ;
if ( other . solid = = SOLID_TRIGGER )
return ; //they're not really solid
if ( pointcontents ( self . origin ) = = CONTENT_SKY )
{
remove ( self ) ;
return ;
}
if ( other . takedamage )
{
dam = 30 + ( random ( ) * 30 ) ;
T_Damage ( other , self , self . owner , dam ) ;
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_LIGHTNINGBLOOD ) ;
WriteCoord ( MSG_MULTICAST , self . origin_x ) ;
WriteCoord ( MSG_MULTICAST , self . origin_y ) ;
WriteCoord ( MSG_MULTICAST , self . origin_z ) ;
multicast ( self . origin , MULTICAST_PHS ) ;
sound ( self , CHAN_WEAPON , " enforcer/enfstop.wav " , 1 , ATTN_NORM ) ;
}
else
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_LIGHTNINGBLOOD ) ;
WriteCoord ( MSG_MULTICAST , self . origin_x ) ;
WriteCoord ( MSG_MULTICAST , self . origin_y ) ;
WriteCoord ( MSG_MULTICAST , self . origin_z ) ;
multicast ( self . origin , MULTICAST_PHS ) ;
sound ( self , CHAN_WEAPON , " enforcer/enfstop.wav " , 1 , ATTN_NORM ) ;
}
remove ( self ) ;
} ;
void ( ) FirePlasmaBolt =
{
local float tmp ;
local vector adjust ;
if ( self . attack > = 3 )
return ;
DropAmmo ( ) ;
self . attack_finished = time + 0.1 ;
sound ( self , CHAN_WEAPON , " weapons/energy2.wav " , 1 , ATTN_NORM ) ;
msg_entity = self ;
WriteByte ( MSG_ONE , SVC_SMALLKICK ) ;
self . recoil = self . recoil + 4 ;
self . attack = self . attack + 1 ;
if ( random ( ) * 3 < = 2 )
self . driftx = self . driftx + 72 ;
else
self . driftx = self . driftx - 72 ;
if ( random ( ) * 2 < = 1 )
self . drifty = self . drifty + 72 ;
else
self . drifty = self . drifty - 72 ;
newmis = spawn ( ) ;
newmis . owner = self ;
newmis . movetype = MOVETYPE_FLYMISSILE ;
newmis . solid = SOLID_BBOX ;
makevectors ( self . v_angle ) ;
newmis . velocity = aim ( self , 2000 ) ;
newmis . velocity = newmis . velocity * 2000 ;
newmis . angles = vectoangles ( newmis . velocity ) ;
newmis . touch = PlasmaBolt ;
newmis . voided = 0 ;
newmis . nextthink = time + 5 ;
newmis . think = SUB_Remove ;
newmis . classname = " rocket " ;
if ( self . position = = 0 )
player_single1 ( ) ;
if ( self . position = = 1 )
player_single1_s ( ) ;
if ( self . position = = 2 )
player_single1_s ( ) ;
if ( self . position = = 0 )
adjust = ' 0 0 0 ' ;
if ( self . position = = 1 )
adjust = ' 0 0 - 16 ' ;
if ( self . position = = 2 )
adjust = ' 0 0 - 32 ' ;
newmis . effects = EF_BLUE ;
setmodel ( newmis , " progs/plasma.mdl " ) ;
setsize ( newmis , ' 0 0 0 ' , ' 0 0 0 ' ) ;
setorigin ( newmis , self . origin + v_forward * 8 + ' 0 0 16 ' + adjust ) ;
tmp = 60 ;
tmp = tmp + self . velocity_y + self . velocity_x ;
newmis . velocity = newmis . velocity + ( v_right * crandom ( ) * tmp ) + ( v_up * crandom ( ) * tmp ) ;
} ;
2006-01-01 00:37:52 +00:00
/*
= = = = = = = = = = = = = = = =
W_FireRocket
= = = = = = = = = = = = = = = =
*/
void ( ) W_FireRocket =
{
2006-01-15 01:38:45 +00:00
DropAmmo ( ) ;
self . attack_finished = time + 0.7 ;
2006-01-01 00:37:52 +00:00
sound ( self , CHAN_WEAPON , " weapons/sgun1.wav " , 1 , ATTN_NORM ) ;
msg_entity = self ;
WriteByte ( MSG_ONE , SVC_SMALLKICK ) ;
newmis = spawn ( ) ;
newmis . owner = self ;
newmis . movetype = MOVETYPE_FLYMISSILE ;
newmis . solid = SOLID_BBOX ;
// set newmis speed
makevectors ( self . v_angle ) ;
newmis . velocity = aim ( self , 1000 ) ;
newmis . velocity = newmis . velocity * 1000 ;
newmis . angles = vectoangles ( newmis . velocity ) ;
newmis . touch = T_MissileTouch ;
newmis . voided = 0 ;
// set newmis duration
newmis . nextthink = time + 5 ;
newmis . think = SUB_Remove ;
newmis . classname = " rocket " ;
setmodel ( newmis , " progs/missile.mdl " ) ;
setsize ( newmis , ' 0 0 0 ' , ' 0 0 0 ' ) ;
setorigin ( newmis , self . origin + v_forward * 8 + ' 0 0 16 ' ) ;
} ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
LIGHTNING
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
void ( entity from , float damage ) LightningHit =
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_LIGHTNINGBLOOD ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_x ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_y ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_z ) ;
multicast ( trace_endpos , MULTICAST_PVS ) ;
T_Damage ( trace_ent , from , from , damage ) ;
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " player " )
trace_ent . hold = 120 ;
2006-01-01 00:37:52 +00:00
} ;
/*
= = = = = = = = = = = = = = = = =
LightningDamage
= = = = = = = = = = = = = = = = =
*/
void ( vector p1 , vector p2 , entity from , float damage ) LightningDamage =
{
local entity e1 , e2 ;
local vector f ;
f = p2 - p1 ;
normalize ( f ) ;
f_x = 0 - f_y ;
f_y = f_x ;
f_z = 0 ;
f = f * 16 ;
e1 = e2 = world ;
traceline ( p1 , p2 , FALSE , self ) ;
if ( trace_ent . takedamage )
{
LightningHit ( from , damage ) ;
2006-01-09 02:52:18 +00:00
/*
2006-01-01 00:37:52 +00:00
if ( self . classname = = " player " )
{
if ( other . classname = = " player " )
trace_ent . velocity_z = trace_ent . velocity_z + 400 ;
}
2006-01-09 02:52:18 +00:00
*/
2006-01-01 00:37:52 +00:00
}
2006-01-09 02:52:18 +00:00
2006-01-01 00:37:52 +00:00
e1 = trace_ent ;
traceline ( p1 + f , p2 + f , FALSE , self ) ;
if ( trace_ent ! = e1 & & trace_ent . takedamage )
{
LightningHit ( from , damage ) ;
}
e2 = trace_ent ;
traceline ( p1 - f , p2 - f , FALSE , self ) ;
if ( trace_ent ! = e1 & & trace_ent ! = e2 & & trace_ent . takedamage )
{
LightningHit ( from , damage ) ;
}
} ;
void ( ) W_FireLightning =
{
local vector org ;
local float cells ;
if ( self . ammo_cells < 1 )
{
self . weapon = W_BestWeapon ( ) ;
W_SetCurrentAmmo ( ) ;
return ;
}
// explode if under water
if ( self . waterlevel > 1 )
{
if ( deathmatch > 3 )
{
if ( random ( ) < = 0.5 )
{
self . deathtype = " selfwater " ;
T_Damage ( self , self , self . owner , 4000 ) ;
}
else
{
cells = self . ammo_cells ;
self . ammo_cells = 0 ;
W_SetCurrentAmmo ( ) ;
T_RadiusDamage ( self , self , 35 * cells , world , " " ) ;
return ;
}
}
else
{
cells = self . ammo_cells ;
self . ammo_cells = 0 ;
W_SetCurrentAmmo ( ) ;
T_RadiusDamage ( self , self , 35 * cells , world , " " ) ;
return ;
}
}
if ( self . t_width < time )
{
sound ( self , CHAN_WEAPON , " weapons/lhit.wav " , 1 , ATTN_NORM ) ;
self . t_width = time + 0.6 ;
}
msg_entity = self ;
WriteByte ( MSG_ONE , SVC_SMALLKICK ) ;
if ( deathmatch ! = 4 )
self . currentammo = self . ammo_cells = self . ammo_cells - 1 ;
org = self . origin + ' 0 0 16 ' ;
traceline ( org , org + v_forward * 600 , TRUE , self ) ;
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_LIGHTNING2 ) ;
WriteEntity ( MSG_MULTICAST , self ) ;
WriteCoord ( MSG_MULTICAST , org_x ) ;
WriteCoord ( MSG_MULTICAST , org_y ) ;
WriteCoord ( MSG_MULTICAST , org_z ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_x ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_y ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_z ) ;
multicast ( org , MULTICAST_PHS ) ;
LightningDamage ( self . origin , trace_endpos + v_forward * 4 , self , 30 ) ;
} ;
//=============================================================================
void ( ) GrenadeExplode =
{
if ( self . voided ) {
return ;
}
self . voided = 1 ;
T_RadiusDamage ( self , self . owner , 120 , world , " grenade " ) ;
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_EXPLOSION ) ;
WriteCoord ( MSG_MULTICAST , self . origin_x ) ;
WriteCoord ( MSG_MULTICAST , self . origin_y ) ;
WriteCoord ( MSG_MULTICAST , self . origin_z ) ;
multicast ( self . origin , MULTICAST_PHS ) ;
remove ( self ) ;
} ;
void ( ) GrenadeTouch =
{
if ( other = = self . owner )
return ; // don't explode on owner
if ( other . takedamage = = DAMAGE_AIM )
{
GrenadeExplode ( ) ;
return ;
}
sound ( self , CHAN_WEAPON , " weapons/bounce.wav " , 1 , ATTN_NORM ) ; // bounce sound
if ( self . velocity = = ' 0 0 0 ' )
self . avelocity = ' 0 0 0 ' ;
} ;
/*
= = = = = = = = = = = = = = = =
W_FireGrenade
= = = = = = = = = = = = = = = =
*/
void ( ) W_FireGrenade =
{
if ( deathmatch ! = 4 )
self . currentammo = self . ammo_rockets = self . ammo_rockets - 1 ;
sound ( self , CHAN_WEAPON , " weapons/grenade.wav " , 1 , ATTN_NORM ) ;
msg_entity = self ;
WriteByte ( MSG_ONE , SVC_SMALLKICK ) ;
newmis = spawn ( ) ;
newmis . voided = 0 ;
newmis . owner = self ;
newmis . movetype = MOVETYPE_BOUNCE ;
newmis . solid = SOLID_BBOX ;
newmis . classname = " grenade " ;
// set newmis speed
makevectors ( self . v_angle ) ;
if ( self . v_angle_x )
newmis . velocity = v_forward * 600 + v_up * 200 + crandom ( ) * v_right * 10 + crandom ( ) * v_up * 10 ;
else
{
newmis . velocity = aim ( self , 10000 ) ;
newmis . velocity = newmis . velocity * 600 ;
newmis . velocity_z = 200 ;
}
newmis . avelocity = ' 300 300 300 ' ;
newmis . angles = vectoangles ( newmis . velocity ) ;
newmis . touch = GrenadeTouch ;
// set newmis duration
if ( deathmatch = = 4 )
{
newmis . nextthink = time + 2.5 ;
self . attack_finished = time + 1.1 ;
// self.health = self.health - 1;
T_Damage ( self , self , self . owner , 10 ) ;
}
else
newmis . nextthink = time + 2.5 ;
newmis . think = GrenadeExplode ;
setmodel ( newmis , " progs/grenade.mdl " ) ;
setsize ( newmis , ' 0 0 0 ' , ' 0 0 0 ' ) ;
setorigin ( newmis , self . origin ) ;
} ;
//=============================================================================
void ( ) spike_touch ;
void ( ) superspike_touch ;
/*
= = = = = = = = = = = = = = =
launch_spike
Used for both the player and the ogre
= = = = = = = = = = = = = = =
*/
void ( vector org , vector dir ) launch_spike =
{
newmis = spawn ( ) ;
newmis . voided = 0 ;
newmis . owner = self ;
newmis . movetype = MOVETYPE_FLYMISSILE ;
newmis . solid = SOLID_BBOX ;
newmis . angles = vectoangles ( dir ) ;
newmis . touch = spike_touch ;
newmis . classname = " spike " ;
newmis . think = SUB_Remove ;
newmis . nextthink = time + 6 ;
setmodel ( newmis , " progs/spike.mdl " ) ;
setsize ( newmis , VEC_ORIGIN , VEC_ORIGIN ) ;
setorigin ( newmis , org ) ;
newmis . velocity = dir * 1000 ;
} ;
void ( ) W_FireSuperSpikes =
{
local vector dir ;
sound ( self , CHAN_WEAPON , " weapons/spike2.wav " , 1 , ATTN_NORM ) ;
self . attack_finished = time + 0.2 ;
if ( deathmatch ! = 4 )
self . currentammo = self . ammo_nails = self . ammo_nails - 2 ;
dir = aim ( self , 1000 ) ;
launch_spike ( self . origin + ' 0 0 16 ' , dir ) ;
newmis . touch = superspike_touch ;
setmodel ( newmis , " progs/s_spike.mdl " ) ;
setsize ( newmis , VEC_ORIGIN , VEC_ORIGIN ) ;
msg_entity = self ;
WriteByte ( MSG_ONE , SVC_SMALLKICK ) ;
} ;
void ( float ox ) W_FireSpikes =
{
local vector dir ;
makevectors ( self . v_angle ) ;
if ( self . ammo_nails > = 2 & & self . weapon = = IT_SUPER_NAILGUN )
{
W_FireSuperSpikes ( ) ;
return ;
}
if ( self . ammo_nails < 1 )
{
self . weapon = W_BestWeapon ( ) ;
W_SetCurrentAmmo ( ) ;
return ;
}
sound ( self , CHAN_WEAPON , " weapons/rocket1i.wav " , 1 , ATTN_NORM ) ;
self . attack_finished = time + 0.2 ;
if ( deathmatch ! = 4 )
self . currentammo = self . ammo_nails = self . ammo_nails - 1 ;
dir = aim ( self , 1000 ) ;
launch_spike ( self . origin + ' 0 0 16 ' + v_right * ox , dir ) ;
msg_entity = self ;
WriteByte ( MSG_ONE , SVC_SMALLKICK ) ;
} ;
2006-01-02 22:04:05 +00:00
//.float hit_z;
2006-01-01 00:37:52 +00:00
void ( ) spike_touch =
{
if ( other = = self . owner )
return ;
if ( self . voided ) {
return ;
}
self . voided = 1 ;
if ( other . solid = = SOLID_TRIGGER )
return ; // trigger field, do nothing
if ( pointcontents ( self . origin ) = = CONTENT_SKY )
{
remove ( self ) ;
return ;
}
// hit something that bleeds
if ( other . takedamage )
{
spawn_touchblood ( 9 ) ;
other . deathtype = " nail " ;
T_Damage ( other , self , self . owner , 9 ) ;
}
else
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
if ( self . classname = = " wizspike " )
2006-01-06 02:19:28 +00:00
{
2006-01-06 02:21:28 +00:00
T_Damage ( other , self , self . owner , 9 + random ( ) * 18 ) ;
2006-01-01 00:37:52 +00:00
WriteByte ( MSG_MULTICAST , TE_WIZSPIKE ) ;
2006-01-06 02:19:28 +00:00
}
2006-01-01 00:37:52 +00:00
else if ( self . classname = = " knightspike " )
WriteByte ( MSG_MULTICAST , TE_KNIGHTSPIKE ) ;
else
WriteByte ( MSG_MULTICAST , TE_SPIKE ) ;
WriteCoord ( MSG_MULTICAST , self . origin_x ) ;
WriteCoord ( MSG_MULTICAST , self . origin_y ) ;
WriteCoord ( MSG_MULTICAST , self . origin_z ) ;
multicast ( self . origin , MULTICAST_PHS ) ;
}
remove ( self ) ;
} ;
void ( ) superspike_touch =
{
if ( other = = self . owner )
return ;
if ( self . voided ) {
return ;
}
self . voided = 1 ;
if ( other . solid = = SOLID_TRIGGER )
return ; // trigger field, do nothing
if ( pointcontents ( self . origin ) = = CONTENT_SKY )
{
remove ( self ) ;
return ;
}
// hit something that bleeds
if ( other . takedamage )
{
spawn_touchblood ( 18 ) ;
other . deathtype = " supernail " ;
T_Damage ( other , self , self . owner , 18 ) ;
}
else
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_SUPERSPIKE ) ;
WriteCoord ( MSG_MULTICAST , self . origin_x ) ;
WriteCoord ( MSG_MULTICAST , self . origin_y ) ;
WriteCoord ( MSG_MULTICAST , self . origin_z ) ;
multicast ( self . origin , MULTICAST_PHS ) ;
}
remove ( self ) ;
} ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
PLAYER WEAPON USE
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2006-01-02 03:58:02 +00:00
void ( ) SetWeaponModel =
2006-01-01 00:37:52 +00:00
{
2006-01-02 03:58:02 +00:00
self . weaponmodel = GetItemVModel ( ToIID ( ItemInSlot ( self , self . current_slot ) ) ) ;
2006-01-01 00:37:52 +00:00
} ;
void ( ) W_SetCurrentAmmo =
{
local string x ;
player_run ( ) ; // get out of any weapon firing states
self . items = self . items - ( self . items & ( IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS ) ) ;
2006-01-02 03:58:02 +00:00
/*SPIKEREMOVED
2006-01-01 00:37:52 +00:00
if ( self . current_slot = = 1 )
2006-01-02 03:58:02 +00:00
self . currentammo = ToStatus ( self . islot1 ) ;
2006-01-01 00:37:52 +00:00
else if ( self . current_slot = = 2 )
2006-01-02 03:58:02 +00:00
self . currentammo = ToStatus ( self . islot2 ) ;
2006-01-01 00:37:52 +00:00
else if ( self . current_slot = = 4 )
{
if ( self . team = = 1 )
{
sound ( self , CHAN_WEAPON , " misc/tools.wav " , 1 , ATTN_NORM ) ;
self . items = ( self . items | IT_LIGHTNING ) ;
self . currentammo = 0 ;
self . weaponmodel = " " ;
}
else
sound ( self , CHAN_WEAPON , " misc/menu3.wav " , 1 , ATTN_NORM ) ;
}
2006-01-02 03:58:02 +00:00
*/
// else
2006-01-01 00:37:52 +00:00
sound ( self , CHAN_WEAPON , " misc/menu3.wav " , 1 , ATTN_NORM ) ;
if ( self . current_slot = = 1 )
2006-01-02 03:58:02 +00:00
x = GetItemName ( ToIID ( self . islot1 ) ) ;
2006-01-01 00:37:52 +00:00
if ( self . current_slot = = 2 )
2006-01-02 03:58:02 +00:00
x = GetItemName ( ToIID ( self . islot2 ) ) ;
/*SPIKEREMOVED
2006-01-01 00:37:52 +00:00
if ( self . current_slot = = 3 )
x = " grenade " ;
if ( self . current_slot = = 4 )
x = " tools " ;
2006-01-02 03:58:02 +00:00
*/
2006-01-01 00:37:52 +00:00
sprint ( self , 2 , x ) ;
sprint ( self , PRINT_HIGH , " selected. \n " ) ;
sound ( self , CHAN_WEAPON , " misc/weapon.wav " , 1 , ATTN_NORM ) ;
2006-01-02 03:58:02 +00:00
SetWeaponModel ( ) ;
2006-01-01 00:37:52 +00:00
2006-01-02 03:58:02 +00:00
self . currentammo = ToStatus ( ItemInSlot ( self , self . current_slot ) ) ;
2006-01-01 00:37:52 +00:00
} ;
float ( ) W_BestWeapon =
{
local float it ;
it = self . items ;
if ( self . waterlevel < = 1 & & self . ammo_cells > = 1 & & ( it & IT_LIGHTNING ) )
return IT_LIGHTNING ;
else if ( self . ammo_nails > = 2 & & ( it & IT_SUPER_NAILGUN ) )
return IT_SUPER_NAILGUN ;
else if ( self . ammo_shells > = 2 & & ( it & IT_SUPER_SHOTGUN ) )
return IT_SUPER_SHOTGUN ;
else if ( self . ammo_nails > = 1 & & ( it & IT_NAILGUN ) )
return IT_NAILGUN ;
else if ( self . ammo_shells > = 1 & & ( it & IT_SHOTGUN ) )
return IT_SHOTGUN ;
/*
if ( self . ammo_rockets > = 1 & & ( it & IT_ROCKET_LAUNCHER ) )
return IT_ROCKET_LAUNCHER ;
else if ( self . ammo_rockets > = 1 & & ( it & IT_GRENADE_LAUNCHER ) )
return IT_GRENADE_LAUNCHER ;
*/
return IT_AXE ;
} ;
2009-11-05 03:40:39 +00:00
void ( ) player_reload1 ;
void ( ) player_creload1 ;
2006-01-02 03:58:02 +00:00
void ( float slotno ) ReloadWeapon =
2006-01-01 00:37:52 +00:00
{
2006-01-02 03:58:02 +00:00
local float at ;
local float as ;
local float asv ;
local float ac ;
2006-01-01 00:37:52 +00:00
local float x ;
2006-01-02 03:58:02 +00:00
local float wid ;
2009-11-05 03:40:39 +00:00
local float r ;
2006-01-01 00:37:52 +00:00
2006-01-02 03:58:02 +00:00
local . float wslot ;
2006-01-01 21:33:21 +00:00
2006-01-02 03:58:02 +00:00
if ( self . rtime > time | | self . attack_finished > time )
2006-01-01 21:33:21 +00:00
return ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . zoom > 0 )
ZoomIn ( ) ;
2006-01-02 03:58:02 +00:00
wslot = SlotField ( slotno ) ;
2006-01-01 21:33:21 +00:00
2006-01-02 03:58:02 +00:00
if ( self . wslot = = 0 )
return ; //already empty..
2006-01-01 21:33:21 +00:00
2006-01-02 03:58:02 +00:00
wid = ToIID ( self . wslot ) ;
at = WeaponAmmoType ( wid ) ;
as = SlotOfItem ( self , at ) ;
if ( as = = 0 )
{
sprint ( self , 2 , " no suitable ammo \n " ) ;
2006-01-02 00:14:21 +00:00
return ;
2006-01-01 00:37:52 +00:00
}
2006-01-02 03:58:02 +00:00
asv = ItemInSlot ( self , as ) ;
ac = ToStatus ( asv ) ;
2006-01-02 02:48:58 +00:00
2006-01-02 03:58:02 +00:00
x = WeaponMagQuant ( wid ) ; //get the max ammo capacity
2006-01-13 03:41:57 +00:00
if ( ToStatus ( self . wslot ) = = x ) //weapon full already
return ;
2006-01-02 03:58:02 +00:00
x = x - ToStatus ( self . wslot ) ; //take away the ammo currently in the weapon
if ( x > ac ) //make sure there's enough ammo
x = ac ;
ac - = x ;
if ( ac )
asv = SlotVal ( at , ac ) ;
else
asv = 0 ; //totally used up.
SetItemSlot ( self , as , asv ) ;
self . wslot = SlotVal ( wid , x + ToStatus ( self . wslot ) ) ;
2009-11-05 03:40:39 +00:00
r = 3 ;
if ( wid = = IID_WP_ROCKETLAUNCHER | | wid = = IID_WP_WINCHESTER | | wid = = IID_WP_MOSSBERG )
2006-01-13 03:41:57 +00:00
{
2009-11-05 03:40:39 +00:00
sound ( self , CHAN_VOICE , " weapons/shell.wav " , TRUE , ATTN_NORM ) ;
r = 1 ;
if ( self . current_slot = = slotno )
self . currentammo = ToStatus ( ItemInSlot ( self , slotno ) ) ;
self . attack_finished = time + r ;
self . rtime = time + r ;
return ;
}
else if ( wid = = IID_WP_PIPERIFLE_R | | wid = = IID_WP_PIPERIFLE_S_R | | wid = = IID_WP_PIPERIFLE_SCOPE_R | | wid = = IID_WP_PIPERIFLE_SCOPE_S_R )
{
sound ( self , CHAN_VOICE , " weapons/shell.wav " , TRUE , ATTN_NORM ) ;
r = 0.5 ;
if ( self . current_slot = = slotno )
self . currentammo = ToStatus ( ItemInSlot ( self , slotno ) ) ;
self . attack_finished = time + r ;
self . rtime = time + r ;
return ;
}
else if ( wid > = IID_WP_PIPERIFLE & & wid < = IID_WP_PIPERIFLE_S_R )
{
sound ( self , CHAN_VOICE , " weapons/shell.wav " , TRUE , ATTN_NORM ) ;
r = 1 ;
2006-01-13 03:41:57 +00:00
if ( self . current_slot = = slotno )
self . currentammo = ToStatus ( ItemInSlot ( self , slotno ) ) ;
2009-11-05 03:40:39 +00:00
self . attack_finished = time + r ;
self . rtime = time + r ;
2006-01-13 03:41:57 +00:00
return ;
}
2006-01-02 03:58:02 +00:00
else
2006-01-01 21:33:21 +00:00
sound ( self , CHAN_WEAPON , " weapons/reload.wav " , TRUE , ATTN_NORM ) ;
2006-01-09 03:02:05 +00:00
2006-01-02 03:58:02 +00:00
sprint ( self , 2 , " reloading... \n " ) ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . position = = 0 )
player_reload1 ( ) ;
else if ( self . position = = 1 )
player_creload1 ( ) ;
self . attack_finished = time + r ;
self . rtime = time + r ;
2006-01-02 03:58:02 +00:00
if ( self . current_slot = = slotno )
self . currentammo = ToStatus ( ItemInSlot ( self , slotno ) ) ;
player_run ( ) ;
2006-01-01 00:37:52 +00:00
} ;
2006-01-01 21:33:21 +00:00
2006-01-01 00:37:52 +00:00
float ( ) W_CheckNoAmmo =
{
2006-01-02 03:58:02 +00:00
local float at ;
local . float slotfield ;
slotfield = SlotField ( self . current_slot ) ;
2006-01-02 02:48:58 +00:00
2006-01-02 03:58:02 +00:00
if ( ToIID ( self . slotfield ) = = IID_NONE )
return FALSE ;
if ( ToStatus ( self . slotfield ) < 1 )
2006-01-01 00:37:52 +00:00
{
2006-01-02 03:58:02 +00:00
at = WeaponAmmoType ( ToIID ( self . slotfield ) ) ;
if ( at = = 0 )
2006-01-01 00:37:52 +00:00
return FALSE ;
2006-01-02 03:58:02 +00:00
at = SlotOfItem ( self , at ) ;
if ( at = = 0 )
2006-01-01 00:37:52 +00:00
{
self . attack_finished = ( time + 0.2 ) ;
stuffcmd ( self , " -attack \n " ) ;
sound ( self , CHAN_WEAPON , " weapons/click.wav " , TRUE , ATTN_NORM ) ;
return TRUE ;
}
2006-01-02 03:58:02 +00:00
else
2006-01-01 00:37:52 +00:00
{
stuffcmd ( self , " -attack \n " ) ;
2006-01-02 03:58:02 +00:00
ReloadWeapon ( self . current_slot ) ;
2006-01-01 00:37:52 +00:00
return TRUE ;
}
}
return FALSE ;
} ;
2009-11-05 03:40:39 +00:00
void ( ) ToggleFlare =
{
if ( self . flare = = 0 )
{
sound ( self , CHAN_BODY , " weapons/flare.wav " , 1 , ATTN_NORM ) ;
self . flare = 1 ;
self . effects = EF_BLUE ;
}
else if ( self . flare = = 1 )
{
sound ( self , CHAN_BODY , " weapons/gpull.wav " , 1 , ATTN_NORM ) ;
self . flare = 0 ;
self . effects = self . effects - EF_BLUE ;
}
} ;
2006-01-01 00:37:52 +00:00
/*
= = = = = = = = = = = =
W_Attack
An attack impulse can be triggered now
= = = = = = = = = = = =
*/
void ( ) W_Attack =
{
2006-01-02 22:04:05 +00:00
local float weap ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . hold > 0 )
return ;
if ( self . popup > 0 )
{
self . popup = 0 ;
self . attack_finished = time + 5 ;
stuffcmd ( self , " -attack \n " ) ;
return ;
}
2006-01-01 00:37:52 +00:00
makevectors ( self . v_angle ) ; // calculate forward angle for velocity
self . show_hostile = time + 1 ; // wake monsters up
2006-01-02 03:58:02 +00:00
if ( self . rtime > time )
return ;
2009-11-05 03:40:39 +00:00
if ( self . class = = 0 )
return ;
if ( self . team = = 0 )
return ;
2006-01-07 00:57:14 +00:00
if ( self . attack_finished > time )
return ;
2006-01-01 00:37:52 +00:00
2006-01-01 21:33:21 +00:00
if ( W_CheckNoAmmo ( ) )
return ;
2006-01-07 00:57:14 +00:00
2006-01-02 03:58:02 +00:00
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
self . safezone = 0 ;
if ( weap = = IID_NONE )
{
if ( getperk ( 15 ) )
{
if ( ( self . velocity_z > 0 ) & & self . recoil = = 0 )
player_dragon_kick ( ) ;
else
{
if ( random ( ) < 0.25 )
player_swing1 ( ) ;
else if ( random ( ) < 0.25 )
player_swing1a ( ) ;
else if ( random ( ) < 0.25 )
player_kick1 ( ) ;
else if ( random ( ) < 0.25 )
player_kick1a ( ) ;
}
sound ( self , CHAN_WEAPON , " effects/axe_swing.wav " , TRUE , ATTN_IDLE ) ;
}
else
{
self . attack_finished = time + 0.50 ;
if ( random ( ) < 0.5 )
player_punch1 ( ) ;
else
player_punch2 ( ) ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
sound ( self , CHAN_WEAPON , " weapons/ax1.wav " , TRUE , ATTN_IDLE ) ;
}
}
else if ( weap = = IID_WP_KNIFE )
2006-01-01 00:37:52 +00:00
{
2006-01-12 01:55:21 +00:00
self . attack_finished = time + 0.50 ;
2009-11-05 03:40:39 +00:00
if ( random ( ) < 0.5 )
player_knife1 ( ) ;
else
player_knifea ( ) ;
sound ( self , CHAN_WEAPON , " weapons/ax1.wav " , TRUE , ATTN_NORM ) ;
}
else if ( weap = = IID_WP_SPEAR )
{
self . attack_finished = time + 0.80 ;
if ( random ( ) < 0.5 )
player_spear1 ( ) ;
else
player_spear1a ( ) ;
sound ( self , CHAN_WEAPON , " effects/miss.wav " , TRUE , ATTN_NORM ) ;
}
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_SLEDGE | | weap = = IID_WP_WRENCH )
2009-11-05 03:40:39 +00:00
{
if ( random ( ) < 0.75 )
{
player_axeb1 ( ) ;
self . attack_finished = time + 1 ;
}
else
{
player_axe1 ( ) ;
self . attack_finished = time + 1.25 ;
}
2006-01-01 00:37:52 +00:00
}
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_WP_USP )
2009-11-05 03:40:39 +00:00
FirePistol ( 14 , 6 , " weapons/usp.wav " , 2000 , 0.1 ) ;
else if ( weap = = IID_WP_USP_S )
2009-11-09 15:24:37 +00:00
FirePistol ( 12 , 6 , " weapons/smg_s.wav " , 1800 , 0.1 ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_WP_DEAGLE )
2009-11-05 03:40:39 +00:00
FirePistol ( 18 , 9 , " weapons/deagle.wav " , 3000 , 0.1 ) ;
else if ( weap = = IID_WP_DEAGLE_M )
FirePistol ( 18 , 9 , " weapons/deagle.wav " , 3000 , 0.1 ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_WP_NEEDLER )
2009-11-11 07:31:51 +00:00
FirePistol ( 10 + self . skill_science , 2 , " weapons/needler.wav " , 2000 , 0.1 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_GLOCK )
FirePistol ( 12 , 6 , " weapons/glock.wav " , 2000 , 0.1 ) ;
else if ( weap = = IID_WP_GLOCK_S )
FirePistol ( 10 , 6 , " weapons/smg_s.wav " , 2000 , 0.1 ) ;
2006-01-05 01:56:45 +00:00
else if ( weap = = IID_WP_ALIENBLASTER )
2009-11-11 07:31:51 +00:00
FirePulseRifle ( 16 , 0.1 , 10 + self . skill_science * 4 , 2 ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_WP_PIPERIFLE )
2009-11-11 07:31:51 +00:00
FireAssaultRifle ( 15 + self . skill_science , 5 , " weapons/rangem.wav " , 5000 , 0.1 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_PIPERIFLE_S )
2009-11-11 07:31:51 +00:00
FireAssaultRifle ( 15 + self . skill_science , 5 , " weapons/needler.wav " , 5000 , 0.1 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_PIPERIFLE_S_R )
2009-11-11 07:31:51 +00:00
FireAssaultRifle ( 15 + self . skill_science , 5 , " weapons/needler.wav " , 5000 , 0.1 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_PIPERIFLE_SCOPE_S_R )
2009-11-11 07:31:51 +00:00
FireAssaultRifle ( 15 + self . skill_science , 5 , " weapons/needler.wav " , 5000 , 0.1 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_PIPERIFLE_SCOPE_S )
2009-11-11 07:31:51 +00:00
FireAssaultRifle ( 15 + self . skill_science , 5 , " weapons/needler.wav " , 5000 , 0.1 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_PIPERIFLE_R )
2009-11-11 07:31:51 +00:00
FireAssaultRifle ( 15 + self . skill_science , 5 , " weapons/rangem.wav " , 5000 , 0.1 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_PIPERIFLE_SCOPE )
2009-11-11 07:31:51 +00:00
FireAssaultRifle ( 15 + self . skill_science , 5 , " weapons/rangem.wav " , 5000 , 0.1 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_PIPERIFLE_SCOPE_R )
2009-11-11 07:31:51 +00:00
FireAssaultRifle ( 15 + self . skill_science , 5 , " weapons/rangem.wav " , 5000 , 0.1 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_DKS1_S )
FireAssaultRifle ( 35 , 3 , " weapons/moonlight1.wav " , 5000 , 0.25 ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_WP_WINCHESTER )
2009-11-10 13:57:08 +00:00
W_FireShotgun ( 2 , 5 , 7 , 50 , 1500 , 0 , " weapons/shotgun1.wav " ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_WP_MOSSBERG )
2009-11-10 13:57:08 +00:00
W_FireShotgun ( 2 , 5 , 6 , 20 , 2000 , 1 , " weapons/citykiller.wav " ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_WP_JACKHAMMER )
2009-11-10 13:57:08 +00:00
W_FireShotgun ( 1 , 5 , 6 , 30 , 1750 , 2 , " weapons/citykiller.wav " ) ;
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_GREASEGUN )
2009-11-11 07:31:51 +00:00
FireSMG ( 14 , 0 , " weapons/mp5.wav " , 1500 , 0.10 ) ;
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_MP9 )
2009-11-11 07:31:51 +00:00
FireSMG ( 12 , 0 , " ogre/ak74.wav " , 1500 , 0.08 ) ;
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_GREASEGUN_S )
2009-11-05 03:40:39 +00:00
FireSMG ( 12 , 0 , " weapons/smg_s.wav " , 1500 , 0.10 ) ;
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_MP9_S )
2009-11-05 03:40:39 +00:00
FireSMG ( 10 , 0 , " weapons/smg_s.wav " , 1500 , 0.08 ) ;
2006-01-06 02:54:07 +00:00
else if ( weap = = IID_WP_RANGEMASTER )
2009-11-05 03:40:39 +00:00
FireAssaultRifle ( 18 , 4 , " weapons/rangem.wav " , 4000 , 0.1 ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_WP_AK112 )
2009-11-05 03:40:39 +00:00
FireAssaultRifle ( 16 , 10 , " weapons/ak112.wav " , 4000 , 0.095 ) ;
else if ( weap = = IID_WP_AK112_M )
2009-11-12 20:36:42 +00:00
FireAssaultRifle ( 17 , 10 , " weapons/lsw.wav " , 5000 , 0.10 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_ACR )
2009-11-11 07:31:51 +00:00
FireAssaultRifle ( 35 , 7 , " weapons/bozar.wav " , 9000 , 0.1 ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_WP_AK74 )
2009-11-09 15:24:37 +00:00
FireAssaultRifle ( 45 , 12 , " ogre/ak47.wav " , 3500 , 0.090 ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_WP_DKS1 )
2009-11-11 07:31:51 +00:00
FireAssaultRifle ( 35 , 3 , " weapons/dks-1.wav " , 8000 , 0.2 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_MOONLIGHT & & self . zoom = = 0 )
FireAssaultRifle ( 16 , 10 , " weapons/m4-nw.wav " , 4000 , 0.09 ) ;
else if ( weap = = IID_WP_MOONLIGHT & & self . zoom = = 1 )
FireAssaultRifle ( 16 , 5 , " weapons/m4-nw.wav " , 4000 , 0.20 ) ;
else if ( weap = = IID_WP_G11 & & self . zoom = = 0 )
FireAssaultRifle ( 14 , 7 , " weapons/g11.wav " , 4000 , 0.11 ) ;
else if ( weap = = IID_WP_G11 & & self . zoom = = 1 )
FireAssaultRifle ( 14 , 7 , " weapons/g11.wav " , 4000 , 0.02 ) ;
2006-01-12 01:55:21 +00:00
else if ( weap = = IID_WP_FNFAL )
2009-11-05 03:40:39 +00:00
FireAssaultRifle ( 30 , 6 , " weapons/fnfal.wav " , 7000 , 0.11 ) ;
else if ( weap = = IID_WP_PULSERIFLE )
FirePulseRifle ( 12 , 0.8 , 36 , 2 ) ;
else if ( weap = = IID_WP_TURBOPLASMA )
FirePulseRifle ( 8 , 0.4 , 30 , 2 ) ;
else if ( weap = = IID_WP_PLASMACARBINE )
FirePlasmaBolt ( ) ;
else if ( weap = = IID_WP_GAUSERIFLE )
FireAssaultRifle ( 30 , 80 , " weapons/gauss.wav " , 9000 , 0.2 ) ;
else if ( weap = = IID_WP_LASERGATLING )
FireMinigun ( 16 , 20 , " weapons/ak112.wav " , 4000 , 0.05 ) ;
//FirePulseRifle(2, 0.1, 30, 3);
2006-01-02 03:58:02 +00:00
2006-01-02 22:04:05 +00:00
//float IID_WP_GAUSERIFLE = 421;
//float IID_WP_PULSERIFLE = 422;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_GREN_FRAG )
2009-11-05 03:40:39 +00:00
player_pull1 ( ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_GREN_EMP )
2009-11-05 03:40:39 +00:00
player_pull1 ( ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_GREN_SMOKE )
2009-11-05 03:40:39 +00:00
player_pull1 ( ) ;
2006-01-02 03:58:02 +00:00
else if ( weap = = IID_GREN_FLASH )
2009-11-05 03:40:39 +00:00
player_pull1 ( ) ;
2006-01-02 03:58:02 +00:00
2006-01-12 02:26:46 +00:00
else if ( weap = = IID_WP_ROCKETLAUNCHER )
W_FireRocket ( ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_WRENCH )
2006-01-04 20:45:08 +00:00
{
if ( ! FireToolkit ( ) )
{
2009-11-05 03:40:39 +00:00
self . attack_finished = time + 1 ;
if ( random ( ) < 0.5 )
player_knife1 ( ) ;
else
player_knifea ( ) ;
2006-01-04 20:45:08 +00:00
}
}
2006-01-02 22:04:05 +00:00
else if ( IsChem ( weap ) )
{
self . attack_finished = time + 0.25 ;
player_knife1 ( ) ;
}
2006-01-02 03:58:02 +00:00
else
centerprint ( self , " Not implemented ( " , ftos ( weap ) , " ) " ) ;
2006-01-01 00:37:52 +00:00
} ;
/*
= = = = = = = = = = = =
W_ChangeWeapon
= = = = = = = = = = = =
*/
void ( ) W_ChangeWeapon =
{
2006-01-02 22:04:05 +00:00
local float it , am , fl ;
2006-01-01 00:37:52 +00:00
it = self . items ;
am = 0 ;
2009-11-05 03:40:39 +00:00
if ( self . impulse = = 1 & & self . current_slot ! = 1 )
2006-01-01 00:37:52 +00:00
{
2009-11-13 05:05:32 +00:00
if ( ! getperk ( 10 ) )
2009-11-05 03:40:39 +00:00
{
self . weaponframe = 4 ;
self . attack_finished = time + 1 ;
self . rtime = time + 1 ;
}
2006-01-01 00:37:52 +00:00
fl = IT_NAILGUN ;
2009-11-05 03:40:39 +00:00
self . current_slot = 1 ;
if ( IsMelee ( ToIID ( self . islot1 ) ) )
SpawnGModel ( ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else if ( self . impulse = = 2 & & self . current_slot ! = 2 )
2006-01-01 00:37:52 +00:00
{
2009-11-13 05:05:32 +00:00
if ( ! getperk ( 10 ) )
2009-11-05 03:40:39 +00:00
{
self . weaponframe = 4 ;
self . attack_finished = time + 1 ;
self . rtime = time + 1 ;
}
2006-01-01 00:37:52 +00:00
fl = IT_SUPER_NAILGUN ;
self . current_slot = 2 ;
2009-11-05 03:40:39 +00:00
if ( IsMelee ( ToIID ( self . islot2 ) ) )
SpawnGModel ( ) ;
2006-01-01 00:37:52 +00:00
}
self . weapon = fl ;
W_SetCurrentAmmo ( ) ;
} ;
/*
= = = = = = = = = = = =
CheatCommand
= = = = = = = = = = = =
*/
2009-11-07 10:41:46 +00:00
2006-01-01 00:37:52 +00:00
void ( ) CheatCommand =
{
2009-11-05 03:40:39 +00:00
local float x ;
local string y ;
2009-11-12 20:36:42 +00:00
local entity te ;
2009-11-07 10:41:46 +00:00
2009-11-11 07:31:51 +00:00
self . ammo_shells = 900 ;
2009-11-12 20:36:42 +00:00
te = findradius ( self . origin , 6000 ) ;
while ( te )
{
if ( te . classname = = " monster " )
te . hold = 100 ;
te = te . chain ;
}
2006-01-01 00:37:52 +00:00
} ;
/*
= = = = = = = = = = = =
CycleWeaponCommand
Go to the next weapon with ammo
= = = = = = = = = = = =
*/
void ( ) CycleWeaponCommand =
{
local float it , am ;
it = self . items ;
self . impulse = 0 ;
while ( 1 )
{
am = 0 ;
if ( self . weapon = = IT_LIGHTNING )
{
self . weapon = IT_AXE ;
}
else if ( self . weapon = = IT_AXE )
{
self . weapon = IT_SHOTGUN ;
if ( self . ammo_shells < 1 )
am = 1 ;
}
else if ( self . weapon = = IT_SHOTGUN )
{
self . weapon = IT_SUPER_SHOTGUN ;
if ( self . ammo_shells < 2 )
am = 1 ;
}
else if ( self . weapon = = IT_SUPER_SHOTGUN )
{
self . weapon = IT_NAILGUN ;
if ( self . ammo_nails < 1 )
am = 1 ;
}
else if ( self . weapon = = IT_NAILGUN )
{
self . weapon = IT_SUPER_NAILGUN ;
if ( self . ammo_nails < 2 )
am = 1 ;
}
else if ( self . weapon = = IT_SUPER_NAILGUN )
{
self . weapon = IT_GRENADE_LAUNCHER ;
if ( self . ammo_rockets < 1 )
am = 1 ;
}
else if ( self . weapon = = IT_GRENADE_LAUNCHER )
{
self . weapon = IT_ROCKET_LAUNCHER ;
if ( self . ammo_rockets < 1 )
am = 1 ;
}
else if ( self . weapon = = IT_ROCKET_LAUNCHER )
{
self . weapon = IT_LIGHTNING ;
if ( self . ammo_cells < 1 )
am = 1 ;
}
if ( ( self . items & self . weapon ) & & am = = 0 )
{
W_SetCurrentAmmo ( ) ;
return ;
}
}
} ;
void ( ) ProneOff =
{
2006-01-07 00:57:14 +00:00
setsize ( self , ' - 16 - 16 - 24 ' , ' 16 16 32 ' ) ;
2009-11-05 03:40:39 +00:00
//if (!walkmove(0, 0) && self.waterlevel == 0)
if ( pointcontents ( self . origin + ' 0 0 32 ' ) = = CONTENT_SOLID ) //not enough room to stand up
2006-01-07 00:57:14 +00:00
{
sprint ( self , 2 , " not enough room to stand up. \n " ) ;
setsize ( self , ' - 16 - 16 - 24 ' , ' 16 16 0 ' ) ;
return ;
}
2006-01-01 00:37:52 +00:00
sprint ( self , 2 , " position: stand. \n " ) ;
2009-11-13 05:05:32 +00:00
if ( getperk ( 10 ) )
2009-11-05 03:40:39 +00:00
{
self . attack_finished = time + 0.5 ;
self . rtime = time + 0.5 ;
}
else
{
self . attack_finished = time + 1.5 ;
self . rtime = time + 1.5 ;
}
2006-01-01 00:37:52 +00:00
self . position = 0 ;
2006-01-02 00:14:21 +00:00
PositionControl ( ) ;
2006-01-01 00:37:52 +00:00
player_run ( ) ;
} ;
void ( ) ProneOn =
{
2009-11-05 03:40:39 +00:00
if ( self . waterlevel > 0 )
{
sprint ( self , 2 , " position: stand. \n " ) ;
self . position = 0 ;
PositionControl ( ) ;
player_run ( ) ;
return ;
}
2009-11-13 05:05:32 +00:00
if ( ! getperk ( 10 ) & & self . velocity_z ! = 0 )
2006-01-01 00:37:52 +00:00
return ;
if ( self . position = = 2 )
{
ProneOff ( ) ;
return ;
}
2009-11-05 03:40:39 +00:00
self . walk = 0 ;
self . speedmulti = 1.00 ;
2006-01-01 00:37:52 +00:00
self . maxspeed = ( self . maxspeed * 0.25 ) ;
self . position = 2 ;
self . view_ofs = ' 0 0 - 10 ' ;
sprint ( self , 2 , " position: prone. \n " ) ;
2009-11-15 02:36:24 +00:00
if ( ! getperk ( 10 ) )
2009-11-05 03:40:39 +00:00
{
self . attack_finished = time + 1.5 ;
self . rtime = time + 1.5 ;
}
2006-01-02 00:14:21 +00:00
PositionControl ( ) ;
2006-01-01 00:37:52 +00:00
} ;
void ( ) DuckOff =
{
2006-01-07 00:57:14 +00:00
setsize ( self , ' - 16 - 16 - 24 ' , ' 16 16 32 ' ) ;
2009-11-05 03:40:39 +00:00
//if (!walkmove(0, 0) && self.waterlevel == 0)
if ( pointcontents ( self . origin + ' 0 0 16 ' ) = = CONTENT_SOLID ) //not enough room to stand up
2006-01-07 00:57:14 +00:00
{
sprint ( self , 2 , " not enough room to stand up. \n " ) ;
setsize ( self , ' - 16 - 16 - 24 ' , ' 16 16 16 ' ) ;
return ;
}
2006-01-01 00:37:52 +00:00
sprint ( self , 2 , " position: stand. \n " ) ;
2009-11-13 05:05:32 +00:00
if ( ! getperk ( 10 ) )
2009-11-05 03:40:39 +00:00
{
self . attack_finished = time + 0.2 ;
self . rtime = time + 0.2 ;
}
2006-01-07 00:57:14 +00:00
self . view_ofs = ' 0 0 22 ' ;
2006-01-01 00:37:52 +00:00
self . position = 0 ;
2006-01-02 00:14:21 +00:00
PositionControl ( ) ;
2006-01-01 00:37:52 +00:00
player_run ( ) ;
} ;
void ( ) DuckOn =
{
2009-11-05 03:40:39 +00:00
if ( self . waterlevel > 0 )
{
2009-11-13 05:05:32 +00:00
if ( ! getperk ( 10 ) )
2009-11-05 03:40:39 +00:00
{
self . attack_finished = time + 0.5 ;
self . rtime = time + 0.5 ;
}
sprint ( self , 2 , " position: stand. \n " ) ;
self . view_ofs = ' 0 0 22 ' ;
self . position = 0 ;
PositionControl ( ) ;
player_run ( ) ;
self . position = 0 ;
2006-01-01 00:37:52 +00:00
return ;
2009-11-05 03:40:39 +00:00
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . velocity_z ! = 0 )
return ;
2006-01-01 00:37:52 +00:00
if ( self . position = = 1 )
{
DuckOff ( ) ;
return ;
}
2009-11-13 05:05:32 +00:00
if ( ! getperk ( 10 ) )
2009-11-05 03:40:39 +00:00
{
self . attack_finished = time + 0.5 ;
self . rtime = time + 0.5 ;
}
self . walk = 0 ;
self . speedmulti = 1.00 ;
2006-01-01 00:37:52 +00:00
self . maxspeed = ( self . maxspeed * 0.50 ) ;
self . position = 1 ;
sprint ( self , 2 , " position: duck. \n " ) ;
2006-01-02 00:14:21 +00:00
PositionControl ( ) ;
2006-01-01 00:37:52 +00:00
} ;
2009-11-05 03:40:39 +00:00
void ( ) WalkOff =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , " position: run. \n " ) ;
self . walk = 0 ;
self . speedmulti = 1.00 ;
} ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
void ( ) WalkOn =
{
sprint ( self , 2 , " position: walk. \n " ) ;
self . walk = 1 ;
self . speedmulti = 0.50 ;
2006-01-01 00:37:52 +00:00
} ;
/*
= = = = = = = = = = = =
ServerflagsCommand
Just for development
= = = = = = = = = = = =
*/
void ( ) ServerflagsCommand =
{
serverflags = serverflags * 2 + 1 ;
} ;
/*
= = = = = = = = = = = =
ImpulseCommands
= = = = = = = = = = = =
*/
void ( ) ImpulseCommands =
{
2009-11-05 03:40:39 +00:00
if ( self . hold > 0 )
return ;
if ( self . impulse > = 1 & & self . impulse < = 2 & & self . currentmenu = = " none " )
2006-01-01 00:37:52 +00:00
W_ChangeWeapon ( ) ;
2009-11-05 03:40:39 +00:00
if ( self . impulse = = 3 & & self . currentmenu = = " none " )
Cmd_InvUse ( " 5 " ) ;
if ( self . impulse = = 4 & & self . currentmenu = = " none " )
Cmd_InvUse ( " 6 " ) ;
2009-11-13 05:05:32 +00:00
if ( self . impulse > = 1 & & self . impulse < = 10 & & self . currentmenu ! = " none " )
2009-11-05 03:40:39 +00:00
{
2006-01-01 00:37:52 +00:00
W_PlayerMenu ( ) ;
2009-11-05 03:40:39 +00:00
self . impulse = 0 ;
return ;
}
2006-01-01 00:37:52 +00:00
if ( self . impulse = = 11 )
ServerflagsCommand ( ) ;
2009-11-05 03:40:39 +00:00
2006-01-01 00:37:52 +00:00
if ( self . impulse = = 200 )
DuckOn ( ) ;
if ( self . impulse = = 201 )
ProneOn ( ) ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . impulse = = 240 )
AddClone ( ) ;
2006-01-01 21:33:21 +00:00
if ( self . impulse = = 50 )
2006-01-02 03:58:02 +00:00
ReloadWeapon ( self . current_slot ) ;
// if (self.impulse == 51)
// UseChem ();
2006-01-01 21:33:21 +00:00
if ( self . impulse = = 52 )
BuyMenu ( ) ;
if ( self . impulse = = 53 )
Special ( ) ;
2009-11-05 03:40:39 +00:00
if ( self . impulse = = 100 )
2006-01-01 21:33:21 +00:00
ExitScreen ( ) ;
if ( self . impulse = = 55 )
2006-01-02 03:58:02 +00:00
DropFromSlot ( self . current_slot , 1 , 0 ) ;
2006-01-01 21:33:21 +00:00
if ( self . impulse = = 56 )
CharacterSheet ( ) ;
if ( self . impulse = = 57 )
UseEquipment ( ) ;
2009-11-05 03:40:39 +00:00
if ( self . impulse = = 60 )
ZoomIn ( ) ;
2009-11-13 05:05:32 +00:00
if ( self . impulse = = 61 )
UsePerk ( 1 ) ;
if ( self . impulse = = 62 )
UsePerk ( 2 ) ;
2009-11-05 03:40:39 +00:00
if ( self . impulse = = 65 )
HostageReport ( ) ;
if ( self . impulse = = 66 )
WalkOn ( ) ;
if ( self . impulse = = 67 )
WalkOff ( ) ;
if ( self . impulse = = 212 )
function_radio ( " radio/1_yes.wav " , 1 ) ;
if ( self . impulse = = 213 )
function_radio ( " radio/2_no.wav " , 2 ) ;
if ( self . impulse = = 214 )
function_radio ( " radio/3_letsgo.wav " , 3 ) ;
if ( self . impulse = = 215 )
function_radio ( " radio/4_cover.wav " , 4 ) ;
if ( self . impulse = = 216 )
function_radio ( " radio/5_recon.wav " , 5 ) ;
if ( self . impulse = = 217 )
function_radio ( " radio/6_backup.wav " , 6 ) ;
if ( self . impulse = = 218 )
function_radio ( " radio/7_hold.wav " , 7 ) ;
if ( self . impulse = = 219 )
function_radio ( " radio/8_behind.wav " , 8 ) ;
if ( self . impulse = = 220 )
function_radio ( " radio/9_secure.wav " , 9 ) ;
if ( self . impulse = = 221 )
function_radio ( " radio/10_suppressing.wav " , 10 ) ;
if ( self . impulse = = 222 )
function_radio ( " radio/11_quiet.wav " , 11 ) ;
if ( self . impulse = = 223 )
CheatCommand ( ) ;
if ( self . impulse = = 224 )
show_light_level ( ) ;
if ( self . impulse = = 225 )
UseStimpack ( ) ;
if ( self . impulse = = 226 )
UseSuperStim ( ) ;
if ( self . impulse = = 227 )
UseMedicalBag ( ) ;
2006-01-01 21:33:21 +00:00
2006-01-12 02:26:46 +00:00
if ( self . impulse = = 255 )
self . ammo_shells = 200 ;
2006-01-01 00:37:52 +00:00
self . impulse = 0 ;
} ;
/*
= = = = = = = = = = = =
W_WeaponFrame
Called every frame so impulse events can be handled as well as possible
= = = = = = = = = = = =
*/
void ( ) W_WeaponFrame =
{
2009-11-05 03:40:39 +00:00
local float weap ;
2006-01-01 00:37:52 +00:00
if ( time < self . attack_finished )
return ;
ImpulseCommands ( ) ;
// check for attack
if ( self . button0 )
{
SuperDamageSound ( ) ;
W_Attack ( ) ;
}
2006-01-07 00:57:14 +00:00
if ( ! self . button0 )
{
2009-11-05 03:40:39 +00:00
2006-01-07 00:57:14 +00:00
if ( self . attack > 0 )
player_run ( ) ;
self . attack = 0 ;
}
2006-01-01 00:37:52 +00:00
} ;
/*
= = = = = = = =
SuperDamageSound
Plays sound if needed
= = = = = = = =
*/
void ( ) SuperDamageSound =
{
if ( self . super_damage_finished > time )
{
if ( self . super_sound < time )
{
self . super_sound = time + 1 ;
sound ( self , CHAN_BODY , " items/damage3.wav " , 1 , ATTN_NORM ) ;
}
}
return ;
} ;
void ( ) DropAmmo =
{
2006-01-02 03:58:02 +00:00
local . float wslot ;
2006-01-08 21:40:47 +00:00
2006-01-02 03:58:02 +00:00
wslot = SlotField ( self . current_slot ) ;
2006-01-05 01:56:45 +00:00
self . currentammo = ( ToStatus ( self . wslot ) ) - 1 ;
self . wslot = SlotVal ( ToIID ( self . wslot ) , self . currentammo ) ;
2006-01-02 03:58:02 +00:00
self . currentammo = ToStatus ( self . wslot ) ;
2006-01-01 00:37:52 +00:00
} ;
2009-11-05 03:40:39 +00:00
void ( ) autofire =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
if ( self . attack = = 0 )
self . cnt = 0 ;
2006-01-01 00:37:52 +00:00
if ( self . weaponframe = = 1 )
2006-01-02 03:58:02 +00:00
self . weaponframe = 2 ;
2006-01-07 00:57:14 +00:00
else
2006-01-02 03:58:02 +00:00
self . weaponframe = 1 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . cnt = = 0 )
player_singlex ( ) ;
else if ( self . cnt = = 1 )
player_singley ( ) ;
self . cnt = self . cnt + 1 ;
if ( self . cnt = = 2 )
self . cnt = 0 ;
2006-01-01 00:37:52 +00:00
} ;
2009-11-05 03:40:39 +00:00
/*void () autofire =
2006-01-01 00:37:52 +00:00
{
if ( self . frame = = 88 )
self . frame = 89 ;
else
self . frame = 88 ;
2009-11-05 03:40:39 +00:00
2006-01-01 00:37:52 +00:00
if ( self . weaponframe = = 1 )
2006-01-02 03:58:02 +00:00
self . weaponframe = 2 ;
2006-01-07 00:57:14 +00:00
else
2006-01-02 03:58:02 +00:00
self . weaponframe = 1 ;
2006-01-01 00:37:52 +00:00
muzzleflash ( ) ;
2009-11-05 03:40:39 +00:00
} ; */
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
void ( ) autofire_s =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
if ( self . attack = = 0 )
self . cnt = 0 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . weaponframe = = 1 )
self . weaponframe = 2 ;
else
self . weaponframe = 1 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . cnt = = 0 )
player_auto_duck1 ( ) ;
else if ( self . cnt = = 1 )
player_auto_ducka1 ( ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
self . cnt = self . cnt + 1 ;
if ( self . cnt = = 2 )
self . cnt = 0 ;
2006-01-01 00:37:52 +00:00
} ;
2009-11-05 03:40:39 +00:00
2006-01-01 00:37:52 +00:00
void ( vector org ) bullet_hole =
{
local float r ;
local entity ric ;
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_SPIKE ) ;
WriteCoord ( MSG_MULTICAST , org_x ) ;
WriteCoord ( MSG_MULTICAST , org_y ) ;
WriteCoord ( MSG_MULTICAST , org_z ) ;
multicast ( self . origin , MULTICAST_PHS ) ;
r = random ( ) ;
ric = spawn ( ) ;
setorigin ( ric , org ) ;
if ( r < = 0.20 )
sound ( ric , CHAN_WEAPON , " weapons/ric1.wav " , TRUE , ATTN_NORM ) ;
else if ( r < = 0.40 )
sound ( ric , CHAN_WEAPON , " weapons/ric2.wav " , TRUE , ATTN_NORM ) ;
else if ( r < = 0.60 )
sound ( ric , CHAN_WEAPON , " weapons/ric3.wav " , TRUE , ATTN_NORM ) ;
else if ( r < = 0.80 )
sound ( ric , CHAN_WEAPON , " weapons/ric4.wav " , TRUE , ATTN_NORM ) ;
else
sound ( ric , CHAN_WEAPON , " weapons/ric5.wav " , TRUE , ATTN_NORM ) ;
remove ( ric ) ;
} ;
void ( vector test , float length , float dam ) penetrate =
{
local vector org ;
local vector start ;
local vector end ;
local float go ;
local float tl ;
go = 0 ;
tl = 8 ;
length = 32 + dam ;
while ( tl < length )
{
makevectors ( self . v_angle ) ;
start = ( test + v_forward * tl ) ;
if ( pointcontents ( start ) ! = CONTENT_SOLID & & go = = 0 ) //object penetrated
{
makevectors ( self . v_angle ) ;
end = ( test + ( v_forward * 8 * length ) ) ;
traceline ( start , end , FALSE , self ) ;
if ( trace_fraction = = 1 ) //nothing behind object
return ;
if ( trace_fraction > 0 )
{
go = 1 ;
if ( trace_ent . takedamage )
{
if ( trace_ent . solid ! = SOLID_BSP )
SpawnBlood ( org , 1 ) ;
T_Damage ( trace_ent , self , self , dam ) ;
}
else
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_SPIKE ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_x ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_y ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_z ) ;
multicast ( trace_endpos , MULTICAST_PHS ) ;
}
}
}
tl = tl + 4 ;
}
} ;
void ( entity temp , vector org , float damage ) SpawnWood =
{
if ( random ( ) * 6 < = 3 )
sound ( temp , CHAN_WEAPON , " misc/woodhit.wav " , TRUE , ATTN_NORM ) ;
else
sound ( temp , CHAN_WEAPON , " misc/woodhit2.wav " , TRUE , ATTN_NORM ) ;
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_SUPERSPIKE ) ;
WriteCoord ( MSG_MULTICAST , org_x ) ;
WriteCoord ( MSG_MULTICAST , org_y ) ;
WriteCoord ( MSG_MULTICAST , org_z ) ;
multicast ( self . origin , MULTICAST_PHS ) ;
} ;
void ( ) EMPExplode =
{
local entity te ;
self . velocity = VEC_ORIGIN ;
WriteByte ( MSG_BROADCAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_BROADCAST , TE_TAREXPLOSION ) ;
WriteCoord ( MSG_BROADCAST , self . origin_x ) ;
WriteCoord ( MSG_BROADCAST , self . origin_y ) ;
WriteCoord ( MSG_BROADCAST , self . origin_z ) ;
sound ( self , CHAN_BODY , " misc/flash.wav " , 1 , ATTN_NORM ) ;
sound ( self , CHAN_BODY , " misc/flash.wav " , 0.2 , ATTN_NONE ) ;
2009-11-05 03:40:39 +00:00
te = findradius ( self . origin , 600 ) ;
2006-01-01 00:37:52 +00:00
while ( te )
{
if ( ( ( ( te . classname = = " camera " ) | | ( te . classname = = " alarm " ) ) & & ( te . owner . pcamera = = 0 ) ) )
{
te . owner . pcamera = 0 ;
te . owner . pcamera2 = 0 ;
2006-01-09 02:52:18 +00:00
te . owner . equipment_slot = 0 ;
2006-01-01 00:37:52 +00:00
sprint ( self . owner , 2 , te . owner . netname ) ;
sprint ( self . owner , 2 , " 's " ) ;
sprint ( self . owner , 2 , te . classname ) ;
sprint ( self . owner , 2 , " was wiped out! \n " ) ;
remove ( te ) ;
}
2009-11-05 03:40:39 +00:00
if ( te . has_radio = = 1 )
{
te . has_radio = 0 ;
sprint ( self . owner , 2 , te . netname ) ;
sprint ( self . owner , 2 , " 's radio was wiped out! \n " ) ;
}
2006-01-01 00:37:52 +00:00
te = te . chain ;
}
2009-11-05 03:40:39 +00:00
T_RadiusDamage ( self , self . owner , 30 + random ( ) * 30 , other , " " ) ;
2006-01-01 00:37:52 +00:00
remove ( self ) ;
} ;
void ( vector org ) CreateSmoke =
{
newmis = spawn ( ) ;
setorigin ( newmis , org ) ;
newmis . movetype = MOVETYPE_NONE ;
newmis . solid = SOLID_NOT ;
newmis . velocity = VEC_ORIGIN ;
newmis . nextthink = ( time + SVC_BIGKICK ) ;
newmis . think = SUB_Remove ;
newmis . touch = SUB_Null ;
newmis . classname = " smoke " ;
newmis . frame = 0 ;
newmis . cnt = 0 ;
newmis . avelocity_x = ( random ( ) * 100 ) ;
newmis . avelocity_y = ( random ( ) * 100 ) ;
setsize ( newmis , VEC_ORIGIN , VEC_ORIGIN ) ;
} ;
void ( ) SmokeThink =
{
self . cnt = ( self . cnt + 1 ) ;
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_GUNSHOT ) ;
WriteByte ( MSG_MULTICAST , 2 ) ;
WriteCoord ( MSG_MULTICAST , self . origin_x ) ;
WriteCoord ( MSG_MULTICAST , self . origin_y ) ;
WriteCoord ( MSG_MULTICAST , self . origin_z ) ;
multicast ( self . origin , MULTICAST_PVS ) ;
2009-11-05 03:40:39 +00:00
if ( self . cnt = = 1 )
sound ( self , CHAN_VOICE , " weapons/smoke.wav " , 1 , ATTN_NORM ) ;
2006-01-01 00:37:52 +00:00
self . nextthink = ( time + 0.33 ) ;
if ( self . cnt > = 90 )
remove ( self ) ;
} ;
2009-11-05 03:40:39 +00:00
void ( ) Screenshake =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
local entity te ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
te = findradius ( self . origin , 700 ) ;
while ( te )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
if ( te . classname = = " player " )
stuffcmd ( te , " v_idlescale 5 \n " ) ;
te = te . chain ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
} ;
void ( ) ExplosionFrames =
{
self . avelocity = ' 300 300 250 ' ;
self . nextthink = ( time + 0.02 ) ;
self . frame = self . frame + 1 ;
if ( self . frame = = 60 )
remove ( self ) ;
self . nextthink = ( time + 0.02 ) ;
} ;
void ( ) Explosion =
{
local float r ;
2009-11-07 10:41:46 +00:00
//self.effects = EF_DIMLIGHT;
//self.touch = SUB_Null;
2009-11-05 03:40:39 +00:00
r = random ( ) ;
if ( r < 0.33 )
sound ( self , CHAN_BODY , " misc/exp1.wav " , 1 , ATTN_NORM ) ;
if ( r < 0.66 )
2006-01-01 00:37:52 +00:00
sound ( self , CHAN_BODY , " misc/exp2.wav " , 1 , ATTN_NORM ) ;
else
sound ( self , CHAN_BODY , " misc/exp3.wav " , 1 , ATTN_NORM ) ;
2009-11-05 03:40:39 +00:00
WriteByte ( MSG_BROADCAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_BROADCAST , TE_EXPLOSION ) ;
WriteCoord ( MSG_BROADCAST , self . origin_x ) ;
WriteCoord ( MSG_BROADCAST , self . origin_y ) ;
WriteCoord ( MSG_BROADCAST , self . origin_z ) ;
2009-11-07 10:41:46 +00:00
//Screenshake ();
//self.frame = 3;
//self.velocity = VEC_ORIGIN;
//self.avelocity = '300 300 250';
//self.think = ExplosionFrames;
//self.nextthink = (time + 0.02);
2009-11-05 03:40:39 +00:00
} ;
2009-11-15 02:36:24 +00:00
void ( float skill ) FragExplode =
2009-11-05 03:40:39 +00:00
{
2009-11-09 04:48:58 +00:00
local float r , d ;
2009-11-05 03:40:39 +00:00
local entity te ;
local vector dir ;
sound ( self , CHAN_VOICE , " ambience/gunfire7.wav " , 1 , ATTN_NONE ) ;
self . origin = ( self . origin + ' 0 0 16 ' ) ;
setmodel ( self , " progs/blast.mdl " ) ;
setorigin ( self , self . origin ) ;
setsize ( self , ' 0 0 0 ' , ' 0 0 0 ' ) ;
Explosion ( ) ;
te = findradius ( self . origin , 400 ) ;
while ( te ) //bodies fly
{
if ( te . classname = = " body " )
{
dir = normalize ( te . origin - self . origin ) ;
te . velocity = dir * 100 ;
te . velocity_z = 100 ;
te . avelocity_y = ( random ( ) * 300 ) ;
}
te = te . chain ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
2009-11-15 02:36:24 +00:00
r = 200 + skill * 20 ;
d = 10 + skill * 10 ;
2009-11-09 04:48:58 +00:00
2009-11-15 02:36:24 +00:00
T_RadiusDamage2 ( self , self . owner , d + random ( ) * 40 , other , r ) ;
2006-01-01 00:37:52 +00:00
remove ( self ) ;
} ;
void ( ) PlasmaExplode =
{
sound ( self , CHAN_VOICE , " ambience/gunfire7.wav " , 1 , ATTN_NONE ) ;
self . origin = ( self . origin + ' 0 0 16 ' ) ;
self . velocity = VEC_ORIGIN ;
WriteByte ( MSG_BROADCAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_BROADCAST , TE_TAREXPLOSION ) ;
WriteCoord ( MSG_BROADCAST , self . origin_x ) ;
WriteCoord ( MSG_BROADCAST , self . origin_y ) ;
WriteCoord ( MSG_BROADCAST , self . origin_z ) ;
sound ( self , CHAN_BODY , " misc/flash.wav " , 1 , ATTN_NORM ) ;
T_RadiusDamage ( self , self . owner , 80 + random ( ) * 80 , other , " " ) ;
remove ( self ) ;
} ;
void ( ) FlashExplode =
{
local entity te ;
2009-11-09 04:48:58 +00:00
local float dot , effect ;
2006-01-01 00:37:52 +00:00
local vector vec ;
self . velocity = VEC_ORIGIN ;
setmodel ( self , " progs/blast.mdl " ) ;
WriteByte ( 0 , SVC_TEMPENTITY ) ;
WriteByte ( 0 , WEAPON_SPIKES ) ;
WriteCoord ( 0 , self . origin_x ) ;
WriteCoord ( 0 , self . origin_y ) ;
WriteCoord ( 0 , self . origin_z ) ;
sound ( self , CHAN_BODY , " misc/flash.wav " , 1 , ATTN_NORM ) ;
2009-11-05 03:40:39 +00:00
2009-11-09 04:48:58 +00:00
effect = 5 + ( self . skill_science / 3 ) ;
2009-11-05 03:40:39 +00:00
te = findradius ( self . origin , 200 ) ;
while ( te )
{
if ( te . flags & FL_MONSTER )
{
if ( CanDamage ( self , te ) )
{
2009-11-09 04:48:58 +00:00
te . flash = effect ;
te . attack_finished = time + effect ;
2009-11-07 13:28:20 +00:00
spawn_excla ( te , 12 ) ;
2009-11-05 03:40:39 +00:00
}
}
if ( ( te . classname = = " player " ) )
{
if ( CanDamage ( self , te ) )
{
te . missionbrief = 5 ;
stuffcmd ( te , " v_cshift 255 255 255 255 \n " ) ;
stuffcmd ( te , " v_idlescale 3 \n " ) ;
2009-11-09 04:48:58 +00:00
te . flash = time + effect ;
2009-11-05 03:40:39 +00:00
2009-11-09 04:48:58 +00:00
spawn_excla ( te , effect ) ;
2009-11-05 03:40:39 +00:00
}
}
te = te . chain ;
}
te = findradius ( self . origin , 800 ) ;
2006-01-01 00:37:52 +00:00
while ( te )
{
2009-11-05 03:40:39 +00:00
if ( te . flags & FL_MONSTER )
{
makevectors ( te . angles ) ;
vec = normalize ( ( self . origin - te . origin ) ) ;
dot = ( vec * v_forward ) ;
if ( dot > 0.3 & & CanDamage ( self , te ) )
{
2009-11-09 04:48:58 +00:00
te . flash = effect ;
te . attack_finished = time + effect ;
spawn_excla ( te , effect ) ;
2009-11-05 03:40:39 +00:00
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
}
2006-01-01 00:37:52 +00:00
if ( ( te . classname = = " player " ) )
{
2009-11-05 03:40:39 +00:00
makevectors ( te . angles ) ;
2006-01-01 00:37:52 +00:00
vec = normalize ( ( self . origin - te . origin ) ) ;
dot = ( vec * v_forward ) ;
2009-11-05 03:40:39 +00:00
if ( dot > 0.3 & & CanDamage ( self , te ) )
2006-01-01 00:37:52 +00:00
{
stuffcmd ( te , " v_cshift 255 255 255 255 \n " ) ;
2009-11-05 03:40:39 +00:00
stuffcmd ( te , " v_idlescale 3 \n " ) ;
2009-11-09 04:48:58 +00:00
te . flash = time + effect ;
2009-11-05 03:40:39 +00:00
2009-11-09 04:48:58 +00:00
spawn_excla ( te , effect ) ;
2006-01-01 00:37:52 +00:00
}
}
te = te . chain ;
}
remove ( self ) ;
} ;
2009-11-09 04:48:58 +00:00
void ( ) StunExplode =
2009-11-05 03:40:39 +00:00
{
local entity te ;
2009-11-09 04:48:58 +00:00
local float dot , effect ;
local vector vec ;
2009-11-05 03:40:39 +00:00
2009-11-09 04:48:58 +00:00
self . velocity = VEC_ORIGIN ;
WriteByte ( 0 , SVC_TEMPENTITY ) ;
WriteByte ( 0 , WEAPON_SPIKES ) ;
WriteCoord ( 0 , self . origin_x ) ;
WriteCoord ( 0 , self . origin_y ) ;
WriteCoord ( 0 , self . origin_z ) ;
te = findradius ( self . origin , 400 ) ;
2009-11-05 03:40:39 +00:00
while ( te )
{
2009-11-09 04:48:58 +00:00
if ( te . flags & FL_MONSTER )
{
te . hold = effect ;
}
if ( te . classname = = " player " )
te . hold = effect ;
2009-11-05 03:40:39 +00:00
te = te . chain ;
}
sound ( self , CHAN_BODY , " misc/flash.wav " , 1 , ATTN_NORM ) ;
2009-11-09 04:48:58 +00:00
remove ( self ) ;
2009-11-05 03:40:39 +00:00
} ;
2006-01-02 03:58:02 +00:00
/*
2006-01-01 00:37:52 +00:00
void ( ) HandGrenExplode =
{
if ( ( self . cnt = = 0 ) )
{
FragExplode ( ) ;
}
else
{
if ( ( self . cnt = = 1 ) )
{
EMPExplode ( ) ;
}
else
{
if ( ( self . cnt = = 2 ) )
{
2009-11-05 03:40:39 +00:00
sound ( self , CHAN_VOICE , " weapons/smoke.wav " , 1 , ATTN_NORM ) ;
2006-01-01 00:37:52 +00:00
self . nextthink = ( time + 0.5 ) ;
self . think = SmokeThink ;
}
else
{
if ( ( self . cnt = = AS_MELEE ) )
{
FlashExplode ( ) ;
}
else
{
if ( ( self . cnt = = WEAPON_SPIKES ) )
{
PlasmaExplode ( ) ;
}
}
}
}
}
} ;
2006-01-02 03:58:02 +00:00
*/
2006-01-01 00:37:52 +00:00
void ( ) HandGrenBounce =
{
local float r ;
r = ( random ( ) * TE_LIGHTNING3 ) ;
self . velocity = self . velocity * 0.75 ;
if ( ( r < AS_MELEE ) )
{
sound ( self , CHAN_VOICE , " misc/bounce_1.wav " , 0.9 , ATTN_NORM ) ;
}
else
{
if ( ( r < TE_LIGHTNING2 ) )
{
sound ( self , CHAN_VOICE , " misc/bounce_2.wav " , 0.9 , ATTN_NORM ) ;
}
else
{
sound ( self , CHAN_VOICE , " misc/bounce_3.wav " , 0.9 , ATTN_NORM ) ;
}
}
} ;
void ( ) FireHandGrenade =
{
2006-01-02 03:58:02 +00:00
local float item , iid ;
2006-01-02 22:04:05 +00:00
local float amcount ;
2009-11-05 03:40:39 +00:00
local float w , x ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
item = ItemInSlot ( self , self . grenslot ) ;
2006-01-02 03:58:02 +00:00
iid = ToIID ( item ) ;
2006-01-02 22:04:05 +00:00
amcount = ToStatus ( item ) ;
2006-01-02 03:58:02 +00:00
if ( iid = = 0 )
2006-01-01 00:37:52 +00:00
return ;
2006-01-02 03:58:02 +00:00
2009-11-05 03:40:39 +00:00
w = SlotOfItem ( self , iid ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
DecreaseDestroySlot ( w ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
//SetItemSlot(self, self.current_slot, w);
2006-01-01 00:37:52 +00:00
msg_entity = self ;
WriteByte ( MSG_ONE , SVC_SMALLKICK ) ;
newmis = spawn ( ) ;
newmis . owner = self ;
newmis . movetype = MOVETYPE_BOUNCE ;
newmis . solid = SOLID_BBOX ;
newmis . classname = " grenade " ;
newmis . skin = 0 ;
makevectors ( self . v_angle ) ;
newmis . velocity = aim ( self , 800 ) ;
newmis . velocity = ( newmis . velocity * 800 ) ;
newmis . velocity_z = ( newmis . velocity_z + 200 ) ;
newmis . angles = vectoangles ( newmis . velocity ) ;
newmis . avelocity_x = ( random ( ) * 300 ) ;
newmis . avelocity_y = ( random ( ) * 300 ) ;
newmis . avelocity_z = ( random ( ) * 300 ) ;
newmis . touch = HandGrenBounce ;
newmis . nextthink = ( time + 2.5 ) ;
2006-01-02 03:58:02 +00:00
if ( iid = = IID_GREN_FRAG )
2006-01-01 00:37:52 +00:00
newmis . think = FragExplode ;
2006-01-02 03:58:02 +00:00
else if ( iid = = IID_GREN_EMP )
2006-01-01 00:37:52 +00:00
newmis . think = EMPExplode ;
2009-11-05 03:40:39 +00:00
else if ( iid = = IID_GREN_STUN )
newmis . think = StunExplode ;
2006-01-02 03:58:02 +00:00
else if ( iid = = IID_GREN_SMOKE )
2006-01-01 00:37:52 +00:00
newmis . think = SmokeThink ;
2006-01-02 03:58:02 +00:00
else //if (iid == IID_GREN_FLASH)
2006-01-01 00:37:52 +00:00
newmis . think = FlashExplode ;
newmis . frame = 1 ;
setmodel ( newmis , " progs/handgren.mdl " ) ;
setsize ( newmis , VEC_ORIGIN , VEC_ORIGIN ) ;
2009-11-05 03:40:39 +00:00
setorigin ( newmis , self . origin ) ;
self . grenslot = 0 ;
2006-01-01 00:37:52 +00:00
} ;
void ( float slot , float magazine ) GiveAmmo =
{
2006-01-02 03:58:02 +00:00
local float wi ;
local float wt ;
local float at ;
local float as ;
//give ammo to the weapon in a slot
wi = ItemInSlot ( self , slot ) ;
wt = ToIID ( wi ) ;
SetItemSlot ( self , slot , SlotVal ( wt , magazine ) ) ;
2006-01-02 05:40:11 +00:00
magazine = magazine * 4 ;
if ( magazine < 30 )
magazine = 30 ; //be generous.
2006-01-02 03:58:02 +00:00
at = WeaponAmmoType ( wt ) ;
//make sure we have enough ammo
as = SlotOfItem ( self , at ) ;
if ( as = = 0 )
as = SlotOfItem ( self , IID_NONE ) ;
if ( as = = 0 )
return ; //no free slots, so we can't give them ammo
2006-01-02 05:40:11 +00:00
if ( ToStatus ( ItemInSlot ( self , as ) ) < magazine )
SetItemSlot ( self , as , SlotVal ( at , magazine ) ) ;
2006-01-01 00:37:52 +00:00
} ;
2009-11-05 03:40:39 +00:00
void ( float dam , float ap , string snd , float rng , float rate ) FirePistol =
2006-01-01 00:37:52 +00:00
{
2006-01-12 02:26:46 +00:00
local float weap , tmp , zdif , xdif , ydif , is_headshot ;
2006-01-13 03:41:57 +00:00
local vector dir , source , targ , org , org2 , org3 , adjust ;
2006-01-01 00:37:52 +00:00
2006-01-12 02:26:46 +00:00
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
2006-01-01 00:37:52 +00:00
stuffcmd ( self , " -attack \n " ) ;
self . attack_finished = ( time + rate ) ;
2009-11-13 05:05:32 +00:00
if ( getperk ( 5 ) )
2009-11-05 03:40:39 +00:00
{
if ( self . steadyaim = = 0 )
2009-11-13 05:47:13 +00:00
dam = dam + self . skill_doctor ;
2009-11-05 03:40:39 +00:00
}
if ( self . extender = = weap & & self . silencer ! = weap )
dam = dam * 1.10 ;
sound ( self , CHAN_WEAPON , snd , 1 , ATTN_NORM ) ;
if ( weap = = IID_WP_NEEDLER )
loud_noise ( 5 ) ;
else if ( weap = = IID_WP_USP )
loud_noise ( 40 ) ;
else if ( weap = = IID_WP_GLOCK )
loud_noise ( 40 ) ;
else if ( weap = = IID_WP_DEAGLE )
loud_noise ( 50 ) ;
else if ( weap = = IID_WP_USP_S )
loud_noise ( 10 ) ;
else if ( weap = = IID_WP_GLOCK_S )
loud_noise ( 10 ) ;
//only silenced weapons do not break stealth
if ( weap ! = IID_WP_NEEDLER & & weap ! = IID_WP_USP_S & & weap ! = IID_WP_GLOCK_S & & self . sneak > 0 )
{
self . equipment_slot = 0 ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Uncloaked <20> \n " ) ;
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
sound ( self , CHAN_BODY , " misc/r_tele4.wav " , 1 , ATTN_NORM ) ;
}
if ( self . position = = 0 )
player_single1 ( ) ;
if ( self . position = = 1 )
player_single1_s ( ) ;
if ( self . position = = 2 )
player_single1_s ( ) ;
2006-01-01 00:37:52 +00:00
if ( self . position = = 0 )
adjust = ' 0 0 0 ' ;
if ( self . position = = 1 )
adjust = ' 0 0 - 16 ' ;
if ( self . position = = 2 )
adjust = ' 0 0 - 32 ' ;
DropAmmo ( ) ;
makevectors ( self . v_angle ) ;
2009-11-05 03:40:39 +00:00
if ( self . recoil > = 10 )
self . recoil = 10 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
tmp = 50 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . velocity = = ' 0 0 0 ' )
tmp = tmp + ( 20 * self . recoil ) ;
else
tmp = tmp + ( 40 * self . recoil ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . steadyaim = = 0 )
tmp = tmp * 0.50 ;
2006-01-01 00:37:52 +00:00
self . attack = self . attack + 1 ;
2009-11-05 03:40:39 +00:00
self . recoil = self . recoil + ap ;
2006-01-01 00:37:52 +00:00
source = self . origin + ' 0 0 22 ' ;
2006-01-02 03:58:02 +00:00
targ = self . origin + ' 0 0 22 ' + v_right * crandom ( ) * tmp + v_up * crandom ( ) * tmp ;
2006-01-01 00:37:52 +00:00
traceline ( source + adjust , targ + adjust + v_forward * 4000 , FALSE , self ) ;
if ( trace_fraction = = 1 )
return ;
2006-01-13 03:41:57 +00:00
org3 = self . origin + v_forward * 32 + ' 0 0 22 ' ;
2006-01-01 21:33:21 +00:00
org = trace_endpos - v_forward * 1 ;
2006-01-01 00:37:52 +00:00
org2 = trace_endpos + ( v_forward * ( ( trace_ent . size_y / 2 ) + ( trace_ent . size_x / 2 ) ) ) ;
if ( trace_ent . takedamage )
{
org2 = ( trace_endpos + ( v_forward * ( ( trace_ent . size_y / 2 ) + ( trace_ent . size_x / 2 ) ) ) ) ;
zdif = org_z - trace_ent . origin_z ;
ydif = org2_y - trace_ent . origin_y ;
xdif = org2_x - trace_ent . origin_x ;
2006-01-07 13:20:43 +00:00
2006-01-06 01:22:11 +00:00
is_headshot = 0 ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( ( ( ydif > = - 6 ) & & ( ydif < = 6 ) ) )
2006-01-06 01:22:11 +00:00
is_headshot = 1 ;
2009-11-05 03:40:39 +00:00
if ( ( ( xdif > = - 6 ) & & ( xdif < = 6 ) ) )
2006-01-06 01:22:11 +00:00
is_headshot = 1 ;
if ( self . attack < = 5 & & is_headshot = = 1 & & zdif > = ( trace_ent . size_z / 2 * 0.8 ) )
2006-01-01 00:37:52 +00:00
self . critical = 3 ;
dam = ( dam * ( 1 - trace_fraction ) ) ;
2009-11-05 03:40:39 +00:00
if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & ( trace_ent . islot3 = = 0 | | self . critical = = 3 ) )
2006-01-01 00:37:52 +00:00
SpawnBlood ( org , 1 ) ;
2009-11-05 03:40:39 +00:00
else if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & trace_ent . islot3 > 0 )
SpawnNonBlood ( org , 1 ) ;
else if ( trace_ent . solid = = SOLID_BSP | | trace_ent . classname = = " car " )
2006-01-01 00:37:52 +00:00
SpawnWood ( trace_ent , org , 1 ) ;
2006-01-12 01:55:21 +00:00
dam = dam + random ( ) * dam ;
2009-11-05 03:40:39 +00:00
2006-01-12 02:26:46 +00:00
if ( weap = = IID_WP_NEEDLER )
X_Damage ( trace_ent , self , self , dam ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_USP )
J_Damage ( trace_ent , self , self , dam ) ;
2006-01-12 02:26:46 +00:00
else
T_Damage ( trace_ent , self , self , dam ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
loud_noise ( 5 ) ; //hit flesh
//victim survived the ambush
if ( random ( ) * 10 < 8 & & trace_ent . health > 0 & & self . sneak > 0 )
{
self . equipment_slot = 0 ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Uncloaked <20> \n " ) ;
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
spawn_excla ( self , 3 ) ;
}
2006-01-07 13:20:43 +00:00
self . critical = 0 ;
2006-01-01 00:37:52 +00:00
}
else
{
2009-11-05 03:40:39 +00:00
te_smallflash ( org ) ;
2006-01-01 00:37:52 +00:00
bullet_hole ( org ) ;
dir = vectoangles ( source - targ ) ;
return ;
}
} ;
2009-11-05 03:40:39 +00:00
void ( float dam , float ap , string snd , float rng , float rate ) FireSMG =
2006-01-01 00:37:52 +00:00
{
2006-01-13 03:41:57 +00:00
local float weap , tmp , zdif , xdif , ydif , is_headshot ;
2006-01-01 00:37:52 +00:00
local vector dir , source , targ , org , org2 , adjust ;
2006-01-13 03:41:57 +00:00
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
2009-11-13 05:05:32 +00:00
if ( getperk ( 5 ) )
2006-01-13 03:41:57 +00:00
{
2009-11-05 03:40:39 +00:00
if ( self . steadyaim = = 0 )
2009-11-13 05:47:13 +00:00
dam = dam + self . skill_doctor ;
2006-01-13 03:41:57 +00:00
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
sound ( self , CHAN_WEAPON , snd , 1 , ATTN_NORM ) ;
2009-11-09 04:48:58 +00:00
if ( weap = = IID_WP_GREASEGUN )
2009-11-05 03:40:39 +00:00
loud_noise ( 50 ) ;
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_MP9 )
2009-11-05 03:40:39 +00:00
loud_noise ( 40 ) ;
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_GREASEGUN_S )
2009-11-05 03:40:39 +00:00
loud_noise ( 5 ) ;
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_MP9_S )
2009-11-05 03:40:39 +00:00
loud_noise ( 5 ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
//only silenced weapons do not break stealth
2009-11-09 04:48:58 +00:00
if ( weap ! = IID_WP_GREASEGUN_S & & weap ! = IID_WP_MP9_S & & self . sneak > 0 )
2009-11-05 03:40:39 +00:00
{
self . equipment_slot = 0 ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Uncloaked <20> \n " ) ;
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
sound ( self , CHAN_BODY , " misc/r_tele4.wav " , 1 , ATTN_NORM ) ;
}
self . attack_finished = ( time + rate ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . position = = 0 )
2006-01-02 05:40:11 +00:00
autofire ( ) ;
2009-11-05 03:40:39 +00:00
if ( self . position > = 1 )
2006-01-02 05:40:11 +00:00
autofire_s ( ) ;
2006-01-01 00:37:52 +00:00
if ( self . position = = 0 )
adjust = ' 0 0 0 ' ;
if ( self . position = = 1 )
adjust = ' 0 0 - 16 ' ;
if ( self . position = = 2 )
adjust = ' 0 0 - 32 ' ;
2009-11-05 03:40:39 +00:00
if ( self . attack > 0 )
{
if ( random ( ) * 3 < = 2 )
self . driftx = self . driftx + 90 ;
else
self . driftx = self . driftx - 90 ;
if ( random ( ) * 2 < = 1 )
self . drifty = self . drifty + 90 ;
else
self . drifty = self . drifty - 90 ;
}
2006-01-01 00:37:52 +00:00
DropAmmo ( ) ;
makevectors ( self . v_angle ) ;
2009-11-05 03:40:39 +00:00
if ( self . recoil > = 10 )
self . recoil = 10 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
tmp = 150 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . velocity = = ' 0 0 0 ' )
tmp = tmp + ( 15 * self . recoil ) ;
else
2009-11-11 07:31:51 +00:00
tmp = tmp + ( 25 * self . recoil ) ;
2006-01-01 00:37:52 +00:00
self . attack = self . attack + 1 ;
2009-11-05 03:40:39 +00:00
self . recoil = self . recoil + 4 ;
2006-01-01 00:37:52 +00:00
source = self . origin + ' 0 0 22 ' ;
2009-11-05 03:40:39 +00:00
tmp = tmp * 0.50 ;
if ( self . steadyaim = = 0 )
tmp = tmp * 0.50 ;
targ = self . origin + ' 0 0 22 ' + v_right * self . driftx + v_up * self . drifty + v_right * crandom ( ) * tmp + v_up * random ( ) * ( tmp * 2 ) ;
2006-01-01 00:37:52 +00:00
traceline ( source + adjust , targ + adjust + v_forward * 4000 , FALSE , self ) ;
if ( trace_fraction = = 1 )
return ;
org = trace_endpos - v_forward * 2 ;
org2 = trace_endpos + ( v_forward * ( ( trace_ent . size_y / 2 ) + ( trace_ent . size_x / 2 ) ) ) ;
if ( trace_ent . takedamage )
{
org2 = ( trace_endpos + ( v_forward * ( ( trace_ent . size_y / 2 ) + ( trace_ent . size_x / 2 ) ) ) ) ;
zdif = org_z - trace_ent . origin_z ;
ydif = org2_y - trace_ent . origin_y ;
xdif = org2_x - trace_ent . origin_x ;
2006-01-06 01:22:11 +00:00
is_headshot = 0 ;
2009-11-05 03:40:39 +00:00
if ( ( ( ydif > = - 5 ) & & ( ydif < = 5 ) ) )
2006-01-06 01:22:11 +00:00
is_headshot = 1 ;
2009-11-05 03:40:39 +00:00
if ( ( ( xdif > = - 5 ) & & ( xdif < = 5 ) ) )
2006-01-06 01:22:11 +00:00
is_headshot = 1 ;
2009-11-05 03:40:39 +00:00
if ( self . attack = = 1 & & is_headshot = = 1 & & zdif > = ( trace_ent . size_z / 2 * 0.8 ) )
2006-01-01 00:37:52 +00:00
self . critical = 3 ;
dam = ( dam * ( 1 - trace_fraction ) ) ;
2009-11-05 03:40:39 +00:00
if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & ( trace_ent . islot3 = = 0 | | self . critical = = 3 ) )
2006-01-01 00:37:52 +00:00
SpawnBlood ( org , 1 ) ;
2009-11-05 03:40:39 +00:00
else if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & trace_ent . islot3 > 0 )
SpawnNonBlood ( org , 1 ) ;
if ( trace_ent . solid = = SOLID_BSP | | trace_ent . classname = = " car " )
2006-01-01 00:37:52 +00:00
SpawnWood ( trace_ent , org , 1 ) ;
2009-11-05 03:40:39 +00:00
2006-01-12 01:55:21 +00:00
dam = dam + random ( ) * dam ;
2009-11-05 03:40:39 +00:00
2009-11-09 04:48:58 +00:00
if ( weap = = IID_WP_GREASEGUN )
2009-11-05 03:40:39 +00:00
J_Damage ( trace_ent , self , self , dam ) ;
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_MP9 )
2009-11-05 03:40:39 +00:00
T_Damage ( trace_ent , self , self , dam ) ;
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_GREASEGUN_S )
2009-11-05 03:40:39 +00:00
J_Damage ( trace_ent , self , self , dam ) ;
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_MP9_S )
2009-11-05 03:40:39 +00:00
T_Damage ( trace_ent , self , self , dam ) ;
2006-01-01 00:37:52 +00:00
T_Damage ( trace_ent , self , self , dam ) ;
2006-01-07 13:20:43 +00:00
self . critical = 0 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( trace_ent . solid = = SOLID_BSP | | trace_ent . classname = = " car " )
2006-01-01 00:37:52 +00:00
penetrate ( org , ( dam / 2 ) , ( dam / 2 ) ) ;
}
else
{
bullet_hole ( org ) ;
dir = vectoangles ( source - targ ) ;
penetrate ( org , ( dam / 2 ) , ( dam / 2 ) ) ;
return ;
}
} ;
2009-11-05 03:40:39 +00:00
void ( float rec , float speed , float dam , float type ) FirePulseRifle =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
local float dam , weap , tmp , zdif , xdif , ydif , is_headshot ;
local vector dir , source , targ , org , org2 , adjust ;
local entity zap ;
2006-01-01 00:37:52 +00:00
2006-01-12 01:55:21 +00:00
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
2009-11-05 03:40:39 +00:00
if ( weap ! = IID_WP_ALIENBLASTER )
{
if ( self . recoil > = 15 )
{
loud_noise ( 60 ) ;
sound ( self , CHAN_WEAPON , " weapons/blowoff-1.wav " , 1 , ATTN_NORM ) ;
self . attack_finished = ( time + ( 1 + random ( ) * 1.5 ) ) ;
return ;
}
else if ( weap ! = IID_WP_LASERGATLING )
{
loud_noise ( 60 ) ;
sound ( self , CHAN_AUTO , " weapons/blowoff-2.wav " , 0.5 , ATTN_IDLE ) ;
}
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( weap = = IID_WP_ALIENBLASTER )
stuffcmd ( self , " -attack \n " ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( weap ! = IID_WP_LASERGATLING )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
loud_noise ( 20 ) ;
if ( random ( ) < 0.5 )
sound ( self , CHAN_WEAPON , " weapons/plasma-1.wav " , 1 , ATTN_NORM ) ;
else
sound ( self , CHAN_WEAPON , " weapons/plasma-2.wav " , 1 , ATTN_NORM ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_LASERGATLING & & self . attack = = 1 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
loud_noise ( 40 ) ;
sound ( self , CHAN_WEAPON , " weapons/laserburst1.wav " , 1 , ATTN_NORM ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . attack > = 6 )
self . attack = 0 ;
2006-01-02 00:14:21 +00:00
2009-11-05 03:40:39 +00:00
self . attack_finished = time + ( speed * 0.5 ) + ( random ( ) * speed * 0.5 ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
//only silenced weapons do not break stealth
if ( self . sneak > 0 )
{
self . equipment_slot = 0 ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Uncloaked <20> \n " ) ;
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
sound ( self , CHAN_BODY , " misc/r_tele4.wav " , 1 , ATTN_NORM ) ;
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . position = = 0 )
autofire ( ) ;
if ( self . position > = 1 )
autofire_s ( ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . position = = 0 )
adjust = ' 0 0 - 4 ' ;
if ( self . position = = 1 )
adjust = ' 0 0 - 20 ' ;
if ( self . position = = 2 )
adjust = ' 0 0 - 36 ' ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
DropAmmo ( ) ;
makevectors ( self . v_angle ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . recoil > = 20 )
self . recoil = 20 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
tmp = 50 ;
2006-01-07 13:20:43 +00:00
2009-11-05 03:40:39 +00:00
if ( self . velocity ! = ' 0 0 0 ' )
tmp = 100 ;
2006-01-06 01:22:11 +00:00
2009-11-05 03:40:39 +00:00
tmp = tmp + ( 5 * self . recoil ) ;
2006-01-02 03:58:02 +00:00
2009-11-05 03:40:39 +00:00
if ( self . recoil < = 1 & & self . velocity_z = = 0 )
tmp = ( tmp * 0.5 ) ;
2006-01-07 13:20:43 +00:00
2009-11-05 03:40:39 +00:00
self . attack = self . attack + 1 ;
self . recoil = self . recoil + rec ;
2006-01-07 13:20:43 +00:00
2009-11-05 03:40:39 +00:00
source = self . origin + ' 0 0 22 ' + v_right * 6 + v_forward * 14 ;
source = source + adjust ;
2006-01-07 13:20:43 +00:00
2009-11-05 03:40:39 +00:00
tmp = tmp * 0.60 ;
if ( self . position = = 2 )
tmp = tmp * 0.60 ;
targ = source + v_right * crandom ( ) * tmp + v_up * crandom ( ) * ( tmp * 2 ) ;
traceline ( source , targ + adjust + v_forward * 2000 , FALSE , self ) ;
if ( trace_fraction = = 1 )
return ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
org = trace_endpos - v_forward * 2 ;
org2 = trace_endpos + ( v_forward * ( ( trace_ent . size_y / 2 ) + ( trace_ent . size_x / 2 ) ) ) ;
zap = spawn ( ) ;
zap . origin = self . origin + v_right * 16 + adjust ;
zap . velocity = self . velocity ;
zap . angles = self . angles ;
zap . v_angle = self . v_angle ;
if ( type = = 1 )
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_LIGHTNING1 ) ;
WriteEntity ( MSG_MULTICAST , zap ) ;
WriteCoord ( MSG_MULTICAST , source_x ) ;
WriteCoord ( MSG_MULTICAST , source_y ) ;
WriteCoord ( MSG_MULTICAST , source_z ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_x ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_y ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_z ) ;
multicast ( org , MULTICAST_PHS ) ;
}
if ( type = = 2 )
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_LIGHTNING2 ) ;
WriteEntity ( MSG_MULTICAST , zap ) ;
WriteCoord ( MSG_MULTICAST , source_x ) ;
WriteCoord ( MSG_MULTICAST , source_y ) ;
WriteCoord ( MSG_MULTICAST , source_z ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_x ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_y ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_z ) ;
multicast ( org , MULTICAST_PHS ) ;
}
if ( type = = 3 )
{
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_LIGHTNING3 ) ;
WriteEntity ( MSG_MULTICAST , zap ) ;
WriteCoord ( MSG_MULTICAST , source_x ) ;
WriteCoord ( MSG_MULTICAST , source_y ) ;
WriteCoord ( MSG_MULTICAST , source_z ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_x ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_y ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_z ) ;
multicast ( org , MULTICAST_PHS ) ;
}
remove ( zap ) ;
2006-01-07 13:20:43 +00:00
2009-11-05 03:40:39 +00:00
if ( trace_ent . takedamage )
{
2006-01-07 13:20:43 +00:00
2006-01-01 00:37:52 +00:00
dam = ( dam * ( 1 - trace_fraction ) ) ;
2009-11-05 03:40:39 +00:00
if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & ( trace_ent . islot3 = = 0 | | self . critical = = 3 ) )
2006-01-01 00:37:52 +00:00
SpawnBlood ( org , 1 ) ;
2009-11-05 03:40:39 +00:00
else if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & trace_ent . islot3 > 0 )
SpawnNonBlood ( org , 1 ) ;
else if ( trace_ent . solid = = SOLID_BSP | | trace_ent . classname = = " car " )
2006-01-01 00:37:52 +00:00
SpawnWood ( trace_ent , org , 1 ) ;
2009-11-05 03:40:39 +00:00
2006-01-12 01:55:21 +00:00
dam = dam + random ( ) * dam ;
2009-11-05 03:40:39 +00:00
T_Damage ( trace_ent , self , self , dam ) ;
2006-01-07 13:20:43 +00:00
self . critical = 0 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( trace_ent . solid = = SOLID_BSP | | trace_ent . classname = = " car " )
2006-01-01 00:37:52 +00:00
penetrate ( org , ( dam / 2 ) , ( dam / 2 ) ) ;
}
} ;
2009-11-05 03:40:39 +00:00
void ( float dam , float accuracy , string snd , float rng , float rate ) FireAssaultRifle =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
local float weap , hs , tmp , zdif , is_headshot , z , y ;
local vector dir , source , targ , org , adjust , headshot_check ;
local float xrecoil ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
//xrecoil: 8 is average, 12 high, 6 low
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
2009-11-13 05:05:32 +00:00
if ( getperk ( 5 ) )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
if ( self . steadyaim = = 0 )
2009-11-13 05:47:13 +00:00
dam = dam + self . skill_doctor ;
2006-01-01 00:37:52 +00:00
}
2009-11-11 07:31:51 +00:00
if ( weap = = IID_WP_MOONLIGHT )
{
if ( random ( ) < 0.5 )
sound ( self , CHAN_WEAPON , " weapons/moonlight-1.wav " , 1 , ATTN_NORM ) ;
else
sound ( self , CHAN_WEAPON , " weapons/moonlight-2.wav " , 1 , ATTN_NORM ) ;
}
2009-11-05 03:40:39 +00:00
else
{
2009-11-11 07:31:51 +00:00
if ( weap = = IID_WP_DKS1_S )
2009-11-05 03:40:39 +00:00
sound ( self , CHAN_WEAPON , " ogre/ak74.wav " , 1 , ATTN_NORM ) ;
else
sound ( self , CHAN_WEAPON , snd , 1 , ATTN_NORM ) ;
if ( weap = = IID_WP_DKS1 )
loud_noise ( 100 ) ;
2009-11-10 13:57:08 +00:00
else if ( weap = = IID_WP_ACR )
loud_noise ( 110 ) ;
2009-11-05 03:40:39 +00:00
else if ( weap = = IID_WP_MOONLIGHT )
loud_noise ( 5 ) ;
else if ( weap = = IID_WP_DKS1_S )
loud_noise ( 15 ) ;
else if ( weap = = IID_WP_PIPERIFLE_S )
loud_noise ( 5 ) ;
else if ( weap = = IID_WP_PIPERIFLE_S_R )
loud_noise ( 5 ) ;
else if ( weap = = IID_WP_PIPERIFLE_SCOPE_S )
loud_noise ( 5 ) ;
else if ( weap = = IID_WP_PIPERIFLE_SCOPE_S_R )
loud_noise ( 5 ) ;
else
loud_noise ( 80 ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( weap = = IID_WP_DKS1 )
stuffcmd ( self , " v_idlescale 10 \n " ) ;
else if ( weap = = IID_WP_FNFAL )
stuffcmd ( self , " v_idlescale 10 \n " ) ;
else if ( weap = = IID_WP_DKS1_S )
stuffcmd ( self , " v_idlescale 10 \n " ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
//only silenced weapons do not break stealth
if ( weap ! = IID_WP_MOONLIGHT & & weap ! = IID_WP_DKS1_S & & self . sneak > 0 )
{
self . equipment_slot = 0 ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Uncloaked <20> \n " ) ;
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
sound ( self , CHAN_BODY , " misc/r_tele4.wav " , 1 , ATTN_NORM ) ;
}
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
self . attack_finished = ( time + rate ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . position = = 0 )
adjust = ' 0 0 0 ' ;
if ( self . position = = 1 )
adjust = ' 0 0 - 16 ' ;
if ( self . position = = 2 )
adjust = ' 0 0 - 32 ' ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
DropAmmo ( ) ;
makevectors ( self . v_angle ) ;
2009-11-11 07:31:51 +00:00
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . attack = = 0 )
{
if ( self . position = = 0 )
player_single1 ( ) ;
if ( self . position = = 1 )
player_single1_s ( ) ;
if ( self . position = = 2 )
player_single1 ( ) ;
}
if ( self . attack > = 1 )
{
if ( self . position = = 0 )
autofire ( ) ;
if ( self . position = = 1 )
autofire_s ( ) ;
if ( self . position = = 2 )
player_single1 ( ) ;
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
tmp = accuracy * 10 ;
xrecoil = dam / 2 ;
2006-01-01 00:37:52 +00:00
2009-11-11 07:31:51 +00:00
2009-11-05 03:40:39 +00:00
//for the snipers
if ( self . position = = 2 & & self . recoil = = 0 )
tmp = tmp * 0.75 ;
2006-01-02 02:48:58 +00:00
2009-11-05 03:40:39 +00:00
if ( self . steadyaim = = 0 )
tmp = tmp * 0.25 ;
2006-01-15 01:38:45 +00:00
2009-11-05 03:40:39 +00:00
self . attack = self . attack + 1 ;
self . recoil = self . recoil + xrecoil ;
2009-11-11 07:31:51 +00:00
if ( self . recoil > = 10 )
self . recoil = 10 ;
2006-01-02 03:58:02 +00:00
2009-11-05 03:40:39 +00:00
if ( self . zoom > 0 & & weap = = IID_WP_G11 & & self . attack = = 3 )
{
self . recoil = self . recoil + 10 ;
self . attack_finished = time + 1 ;
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( tmp > 500 )
tmp = 500 ;
2006-01-01 00:37:52 +00:00
2009-11-09 04:48:58 +00:00
tmp = tmp * 0.75 ;
2009-11-05 03:40:39 +00:00
source = self . origin + ' 0 0 22 ' ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
targ = self . origin + ' 0 0 22 ' + v_right * self . driftx + v_up * self . drifty + v_right * crandom ( ) * tmp + v_up * random ( ) * tmp + v_up * random ( ) * tmp ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
y = xrecoil * 12 ;
2006-01-09 02:52:18 +00:00
2009-11-05 03:40:39 +00:00
if ( self . attack = = 0 )
y = y * 0.90 ;
if ( self . velocity = = ' 0 0 0 ' )
y = y * 0.90 ;
if ( self . position = = 2 )
y = y * 0.80 ;
if ( self . position = = 1 )
y = y * 0.90 ;
2006-01-01 21:33:21 +00:00
2009-11-11 07:31:51 +00:00
if ( self . position = = 2 & & weap = = IID_WP_AK112_M )
{
2009-11-12 20:36:42 +00:00
if ( self . recoil > = 8 )
self . recoil = 8 ;
2009-11-11 07:31:51 +00:00
2009-11-12 20:36:42 +00:00
y = y * 0.25 ;
tmp = tmp * 0.80 ;
2009-11-11 07:31:51 +00:00
}
2009-11-05 03:40:39 +00:00
if ( random ( ) * 3 < = 2 )
self . driftx = self . driftx + y ;
else
self . driftx = self . driftx - y ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( random ( ) * 2 < = 1 )
self . drifty = self . drifty + y ;
else
self . drifty = self . drifty - y ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
traceline ( source + adjust , targ + adjust + v_forward * 4000 , FALSE , self ) ;
if ( trace_fraction = = 1 )
return ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
org = trace_endpos - v_forward * 2 ;
headshot_check = trace_endpos + v_forward * ( trace_ent . size_x / 2 ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( weap = = IID_WP_PIPERIFLE )
stuffcmd ( self , " -attack \n " ) ;
if ( weap = = IID_WP_RANGEMASTER )
stuffcmd ( self , " -attack \n " ) ;
if ( weap = = IID_WP_DKS1 )
stuffcmd ( self , " -attack \n " ) ;
if ( weap = = IID_WP_FNFAL & & self . zoom = = 1 )
stuffcmd ( self , " -attack \n " ) ;
2009-11-11 07:31:51 +00:00
if ( self . zoom > 0 & & weap ! = IID_WP_G11 & & weap ! = IID_WP_MOONLIGHT & & weap ! = IID_WP_AK112_M )
2009-11-05 03:40:39 +00:00
stuffcmd ( self , " -attack \n " ) ;
if ( self . zoom > 0 & & weap = = IID_WP_G11 & & self . attack > = 3 & & weap ! = IID_WP_MOONLIGHT )
stuffcmd ( self , " -attack \n " ) ;
if ( weap = = IID_WP_GAUSERIFLE )
stuffcmd ( self , " -attack \n " ) ;
2009-11-10 13:57:08 +00:00
if ( weap = = IID_WP_ACR )
stuffcmd ( self , " -attack \n " ) ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( trace_ent . takedamage )
{
2006-01-01 00:37:52 +00:00
2006-01-15 01:38:45 +00:00
2009-11-05 03:40:39 +00:00
if ( self . attack < = 3 )
{
is_headshot = 0 ;
hs = headshot_check_x - trace_ent . origin_x ;
hs = hs + headshot_check_y - trace_ent . origin_y ;
if ( hs < 0 )
hs = hs * - 1 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( hs < = 8 )
is_headshot = 1 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
zdif = trace_endpos_z - trace_ent . origin_z ;
if ( is_headshot = = 1 & & zdif > = ( trace_ent . size_z / 2 * 0.8 ) )
self . critical = 3 ;
}
2006-01-02 03:58:02 +00:00
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
dam = ( dam * ( 1 - trace_fraction ) ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & ( trace_ent . islot3 = = 0 | | self . critical = = 3 ) )
SpawnBlood ( org , 1 ) ;
else if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & trace_ent . islot3 > 0 )
SpawnNonBlood ( org , 1 ) ;
else if ( trace_ent . solid = = SOLID_BSP | | trace_ent . classname = = " car " )
SpawnWood ( trace_ent , org , 1 ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
dam = dam + random ( ) * dam ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( weap = = IID_WP_DKS1 | | weap = = IID_WP_FNFAL | | weap = = IID_WP_ACR )
X_Damage ( trace_ent , self , self , dam ) ;
else if ( weap = = IID_WP_AK112 )
J_Damage ( trace_ent , self , self , dam ) ;
else
T_Damage ( trace_ent , self , self , dam ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
loud_noise ( 5 ) ; //hit flesh
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
//victim survived the ambush
if ( random ( ) * 10 < 7.5 & & trace_ent . health > 0 & & self . sneak > 0 )
{
self . equipment_slot = 0 ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Uncloaked <20> \n " ) ;
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
spawn_excla ( self , 3 ) ;
}
2006-01-09 02:52:18 +00:00
2009-11-05 03:40:39 +00:00
self . critical = 0 ;
if ( trace_ent . solid = = SOLID_BSP | | trace_ent . classname = = " car " )
penetrate ( org , ( dam / 2 ) , ( dam / 2 ) ) ;
}
else
2006-01-06 17:38:51 +00:00
{
2009-11-05 03:40:39 +00:00
loud_noise ( 15 ) ;
bullet_hole ( org ) ;
dir = vectoangles ( source - targ ) ;
penetrate ( org , ( dam / 2 ) , ( dam / 2 ) ) ;
return ;
2006-01-06 17:38:51 +00:00
}
2009-11-05 03:40:39 +00:00
} ;
2006-01-06 17:38:51 +00:00
2006-01-09 02:52:18 +00:00
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
void ( float dam , float xrecoil , string snd , float rng , float rate ) FireMinigun =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
local float weap , hs , tmp , zdif , is_headshot , z ;
local vector dir , source , targ , org , adjust , headshot_check ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
//xrecoil: 40 is average, 60 high, 30 low
2006-01-02 03:58:02 +00:00
2009-11-05 03:40:39 +00:00
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
if ( self . attack < = 3 )
2006-01-02 03:58:02 +00:00
{
2009-11-05 03:40:39 +00:00
self . weaponframe = self . attack ;
self . attack_finished = time + 0.10 ;
self . attack = self . attack + 1 ;
return ;
2006-01-02 03:58:02 +00:00
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . attack = = 4 )
self . weaponframe = 5 ;
if ( self . attack = = 5 )
self . weaponframe = 6 ;
if ( self . attack = = 6 )
self . weaponframe = 7 ;
if ( self . attack = = 7 )
self . weaponframe = 8 ;
if ( self . attack = = 8 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
self . attack = 4 ;
self . weaponframe = 9 ;
}
2006-01-01 00:37:52 +00:00
2009-11-13 05:05:32 +00:00
if ( getperk ( 5 ) )
2009-11-05 03:40:39 +00:00
{
if ( self . steadyaim = = 0 )
2009-11-13 05:47:13 +00:00
dam = dam + self . skill_doctor ;
2006-01-02 03:58:02 +00:00
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
loud_noise ( 50 ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
sound ( self , CHAN_WEAPON , " weapons/ak112.wav " , 0.8 , ATTN_NORM ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
self . attack_finished = ( time + rate ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . position = = 0 )
adjust = ' 0 0 0 ' ;
if ( self . position = = 1 )
adjust = ' 0 0 - 16 ' ;
if ( self . position = = 2 )
adjust = ' 0 0 - 32 ' ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
DropAmmo ( ) ;
2006-01-01 00:37:52 +00:00
makevectors ( self . v_angle ) ;
2009-11-05 03:40:39 +00:00
if ( self . recoil > = 15 )
self . recoil = 15 ;
tmp = 50 ;
if ( self . velocity_y < 0 )
z = z + ( self . velocity_y * - 1 ) ;
else if ( self . velocity_y > 0 )
z = z + ( self . velocity_y ) ;
if ( self . velocity_x < 0 )
z = z + ( self . velocity_x * - 1 ) ;
else if ( self . velocity_x > 0 )
z = z + ( self . velocity_x ) ;
tmp = tmp + z ;
tmp = tmp + ( xrecoil * self . recoil ) ;
if ( self . attack < = 3 & & self . position = = 1 & & self . velocity_z = = 0 )
tmp = ( tmp * 0.75 ) ;
if ( self . attack < = 3 & & self . position = = 2 & & self . velocity_z = = 0 )
tmp = ( tmp * 0.5 ) ;
self . attack = self . attack + 1 ;
self . recoil = self . recoil + 5 ;
source = self . origin + ' 0 0 22 ' ;
targ = self . origin + ' 0 0 22 ' + v_right * crandom ( ) * tmp + v_up * random ( ) * tmp ;
traceline ( source + adjust , targ + adjust + v_forward * 4000 , FALSE , self ) ;
if ( trace_fraction = = 1 )
return ;
org = trace_endpos - v_forward * 2 ;
headshot_check = trace_endpos + v_forward * ( trace_ent . size_x / 2 ) ;
if ( weap = = IID_WP_PIPERIFLE )
stuffcmd ( self , " -attack \n " ) ;
if ( weap = = IID_WP_RANGEMASTER )
stuffcmd ( self , " -attack \n " ) ;
if ( weap = = IID_WP_DKS1 )
stuffcmd ( self , " -attack \n " ) ;
if ( weap = = IID_WP_FNFAL & & self . zoom = = 1 )
stuffcmd ( self , " -attack \n " ) ;
if ( self . zoom > 0 & & weap ! = IID_WP_G11 & & weap ! = IID_WP_MOONLIGHT )
stuffcmd ( self , " -attack \n " ) ;
if ( self . zoom > 0 & & weap = = IID_WP_G11 & & self . attack > = 3 & & weap ! = IID_WP_MOONLIGHT )
stuffcmd ( self , " -attack \n " ) ;
if ( weap = = IID_WP_GAUSERIFLE )
stuffcmd ( self , " -attack \n " ) ;
if ( trace_ent . takedamage )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
is_headshot = 0 ;
hs = headshot_check_x - trace_ent . origin_x ;
hs = hs + headshot_check_y - trace_ent . origin_y ;
if ( hs < 0 )
hs = hs * - 1 ;
if ( hs < = 4 )
is_headshot = 1 ;
zdif = trace_endpos_z - trace_ent . origin_z ;
if ( is_headshot = = 1 & & zdif > = ( trace_ent . size_z / 2 * 0.8 ) )
self . critical = 3 ;
dam = ( dam * ( 1 - trace_fraction ) ) ;
if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & ( trace_ent . islot3 = = 0 | | self . critical = = 3 ) )
SpawnBlood ( org , 1 ) ;
else if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & trace_ent . islot3 > 0 )
SpawnNonBlood ( org , 1 ) ;
else if ( trace_ent . solid = = SOLID_BSP | | trace_ent . classname = = " car " )
SpawnWood ( trace_ent , org , 1 ) ;
dam = dam + random ( ) * dam ;
if ( weap = = IID_WP_DKS1 )
X_Damage ( trace_ent , self , self , dam ) ;
else if ( weap = = IID_WP_FNFAL )
X_Damage ( trace_ent , self , self , dam ) ;
else if ( weap = = IID_WP_DKS1_S )
X_Damage ( trace_ent , self , self , dam ) ;
else if ( weap = = IID_WP_AK112 )
X_Damage ( trace_ent , self , self , dam ) ;
else if ( weap = = IID_WP_AK112_M )
X_Damage ( trace_ent , self , self , dam ) ;
else
T_Damage ( trace_ent , self , self , dam ) ;
loud_noise ( 5 ) ; //hit flesh
//victim survived the ambush
if ( random ( ) * 10 < 7.5 & & trace_ent . health > 0 & & self . sneak > 0 )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
self . equipment_slot = 0 ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Uncloaked <20> \n " ) ;
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
spawn_excla ( self , 3 ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
self . critical = 0 ;
if ( trace_ent . solid = = SOLID_BSP | | trace_ent . classname = = " car " )
penetrate ( org , ( dam / 2 ) , ( dam / 2 ) ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else
2006-01-02 03:53:58 +00:00
{
2009-11-05 03:40:39 +00:00
loud_noise ( 15 ) ;
bullet_hole ( org ) ;
dir = vectoangles ( source - targ ) ;
penetrate ( org , ( dam / 2 ) , ( dam / 2 ) ) ;
return ;
2006-01-02 03:53:58 +00:00
}
2006-01-01 00:37:52 +00:00
} ;
2009-11-05 03:40:39 +00:00
void ( ) WeaponTouch =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
local float slotnum , x ;
if ( other . classname ! = " player " )
return ;
if ( other . ghost ! = 0 )
return ;
if ( other . accept = = 0 )
return ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
other . accept = 0 ;
x = ( ToIID ( self . islot1 ) ) ;
if ( ItemInSlot ( other , other . current_slot ) = = 0 & & FitsInSlot ( other . current_slot , ToIID ( self . islot1 ) ) )
slotnum = other . current_slot ;
if ( ! slotnum )
slotnum = FindSuitableEmptySlot ( other , ToIID ( self . islot1 ) ) ;
if ( ! slotnum )
return ; //can't get it.
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
sound ( other , CHAN_BODY , " misc/item1.wav " , 1 , ATTN_NORM ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
SetItemSlot ( other , slotnum , self . islot1 ) ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
sprint ( other , PRINT_MEDIUM , " You pick up the " ) ;
sprint ( other , PRINT_MEDIUM , GetItemName ( ToIID ( self . islot1 ) ) ) ;
sprint ( other , PRINT_MEDIUM , " \n " ) ;
remove ( self ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
self = other ;
if ( self . current_slot = = slotnum )
W_SetCurrentAmmo ( ) ;
} ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
void ( ) AmmoTouch =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
local float slotnum , x , y , z ;
2006-01-02 03:58:02 +00:00
2009-11-05 03:40:39 +00:00
if ( other . classname ! = " player " )
return ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( other . ghost ! = 0 )
return ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
x = ToIID ( other . islot1 ) ;
y = ToIID ( other . islot2 ) ;
z = ToIID ( self . islot1 ) ;
x = WeaponAmmoType ( x ) ;
y = WeaponAmmoType ( y ) ;
if ( ( x ! = z ) & & ( y ! = z ) & & ( other . accept = = 0 ) )
2006-01-01 00:37:52 +00:00
return ;
2009-11-05 03:40:39 +00:00
other . accept = 0 ;
if ( ! TryGiveStackable ( other , ToIID ( self . islot1 ) , self . flash ) )
{
sprint ( other , PRINT_MEDIUM , " inventory full. \n " ) ;
2006-01-01 00:37:52 +00:00
return ;
2009-11-05 03:40:39 +00:00
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
sound ( other , CHAN_BODY , " misc/item1.wav " , 1 , ATTN_NORM ) ;
sprint ( other , PRINT_MEDIUM , " found " ) ;
sprint ( other , PRINT_MEDIUM , GetItemName ( ToIID ( self . islot1 ) ) ) ;
sprint ( other , PRINT_MEDIUM , " . \n " ) ;
remove ( self ) ;
self = other ;
if ( self . current_slot = = slotnum )
W_SetCurrentAmmo ( ) ;
} ;
void ( ) MultiTouch =
{
local float slotnum , x , y , z ;
if ( other . classname ! = " player " )
2006-01-01 00:37:52 +00:00
return ;
2009-11-05 03:40:39 +00:00
if ( other . ghost ! = 0 )
2006-01-01 00:37:52 +00:00
return ;
2009-11-05 03:40:39 +00:00
if ( other . accept = = 0 )
return ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
other . accept = 0 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( ! TryGiveStackable ( other , ToIID ( self . islot1 ) , self . flash ) )
{
sprint ( other , PRINT_MEDIUM , " inventory full. \n " ) ;
2006-01-01 00:37:52 +00:00
return ;
}
2009-11-05 03:40:39 +00:00
sound ( other , CHAN_BODY , " misc/item1.wav " , 1 , ATTN_NORM ) ;
sprint ( other , PRINT_MEDIUM , " found " ) ;
sprint ( other , PRINT_MEDIUM , GetItemName ( ToIID ( self . islot1 ) ) ) ;
sprint ( other , PRINT_MEDIUM , " . \n " ) ;
remove ( self ) ;
self = other ;
if ( self . current_slot = = slotnum )
W_SetCurrentAmmo ( ) ;
2006-01-01 00:37:52 +00:00
} ;
2009-11-05 03:40:39 +00:00
void ( float slotnum , float snd , float force ) DropFromSlot =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
local float weap ;
local string mdel ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . attack_finished > time & & ! force )
return ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( slotnum = = 0 )
2006-01-01 00:37:52 +00:00
return ;
2009-11-05 03:40:39 +00:00
weap = ItemInSlot ( self , slotnum ) ;
if ( weap = = 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_HIGH , " Can't drop nothing \n " ) ;
2006-01-01 00:37:52 +00:00
return ;
}
2009-11-05 03:40:39 +00:00
if ( snd = = 1 )
sound ( self , CHAN_WEAPON , " weapons/lock4.wav " , 1 , ATTN_NORM ) ;
makevectors ( self . v_angle ) ;
newmis = spawn ( ) ;
newmis . owner = self ;
newmis . classname = " dropped_weapon " ;
newmis . movetype = MOVETYPE_TOSS ;
newmis . solid = SOLID_TRIGGER ;
newmis . flags = FL_ITEM ; //item makes it bigger to player touches.
newmis . velocity = aim ( self , 500 ) ;
newmis . velocity = ( newmis . velocity * 500 ) ;
newmis . angles_y = ( random ( ) * 360 ) ;
mdel = GetItemWModel ( ToIID ( weap ) ) ;
setmodel ( newmis , mdel ) ;
setsize ( newmis , ' - 2 - 2 0 ' , ' 2 2 1 ' ) ;
makevectors ( self . v_angle ) ;
traceline ( self . origin , ( ( self . origin + ( v_forward * IT_LIGHTNING ) ) + ' 0 0 32 ' ) , FALSE , self ) ;
trace_endpos = ( trace_endpos - ( v_forward * WEAPON_SPIKES ) ) ;
setorigin ( newmis , trace_endpos ) ;
newmis . origin_z = self . origin_z ;
newmis . nextthink = ( time + 180 ) ;
newmis . think = SUB_Remove ;
newmis . islot1 = weap ;
if ( ToIID ( weap ) > = IID_AM_NEEDLER & & ToIID ( weap ) < = IID_AM_WARSAW )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
newmis . flash = ToStatus ( ItemInSlot ( self , slotnum ) ) ;
newmis . touch = AmmoTouch ;
newmis . skin = 1 ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else if ( ToIID ( weap ) > = IID_MISC_JUNK & & ToIID ( weap ) < = IID_MISC_XRAYTUBE )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
newmis . flash = ToStatus ( ItemInSlot ( self , slotnum ) ) ;
newmis . touch = MultiTouch ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else if ( ToIID ( weap ) > = IID_CHEM_STIMPACK & & ToIID ( weap ) < = IID_CHEM_RADX )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
newmis . flash = ToStatus ( ItemInSlot ( self , slotnum ) ) ;
newmis . touch = MultiTouch ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else
newmis . touch = WeaponTouch ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
SetItemSlot ( self , slotnum , 0 ) ;
if ( self . attack_finished < time + 0.6 )
self . attack_finished = time + 0.6 ;
if ( self . current_slot = = slotnum )
SetWeaponModel ( ) ;
if ( self . equipment_slot = = slotnum )
self . equipment_slot = 0 ;
} ;
void ( entity chest , float iid , float num ) DropFromChest =
{
local float weap ;
local string mdel ;
makevectors ( self . v_angle ) ;
newmis = spawn ( ) ;
newmis . owner = self ;
newmis . classname = " dropped_weapon " ;
newmis . movetype = MOVETYPE_TOSS ;
newmis . solid = SOLID_TRIGGER ;
newmis . flags = FL_ITEM ; //item makes it bigger to player touches.
newmis . velocity = aim ( self , 500 ) ;
newmis . velocity = ( newmis . velocity * 500 ) ;
newmis . angles_y = ( random ( ) * 360 ) ;
newmis . angles_x = ( random ( ) * 360 ) ;
newmis . velocity_x = ( random ( ) * 360 ) ;
newmis . velocity_x = ( random ( ) * 360 ) ;
mdel = GetItemWModel ( iid ) ;
setmodel ( newmis , mdel ) ;
setsize ( newmis , ' - 2 - 2 0 ' , ' 2 2 1 ' ) ;
makevectors ( self . v_angle ) ;
setorigin ( newmis , self . origin + ' 0 0 48 ' ) ;
newmis . origin_z = self . origin_z ;
newmis . nextthink = ( time + 180 ) ;
newmis . think = SUB_Remove ;
newmis . islot1 = iid * 512 ;
if ( iid > = IID_AM_NEEDLER & & iid < = IID_AM_WARSAW )
{
newmis . flash = num ;
newmis . touch = AmmoTouch ;
newmis . skin = ToIID ( weap ) - 506 ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else if ( iid > = IID_MISC_JUNK & & iid < = IID_MISC_XRAYTUBE )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
newmis . flash = num ;
newmis . touch = MultiTouch ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else if ( iid > = IID_CHEM_STIMPACK & & iid < = IID_CHEM_RADX )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
newmis . flash = num ;
newmis . touch = MultiTouch ;
}
2009-11-09 04:48:58 +00:00
else if ( iid > = IID_ARM_LEATHER & & iid < = IID_ARM_LPOWER )
2009-11-05 03:40:39 +00:00
{
newmis . flash = num ;
newmis . touch = MultiTouch ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else
{
newmis . islot1 = ( iid * 512 ) + num ;
newmis . touch = WeaponTouch ;
}
} ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
void ( float slot ) WeaponAmmo =
{
local float weap , amount ;
weap = ToIID ( ItemInSlot ( self , slot ) ) ;
amount = WeaponMagQuant ( weap ) ;
GiveAmmo ( slot , amount ) ;
2006-01-01 00:37:52 +00:00
} ;
2009-11-05 03:40:39 +00:00
float ( float iid ) UseBoostingChem =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
local vector source ;
local string x ;
local float duration ;
if ( self . attack_finished > time )
return false ;
x = GetItemName ( iid ) ;
if ( iid = = IID_CHEM_ADRENALINE )
duration = 30 ;
else if ( iid = = IID_CHEM_PSYCHO )
duration = 30 ;
else if ( iid = = IID_CHEM_BESERK )
duration = 60 ;
else if ( iid = = IID_CHEM_RADX )
duration = 120 ;
else
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_HIGH , " Not a boosting chem \n " ) ;
return false ;
}
2009-11-13 05:05:32 +00:00
duration = duration * ( 1 + ( self . skill_doctor / 10 ) ) ;
2009-11-05 03:40:39 +00:00
self . attack_finished = time + 1 ;
makevectors ( self . v_angle ) ;
source = self . origin + ' 0 0 0 ' ;
traceline ( source , source + v_forward * 64 , FALSE , self ) ;
if ( trace_ent . classname = = " player " & & trace_ent . team = = self . team )
{
if ( trace_ent . health < = 0 )
return false ;
if ( trace_ent . rage > = 1 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , trace_ent . netname ) ;
sprint ( self , PRINT_HIGH , " is already affected. \n " ) ;
return false ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
sprint ( trace_ent , 2 , self . netname ) ;
sprint ( trace_ent , PRINT_HIGH , " used a " ) ;
sprint ( trace_ent , PRINT_HIGH , x ) ;
sprint ( trace_ent , PRINT_HIGH , " on you. \n " ) ;
if ( iid ! = IID_CHEM_RADX )
sound ( trace_ent , CHAN_BODY , " player/berserk.wav " , 1 , ATTN_NORM ) ;
if ( iid = = IID_CHEM_RADX )
sound ( trace_ent , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
stuffcmd ( trace_ent , " v_cshift 200 0 0 200 \n " ) ;
trace_ent . rage = iid ;
trace_ent . ragetime = duration ;
return true ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . health < self . max_health & & self . rage = = 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
stuffcmd ( self , " v_cshift 200 0 0 200 \n " ) ;
if ( iid ! = IID_CHEM_RADX )
sound ( self , CHAN_BODY , " player/berserk.wav " , 1 , ATTN_NORM ) ;
if ( iid = = IID_CHEM_RADX )
sound ( self , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
self . rage = iid ;
self . ragetime = duration ;
return true ;
}
return false ;
} ;
float ( float iid ) UseHealingChem =
{
local vector source ;
local float heal ;
local string x ;
local float friendly ;
if ( self . attack_finished > time )
return false ;
x = GetItemName ( iid ) ;
if ( iid = = IID_CHEM_STIMPACK )
heal = 10 ;
else if ( iid = = IID_CHEM_MEDICALBAG )
{
heal = 5 ;
x = " medkit " ;
}
else if ( iid = = IID_CHEM_SUPERSTIM )
heal = 50 ;
else
{
sprint ( self , PRINT_HIGH , " Not a healing chem \n " ) ;
return false ;
}
self . attack_finished = time + 1 ;
self . rtime = time + 0.9 ;
makevectors ( self . v_angle ) ;
source = self . origin + ' 0 0 0 ' ;
traceline ( source , source + v_forward * 64 , FALSE , self ) ;
if ( trace_ent . classname = = " player " )
{
if ( coop )
friendly = true ; //all players are friendly in coop
if ( teamplay )
friendly = trace_ent . team = = self . team ;
if ( trace_ent . health < = 0 & & friendly )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
return RevivePlayer ( self , trace_ent ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( ! friendly )
return false ;
if ( trace_ent . regen > = 1 & & trace_ent . health > 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_HIGH , trace_ent . netname ) ;
sprint ( self , PRINT_HIGH , " is already healing. \n " ) ;
return false ;
}
if ( trace_ent . health > = trace_ent . max_health )
{
sprint ( self , PRINT_HIGH , trace_ent . netname ) ;
sprint ( self , PRINT_HIGH , " isn't injured. \n " ) ;
return false ;
}
sprint ( trace_ent , PRINT_HIGH , self . netname ) ;
sprint ( trace_ent , PRINT_HIGH , " used a " ) ;
sprint ( trace_ent , PRINT_HIGH , x ) ;
sprint ( trace_ent , PRINT_HIGH , " to heal you. \n " ) ;
trace_ent . regen = heal ;
trace_ent . health = trace_ent . health + heal ;
stuffcmd ( trace_ent , " v_cshift 0 0 0 0 \n " ) ;
sound ( self , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
return true ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else if ( self . health < self . max_health & & self . regen = = 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_HIGH , " you heal yourself with a " ) ;
sprint ( self , PRINT_HIGH , x ) ;
sprint ( self , PRINT_HIGH , " . \n " ) ;
sound ( self , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
self . health = self . health + heal ;
self . regen = heal ;
return true ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
return false ;
2006-01-01 00:37:52 +00:00
} ;
2009-11-05 03:40:39 +00:00
float ( entity x , float slotno ) DecreaseDestroySlotOther ;
void ( ) UseStimpack =
2006-01-01 00:37:52 +00:00
{
2009-11-09 04:48:58 +00:00
local float x , found ;
2009-11-05 03:40:39 +00:00
local vector source ;
2009-11-09 04:48:58 +00:00
local entity thing , te ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . attack_finished > time )
2006-01-01 00:37:52 +00:00
return ;
2009-11-09 04:48:58 +00:00
te = findradius ( self . origin , 100 ) ;
while ( te )
{
if ( found = = 0 & & te . classname = = " player " & & te . deadflag )
{
x = SlotOfItem ( self , IID_CHEM_STIMPACK ) ;
if ( x = = 0 )
{
sprint ( self , PRINT_MEDIUM , " you don't have a stimpack \n " ) ;
return ;
}
DecreaseDestroySlot ( x ) ; //take away a stimpack
sound ( trace_ent , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
RevivePlayer ( self , te ) ;
2009-11-16 17:42:41 +00:00
spawn_healing ( te ) ;
spawn_healing ( te ) ;
spawn_healing ( te ) ;
2009-11-09 04:48:58 +00:00
found = 1 ;
}
te = te . chain ;
}
if ( found = = 1 )
return ;
2009-11-05 03:40:39 +00:00
self . attack_finished = time + 1 ;
self . rtime = time + 1 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
makevectors ( self . v_angle ) ;
2009-11-09 04:48:58 +00:00
source = self . origin + ' 0 0 0 ' ;
2009-11-05 03:40:39 +00:00
traceline ( source , source + v_forward * 64 , FALSE , self ) ;
if ( trace_fraction = = 1.0 ) //nobody in front of user, so heal self
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
x = SlotOfItem ( self , IID_CHEM_STIMPACK ) ;
if ( x = = 0 )
{
sprint ( self , PRINT_MEDIUM , " you don't have a stimpack \n " ) ;
return ;
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . regen > 0 )
sprint ( self , PRINT_MEDIUM , " you are already affected by a stimpack \n " ) ;
else if ( self . health > = self . max_health )
sprint ( self , PRINT_MEDIUM , " you are not injured. \n " ) ;
else if ( self . health < self . max_health )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
DecreaseDestroySlot ( x ) ; //take away a stimpack
sound ( self , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
sprint ( self , PRINT_MEDIUM , " you heal yourself with a stimpack \n " ) ;
thing = findradius ( self . origin , 400 ) ;
while ( thing )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
if ( thing . classname = = " player " & & thing . health < self . health )
self . score = self . score - 50 ;
thing = thing . chain ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
2009-11-15 02:36:24 +00:00
self . health = self . health + 30 + ( self . skill_doctor ) ;
self . regen = self . regen + ( 5 + ( self . skill_doctor / 2 ) ) ;
2009-11-16 17:42:41 +00:00
spawn_healing ( self ) ;
spawn_healing ( self ) ;
spawn_healing ( self ) ;
2006-01-01 00:37:52 +00:00
}
}
2009-11-05 03:40:39 +00:00
else if ( trace_ent . classname = = " player " ) //healing another team-mate
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
if ( trace_ent . regen > = 1 & & trace_ent . health > 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " is already healing from a stimpack. \n " ) ;
}
else if ( trace_ent . health > = trace_ent . max_health )
{
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " is not injured. \n " ) ;
}
else if ( trace_ent . health < trace_ent . max_health )
{
x = SlotOfItem ( self , IID_CHEM_STIMPACK ) ;
if ( x > 0 )
DecreaseDestroySlot ( x ) ; //take away a stimpack
else if ( x = = 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , " no stims! searching " ) ;
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " 's body... \n " ) ;
x = SlotOfItem ( trace_ent , IID_CHEM_STIMPACK ) ;
if ( x = = 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " had no stims! \n " ) ;
2009-11-07 03:43:48 +00:00
}
if ( x > = 1 )
{
self . score = self . score + 5 ;
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " had a stim. using it to heal. \n " ) ;
DecreaseDestroySlotOther ( trace_ent , x ) ; //take away a stimpack
2006-01-01 00:37:52 +00:00
return ;
}
2009-11-07 03:43:48 +00:00
x = SlotOfItem ( trace_ent , IID_CHEM_MEDICALBAG ) ;
if ( x = = 0 )
{
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " had no medical bag! \n " ) ;
}
if ( x > = 1 )
2006-01-06 17:38:51 +00:00
{
2009-11-07 03:43:48 +00:00
self . score = self . score + 5 ;
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " had a stim. using it to heal. \n " ) ;
DecreaseDestroySlotOther ( trace_ent , x ) ; //take away a stimpack
2009-11-07 03:43:48 +00:00
return ;
2006-01-06 17:38:51 +00:00
}
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( trace_ent . deadflag )
{
sound ( trace_ent , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
RevivePlayer ( self , trace_ent ) ;
}
else
{
sound ( trace_ent , CHAN_BODY , " items/r_item1.wav " , 1 , ATTN_NORM ) ;
self . score = self . score + 50 ;
sprint ( trace_ent , PRINT_MEDIUM , self . netname ) ;
sprint ( trace_ent , PRINT_MEDIUM , " heals you with a stimpack \n " ) ;
sprint ( self , PRINT_MEDIUM , " you heal " ) ;
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " with a stimpack \n " ) ;
2009-11-15 02:36:24 +00:00
trace_ent . health = trace_ent . health + 30 + ( self . skill_doctor ) ;
2009-11-10 13:57:08 +00:00
trace_ent . regen = trace_ent . regen + ( 3 + ( self . skill_doctor / 2 ) ) ;
2009-11-16 17:42:41 +00:00
spawn_healing ( trace_ent ) ;
spawn_healing ( trace_ent ) ;
spawn_healing ( trace_ent ) ;
2009-11-05 03:40:39 +00:00
}
2006-01-01 00:37:52 +00:00
}
}
2009-11-05 03:40:39 +00:00
} ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
void ( ) UseSuperStim =
{
local float x ;
local vector source ;
if ( self . attack_finished > time )
return ;
self . attack_finished = time + 1 ;
self . rtime = time + 1 ;
makevectors ( self . v_angle ) ;
source = self . origin + ' 0 0 16 ' ;
traceline ( source , source + v_forward * 64 , FALSE , self ) ;
if ( trace_fraction = = 1.0 ) //nobody in front of user, so heal self
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
x = SlotOfItem ( self , IID_CHEM_SUPERSTIM ) ;
if ( x = = 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , " you don't have a superstim \n " ) ;
return ;
}
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( self . regen > 0 )
sprint ( self , PRINT_MEDIUM , " you are already affected by a healing chem \n " ) ;
else if ( self . health > = self . max_health )
sprint ( self , PRINT_MEDIUM , " you are not injured. \n " ) ;
else if ( self . health < self . max_health )
{
local entity thing ;
thing = findradius ( self . origin , 400 ) ;
while ( thing )
{
if ( thing . classname = = " player " & & ( thing . health + 20 ) < self . health )
self . score = self . score - 50 ;
thing = thing . chain ;
}
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
DecreaseDestroySlot ( x ) ; //take away a stimpack
sound ( self , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
sprint ( self , PRINT_MEDIUM , " you heal yourself with a superstim \n " ) ;
self . xregen = 100 ;
}
}
else if ( trace_ent . classname = = " player " ) //healing another team-mate
{
if ( trace_ent . regen > = 1 & & trace_ent . health > 0 )
{
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " is already healing from a healing chem. \n " ) ;
}
else if ( trace_ent . health > = trace_ent . max_health )
{
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " is not injured. \n " ) ;
}
else if ( trace_ent . health < trace_ent . max_health )
{
x = SlotOfItem ( self , IID_CHEM_STIMPACK ) ;
if ( x > 0 )
DecreaseDestroySlot ( x ) ; //take away a stimpack
else if ( x = = 0 )
{
sprint ( self , PRINT_MEDIUM , " no stims! searching " ) ;
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " 's body... \n " ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
x = SlotOfItem ( trace_ent , IID_CHEM_SUPERSTIM ) ;
if ( x = = 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " had no stims! \n " ) ;
return ;
2006-01-01 00:37:52 +00:00
}
else
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " had a superstim. using it to heal. \n " ) ;
DecreaseDestroySlotOther ( trace_ent , x ) ; //take away a stimpack
}
}
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
if ( trace_ent . deadflag )
{
sound ( trace_ent , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
RevivePlayer ( self , trace_ent ) ;
}
else
{
sound ( trace_ent , CHAN_BODY , " items/r_item1.wav " , 1 , ATTN_NORM ) ;
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
self . score = self . score + 50 ;
sprint ( trace_ent , PRINT_MEDIUM , self . netname ) ;
sprint ( trace_ent , PRINT_MEDIUM , " heals you with a superstim! \n " ) ;
sprint ( self , PRINT_MEDIUM , " you heal " ) ;
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " with a superstim \n " ) ;
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
trace_ent . xregen = 100 ;
2006-01-01 00:37:52 +00:00
}
}
}
} ;
2009-11-05 03:40:39 +00:00
void ( ) UseMedicalBag =
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
local float x ;
local vector source ;
2006-01-01 00:37:52 +00:00
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . attack_finished > time )
2006-01-01 00:37:52 +00:00
return ;
2009-11-05 03:40:39 +00:00
self . attack_finished = time + 1 ;
self . rtime = time + 1 ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
makevectors ( self . v_angle ) ;
2009-11-09 04:48:58 +00:00
source = self . origin + ' 0 0 0 ' ;
2009-11-05 03:40:39 +00:00
traceline ( source , source + v_forward * 64 , FALSE , self ) ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
if ( trace_fraction = = 1.0 ) //nobody in front of user, so heal self
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
x = SlotOfItem ( self , IID_CHEM_MEDICALBAG ) ;
if ( x = = 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , " you don't have a medkit \n " ) ;
return ;
}
if ( self . regen > 0 )
sprint ( self , PRINT_MEDIUM , " you are already affected by a healing chem \n " ) ;
else if ( self . health > = self . max_health )
sprint ( self , PRINT_MEDIUM , " you are not injured. \n " ) ;
else if ( self . health < self . max_health )
{
DecreaseDestroySlot ( x ) ; //take away a medkit
local entity thing ;
thing = findradius ( self . origin , 400 ) ;
while ( thing )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
if ( thing . classname = = " player " & & ( thing . health + 20 ) < self . health )
2009-11-15 02:36:24 +00:00
self . score = self . score - 25 ;
2009-11-05 03:40:39 +00:00
thing = thing . chain ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
sound ( self , CHAN_BODY , " items/r_item1.wav " , 1 , ATTN_NORM ) ;
2009-11-15 02:36:24 +00:00
self . health = self . health + 5 + ( self . skill_doctor / 2 ) ;
2009-11-10 13:57:08 +00:00
self . regen = self . regen + 3 + ( self . skill_doctor / 2 ) ;
2006-01-01 00:37:52 +00:00
}
}
2009-11-05 03:40:39 +00:00
else if ( trace_ent . classname = = " player " ) //healing another team-mate
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
if ( trace_ent . regen > = 1 & & trace_ent . health > 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " is already healing from a healing chem. \n " ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else if ( trace_ent . health > = trace_ent . max_health )
{
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " is not injured. \n " ) ;
}
else if ( trace_ent . health < trace_ent . max_health )
{
x = SlotOfItem ( self , IID_CHEM_MEDICALBAG ) ;
if ( x > 0 )
DecreaseDestroySlot ( x ) ; //take away a medkit
else if ( x = = 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , " no stims! searching " ) ;
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " 's body... \n " ) ;
x = SlotOfItem ( trace_ent , IID_CHEM_MEDICALBAG ) ;
if ( x = = 0 )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " had no medkit! \n " ) ;
return ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
else
{
sprint ( self , PRINT_MEDIUM , trace_ent . netname ) ;
sprint ( self , PRINT_MEDIUM , " had a medkit. using it to heal. \n " ) ;
DecreaseDestroySlotOther ( trace_ent , x ) ; //take away a medkit
}
}
if ( trace_ent . deadflag )
{
sound ( trace_ent , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
RevivePlayer ( self , trace_ent ) ;
}
else
{
sound ( trace_ent , CHAN_BODY , " items/r_item1.wav " , 1 , ATTN_NORM ) ;
2009-11-15 02:36:24 +00:00
self . score = self . score + 1 ;
trace_ent . health = trace_ent . health + 5 + ( self . skill_doctor / 2 ) ;
2009-11-10 13:57:08 +00:00
trace_ent . regen = trace_ent . regen + 3 + ( self . skill_doctor / 2 ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
}
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
} ;
2006-01-01 00:37:52 +00:00
2009-11-05 03:40:39 +00:00
void ( ) DisplayMenu =
{
local string menu ;
local entity ze ;
local float gotm , gotc , gots , gote ;
if ( self . currentmenu = = " none " )
return ;
if ( self . currentmenu = = " shop_list " )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
self . missionbrief = 4 ;
menu = ShopString ( ) ;
centerprint ( self , menu ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . currentmenu = = " shop_trait " )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
menu = TraitString ( ) ;
centerprint ( self , menu ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . currentmenu = = " select_mission " )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
menu = MissionString ( ) ;
centerprint ( self , menu ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . currentmenu = = " confirm_depart " )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
menu = DepartString ( ) ;
centerprint ( self , menu ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . currentmenu = = " shop_perk1 " )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
menu = PerkString ( ) ;
centerprint ( self , menu ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . currentmenu = = " shop_perk2 " )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
menu = PerkString ( ) ;
centerprint ( self , menu ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . currentmenu = = " shop_armor " )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
menu = ArmorString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_ammo " )
{
if ( world . map_obj ! = 4 )
menu = AmmoString ( ) ;
else
menu = AmmoString2 ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_melee " )
{
menu = MeleeString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_thrown " )
{
menu = ThrownString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_pistols " )
{
menu = PistolString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_shotguns " )
{
menu = ShotgunString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_rifles " )
{
menu = RifleString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_heavy " )
{
menu = HeavyString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_chems " )
{
menu = ChemString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_other " )
{
menu = OtherString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_equipment " )
{
menu = EquipmentString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " menu_lockpick " )
{
menu = LockpickString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " menu_defuse " )
{
menu = DefuseString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " display_enter_screen " )
{
menu = EnterString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " display_wait_screen " )
{
menu = WaitString ( ) ;
centerprint ( self , menu ) ;
}
if ( self . currentmenu = = " shop_weapons " )
{
menu = WeaponString ( ) ;
centerprint ( self , menu ) ;
2006-01-01 00:37:52 +00:00
}
2006-01-02 03:58:02 +00:00
2009-11-06 04:34:08 +00:00
if ( self . currentmenu = = " gain_skill " )
2009-11-05 03:40:39 +00:00
{
2006-01-09 02:52:18 +00:00
2009-11-06 04:34:08 +00:00
centerprint ( self , " <EFBFBD> choose skill to gain<69> \n \n <EFBFBD> 1<EFBFBD> doctor \n <EFBFBD> 2<EFBFBD> sneak \n <EFBFBD> 3<EFBFBD> combat \n <EFBFBD> 4<EFBFBD> science \n " ) ;
2009-11-05 03:40:39 +00:00
}
2006-01-09 02:52:18 +00:00
2009-11-05 03:40:39 +00:00
if ( ( self . currentmenu = = " select_team " ) )
2006-01-01 00:37:52 +00:00
{
2009-11-05 03:40:39 +00:00
if ( self . class = = 0 )
centerprint ( self , " <EFBFBD> CHOOSE YOUR TEAM<41> \n \n <EFBFBD> 1<EFBFBD> Rangers (good)\n <EFBFBD> 2<EFBFBD> Raiders (evil)\n <EFBFBD> 3<EFBFBD> Auto-Assign \n " ) ;
if ( self . class > = 0 & & self . oldteam = = 0 )
centerprint ( self , " <EFBFBD> CHOOSE YOUR TEAM<41> \n \n <EFBFBD> 1<EFBFBD> Rangers (good)\n <EFBFBD> 2<EFBFBD> Raiders (evil)\n <EFBFBD> 3<EFBFBD> Auto-Assign \n " ) ;
if ( self . class > 0 & & self . oldteam > 0 )
centerprint ( self , " <EFBFBD> CHOOSE YOUR TEAM<41> \n \n <EFBFBD> 1<EFBFBD> Rangers (good)\n <EFBFBD> 2<EFBFBD> Raiders (evil)\n <EFBFBD> 3<EFBFBD> Auto-Assign \n <EFBFBD> 4<EFBFBD> Keep Previous \n " ) ;
2006-01-01 00:37:52 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . currentmenu = = " confirm_team " )
2006-01-09 02:52:18 +00:00
{
2009-11-05 03:40:39 +00:00
if ( self . team = = 1 )
centerprint ( self , " <EFBFBD> you will respawn as<61> \n \n Ranger - OK? \n <EFBFBD> 1<EFBFBD> Yes \n <EFBFBD> 2<EFBFBD> No \n " ) ;
if ( self . team = = 2 )
centerprint ( self , " <EFBFBD> you will respawn as<61> \n \n Raider - OK? \n <EFBFBD> 1<EFBFBD> Yes \n <EFBFBD> 2<EFBFBD> No \n " ) ;
}
if ( self . currentmenu = = " confirm_skill " )
{
if ( self . tclass = = 1 )
centerprint ( self , " <EFBFBD> your skill-set will be<62> \n \n first aid - OK? \n <EFBFBD> 1<EFBFBD> Yes \n <EFBFBD> 2<EFBFBD> No \n \n primary: first aid \n secondary: buff allies \n " ) ;
if ( self . tclass = = 2 )
centerprint ( self , " <EFBFBD> your skill-set will be<62> \n \n stealth - OK? \n <EFBFBD> 1<EFBFBD> Yes \n <EFBFBD> 2<EFBFBD> No \n \n primary: stealth \n secondary: damage " ) ;
if ( self . tclass = = 3 )
centerprint ( self , " <EFBFBD> your skill-set will be<62> \n \n combat - OK? \n <EFBFBD> 1<EFBFBD> Yes \n <EFBFBD> 2<EFBFBD> No \n \n primary: survival \n secondary: damage " ) ;
if ( self . tclass = = 4 )
centerprint ( self , " <EFBFBD> your skill-set will be<62> \n \n science - OK? \n <EFBFBD> 1<EFBFBD> Yes \n <EFBFBD> 2<EFBFBD> No \n \n primary: create \n secondary: bypass " ) ;
2006-01-09 02:52:18 +00:00
}
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
if ( self . currentmenu = = " menu_build " )
{
menu = BuildString ( ) ;
centerprint ( self , menu ) ;
}
2006-01-01 00:37:52 +00:00
} ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
void ( ) Special =
2006-01-04 20:45:08 +00:00
{
2009-11-07 03:43:48 +00:00
2009-11-05 03:40:39 +00:00
Sneak ( ) ;
} ;
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
void ( ) hos_run1 ;
void ( ) hos_stand1 ;
float ( float iid ) spawn_station ;
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
. float gravity ;
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
void ( ) pickup_body =
{
local float x , z , forward_okay , down_okay , fp ;
local vector dir , org ;
local entity te ;
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
makevectors ( self . enemy . v_angle ) ;
traceline ( self . enemy . origin , self . enemy . origin + v_forward * 64 , TRUE , self ) ;
org = trace_endpos - v_forward * 24 ;
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
self . movetype = MOVETYPE_TOSS ;
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
if ( self . enemy . pickup = = 1 )
{
self . flags = self . flags - ( self . flags & FL_ONGROUND ) ;
self . gravity = 0 ;
dir = normalize ( self . origin - ( self . enemy . origin + ' 0 0 48 ' ) ) ;
self . angles_y = dir ;
self . velocity_z + = 30 ;
self . goalentity = self . enemy ;
self . velocity = dir * - 100 ;
self . enemy . maxspeed = 100 ;
self . nextthink = time + 0.01 ;
return ;
}
else if ( self . enemy . pickup = = 0 )
{
self . velocity = ' 0 0 0 ' ;
self . velocity_z = - 250 ;
self . gravity = 800 ;
self . enemy = world ;
return ;
}
} ;
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
void ( ) pickup_body2 =
{
local float x , z ;
local vector dir ;
2006-01-04 20:45:08 +00:00
2009-11-05 03:40:39 +00:00
x = vlen ( self . origin - self . enemy . origin ) ;
dir = normalize ( self . origin - self . enemy . origin ) ;
self . movetype = MOVETYPE_STEP ;
z = self . origin_z - self . enemy . origin_z ;
if ( ( x > = 32 & & x < = 96 ) & & self . enemy . pickup = = 1 )
{
self . velocity = ( dir * ( - 30 ) ) ;
self . velocity_z = 1 ;
self . enemy . maxspeed = 50 ;
self . angles = dir ;
self . nextthink = time + 0.01 ;
}
else if ( x > 96 & & self . enemy . pickup = = 1 )
{
self . velocity = ' 0 0 0 ' ;
self . enemy . pickup = 0 ;
sprint ( self . enemy , 2 , " dropped body. \n " ) ;
2006-01-04 20:45:08 +00:00
}
} ;
2009-11-05 03:40:39 +00:00
void ( ) hos_face =
2006-01-01 21:33:21 +00:00
{
local entity te ;
2009-11-05 03:40:39 +00:00
te = findradius ( self . origin , 250 ) ;
while ( te )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
if ( te . classname = = " player " )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
self . enemy = te ;
te . safezone = 1 ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
te = te . chain ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
self . angles_y = vectoyaw ( self . enemy . origin - self . origin ) ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
self . nextthink = time + 0.1 ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( vlen ( self . origin - self . enemy . origin ) > 250 )
self . enemy = world ;
} ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
void ( ) ExitScreen =
{
local vector vec , dir ;
local string ammoname , ammocountftos , rep ;
local float best , ammotype , ammocount , dot ;
local entity save ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
self . impulse = 0 ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . class = = 0 )
2006-01-01 21:33:21 +00:00
return ;
2009-11-05 03:40:39 +00:00
if ( self . ghost = = 1 )
return ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . team = = 0 )
return ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . attack_finished > time )
return ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
self . accept = 1 ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . currentmenu ! = " menu_none " )
self . missionbrief = 0 ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
makevectors ( self . v_angle ) ;
traceline ( self . origin , self . origin + v_forward * 128 , FALSE , self ) ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . pickup = = 1 )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
self . pickup = 0 ;
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " body " & & self . pickup = = 0 )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
trace_ent . movetype = MOVETYPE_BOUNCE ;
dir = normalize ( trace_ent . origin - self . origin ) ;
trace_ent . velocity = dir * 100 ;
trace_ent . velocity_z = 100 ;
trace_ent . avelocity_y = ( random ( ) * 30 ) ;
trace_ent . think = pickup_body ;
trace_ent . enemy = self ;
trace_ent . nextthink = time + 0.01 ;
self . pickup = 1 ;
sound ( self , CHAN_BODY , " player/land.wav " , 1 , ATTN_IDLE ) ;
sprint ( self , 2 , " grabbed body. \n " ) ;
return ;
}
else if ( self . pickup = = 1 )
self . pickup = 0 ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " bomb " )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
if ( trace_ent . picking = = 1 )
{
sprint ( self , 2 , " already being defused. \n " ) ;
return ;
}
if ( trace_ent . picking = = 2 )
{
sprint ( self , 2 , " that bomb is disarmed \n " ) ;
return ;
}
if ( trace_ent . picking = = 3 )
{
sprint ( self , 2 , " circuits are jammed. \n " ) ;
return ;
}
self . picking = 1 ;
trace_ent . picking = 1 ;
self . currentmenu = " menu_defuse " ;
SpawnBomb ( trace_ent , self ) ;
2006-01-01 21:33:21 +00:00
return ;
}
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " brotherhood_guard " )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
if ( random ( ) < 0.25 )
sound ( self , CHAN_BODY , " enforcer/sight2.wav " , 1 , ATTN_NORM ) ;
else if ( random ( ) < 0.25 )
sound ( self , CHAN_BODY , " enforcer/sight2.wav " , 1 , ATTN_NORM ) ;
else if ( random ( ) < 0.25 )
sound ( self , CHAN_BODY , " enforcer/sight3.wav " , 1 , ATTN_NORM ) ;
else
sound ( self , CHAN_BODY , " enforcer/sight4.wav " , 1 , ATTN_NORM ) ;
sprint ( self , 2 , " guard: back off, grunts ain't allowed in here. \n " ) ;
2006-01-01 21:33:21 +00:00
return ;
}
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " brotherhood_doctor " )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , " doctor: if you are hurt, lie down and rest \n " ) ;
2006-01-01 21:33:21 +00:00
return ;
}
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " brotherhood_soldier " )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
if ( random ( ) < 0.12 )
{
sprint ( self , 2 , " \n \n \n " ) ;
sprint ( self , 2 , " make sure you buy ammo before going out \n " ) ;
sprint ( self , 2 , " into the wastes, you'll use alot of it! \n " ) ;
}
else if ( random ( ) < 0.12 )
{
sprint ( self , 2 , " \n \n \n " ) ;
sprint ( self , 2 , " have team mates whose skills cover up your \n " ) ;
sprint ( self , 2 , " weaknesses. first-aid and science-oriented \n " ) ;
sprint ( self , 2 , " team members are crucial to a team. \n " ) ;
}
else if ( random ( ) < 0.12 )
{
sprint ( self , 2 , " \n \n \n " ) ;
sprint ( self , 2 , " those skilled in science & repair can make \n " ) ;
sprint ( self , 2 , " make useful objects out of junk. this helps \n " ) ;
sprint ( self , 2 , " improve your squad as a whole. \n " ) ;
}
else if ( random ( ) < 0.12 )
{
sprint ( self , 2 , " \n \n \n " ) ;
sprint ( self , 2 , " jhp stands for jacketed hollow-point, which \n " ) ;
sprint ( self , 2 , " means the ammo spreads for a great deal of \n " ) ;
sprint ( self , 2 , " stopping power against unarmored foes. \n " ) ;
}
else if ( random ( ) < 0.12 )
{
sprint ( self , 2 , " \n \n \n " ) ;
sprint ( self , 2 , " ap stands for armor-piercing, which means the \n " ) ;
sprint ( self , 2 , " rounds will tear through armor like paper. use \n " ) ;
sprint ( self , 2 , " such rounds when fighting heavily-armored foes \n " ) ;
}
else if ( random ( ) < 0.12 )
{
sprint ( self , 2 , " \n \n \n " ) ;
sprint ( self , 2 , " you can improve your stealth level by being \n " ) ;
sprint ( self , 2 , " quiet, hugging walls, ducking, silencers, & \n " ) ;
sprint ( self , 2 , " wearing light armor. \n " ) ;
}
else if ( random ( ) < 0.12 )
{
sprint ( self , 2 , " \n \n \n " ) ;
sprint ( self , 2 , " perks are useful abilities. make sure you have \n " ) ;
sprint ( self , 2 , " perks that complement your skills and playing \n " ) ;
sprint ( self , 2 , " style. some perks even go really well together \n " ) ;
}
else if ( random ( ) < 0.12 )
{
sprint ( self , 2 , " \n \n \n " ) ;
sprint ( self , 2 , " proper positioning of all squad members is key \n " ) ;
sprint ( self , 2 , " to success in the battles you will face. make \n " ) ;
sprint ( self , 2 , " sure to duck, prone and sneak when necessary \n " ) ;
}
else
{
sprint ( self , 2 , " \n \n \n " ) ;
sprint ( self , 2 , " if you are trained in first aid, do not forget \n " ) ;
sprint ( self , 2 , " about your chems. psycho can provide temporary \n " ) ;
sprint ( self , 2 , " armor bonus, and adrenaline lets you run fast. \n " ) ;
}
2006-01-01 21:33:21 +00:00
return ;
}
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " brotherhood_sergeant " )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , " sergeant: ready for your next mission? \n " ) ;
self . currentmenu = " select_mission " ;
2006-01-01 21:33:21 +00:00
return ;
}
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " func_tank " )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , " get ready to gear up! \n " ) ;
self . currentmenu = " confirm_depart " ;
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " treasure_chest " )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
if ( trace_ent . picking = = 1 )
{
sprint ( self , 2 , " already being picked. \n " ) ;
return ;
}
if ( trace_ent . picking = = 2 )
{
sprint ( self , 2 , " that chest is empty! \n " ) ;
return ;
}
if ( trace_ent . picking = = 3 )
{
sprint ( self , 2 , " lock is jammed. \n " ) ;
return ;
}
2009-11-07 03:43:48 +00:00
if ( self . skill_sneak = = 0 )
2009-11-05 03:40:39 +00:00
{
sound ( self , CHAN_BODY , " items/locked.wav " , 1 , ATTN_NORM ) ;
sprint ( self , 2 , " locked! \n " ) ;
return ;
}
self . attack_finished = time + 0.5 ;
self . rtime = time + 4 ;
self . picking = 1 ;
trace_ent . picking = 1 ;
self . currentmenu = " menu_lockpick " ;
SpawnOpenChest ( trace_ent , self ) ;
2006-01-01 21:33:21 +00:00
return ;
}
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " rhostage " & & trace_ent . health > 0 & & trace_ent . rescued = = 0 )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
if ( self . team ! = 1 )
return ;
if ( self . currentmenu ! = " none " )
return ;
2009-11-07 03:43:48 +00:00
bprint ( 2 , " civilian has been located. \n " ) ;
sound ( trace_ent , CHAN_BODY , " misc/rescued.wav " , 1 , ATTN_NONE ) ;
2009-11-05 03:40:39 +00:00
rescue = rescue + 1 ;
//remove(trace_ent);
spawn_excla ( trace_ent , 3000 ) ;
trace_ent . rescued = 1 ;
trace_ent . think = hos_face ;
trace_ent . nextthink = time + 1 ;
2006-01-01 21:33:21 +00:00
return ;
}
2009-11-05 03:40:39 +00:00
if ( trace_ent . classname = = " monster " & & trace_ent . health > 0 )
{
if ( self . sneak = = 0 )
return ;
if ( self . class ! = 2 )
return ;
if ( self . currentmenu ! = " none " )
return ;
if ( random ( ) * 100 < = 75 )
{
if ( trace_ent . ammo_shells = = 0 )
{
sprint ( self , 2 , " nothing to steal! \n " ) ;
return ;
}
sprint ( self , 2 , " success! stole " ) ;
ammotype = GetRandomAmmo ( ) ;
ammocount = GetAmmoCount ( ammotype ) ;
ammocount = ceil ( ammocount ) ;
ammoname = GetItemName ( ammotype ) ;
ammocountftos = ftos ( ammocount ) ;
sprint ( self , 2 , ammoname ) ;
sprint ( self , 2 , " ( " ) ;
sprint ( self , 2 , ammocountftos ) ;
sprint ( self , 2 , " ) " ) ;
TryGiveStackable ( self , ammotype , ammocount ) ;
sound ( self , CHAN_WEAPON , " weapons/ax1 " , 1 , ATTN_NORM ) ;
trace_ent . ammo_shells = 0 ;
return ;
}
else
{
sound ( self , CHAN_WEAPON , " weapons/ax1 " , 1 , ATTN_NORM ) ;
sprint ( self , 2 , " pilfer failed... \n " ) ;
return ;
}
}
if ( trace_ent . classname = = " hostage " & & trace_ent . health > 0 & & trace_fraction < 1 )
{
if ( self . team ! = 1 )
return ;
if ( self . currentmenu = = " menu_build " )
return ;
if ( trace_ent . cnt = = 0 )
{
sprint ( self , 2 , " hostage is now following you. \n " ) ;
trace_ent . nextthink = ( time + 0.1 ) ;
trace_ent . think = hos_run1 ;
trace_ent . cnt = 1 ;
trace_ent . friend = self ;
return ;
}
else
{
if ( trace_ent . cnt = = 1 )
{
sprint ( self , 2 , " hostage stopped following you. \n " ) ;
trace_ent . nextthink = ( time + 0.1 ) ;
trace_ent . think = hos_stand1 ;
trace_ent . cnt = 0 ;
trace_ent . friend = trace_ent ;
return ;
}
}
return ;
}
if ( ( self . currentmenu ! = " none " ) )
{
centerprint ( self , " \n " ) ;
self . currentmenu = " none " ;
}
} ;
void ( ) disappear =
{
local entity te ;
local float nearby ;
//this allows an assassin to vanish, making monsters aggro
//those who are visible
2009-11-13 05:05:32 +00:00
if ( ! getperk ( 3 ) )
return ;
2009-11-05 03:40:39 +00:00
te = findradius ( self . origin , 500 ) ;
while ( te )
{
if ( te . classname = = " player " & & te . sneak = = 0 & & te ! = self )
nearby = 1 ;
te = te . chain ;
}
if ( nearby = = 1 )
{
te = findradius ( self . origin , 1000 ) ;
while ( te )
{
if ( te . enemy = = self )
te . enemy = world ;
te = te . chain ;
}
}
} ;
void ( ) Sneak =
{
local float w ;
w = weightx ( ) ;
if ( self . sneak > = 1 )
{
2009-11-15 02:36:24 +00:00
sound ( self , CHAN_BODY , " items/r_tele4.wav " , 1 , ATTN_NORM ) ;
2009-11-05 03:40:39 +00:00
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
return ;
}
if ( self . sneak = = 0 )
{
disappear ( ) ;
sound ( self , CHAN_BODY , " items/inv1.wav " , 1 , ATTN_NORM ) ;
self . sneak = 1 ;
return ;
}
} ;
void ( ) Shield =
{
if ( self . class ! = 6 )
{
centerprint ( self , " You can't shield yourself! \n " ) ;
return ;
}
if ( self . sneak = = 2 )
{
centerprint ( self , " <EFBFBD> <EFBFBD> <EFBFBD> Unshielded <20> <> <EFBFBD> \n " ) ;
self . sneak = 0 ;
sound ( self , CHAN_BODY , " items/protect2.wav " , 1 , ATTN_NORM ) ;
return ;
}
if ( self . ammo_cells < 10 )
{
centerprint ( self , " wait for your shield to recharge. \n " ) ;
return ;
}
if ( self . sneak = = 0 )
{
centerprint ( self , " <EFBFBD> <EFBFBD> <EFBFBD> Energy Shield <20> <> <EFBFBD> \n " ) ;
self . sneak = 2 ;
sound ( self , CHAN_BODY , " items/protect.wav " , 1 , ATTN_NORM ) ;
return ;
}
} ;
void ( ) station_die =
{
if ( ( self . buildtype = = IID_BUILD_MRAMMO ) )
{
if ( ( self . team = = 1 ) )
{
blue_weapon = 0 ;
}
else
{
if ( ( self . team = = 2 ) )
{
red_weapon = 0 ;
}
}
}
if ( ( self . buildtype = = IID_BUILD_SHIELDGEN ) )
{
if ( ( self . team = = 1 ) )
{
blue_armor = 0 ;
}
else
{
if ( ( self . team = = 2 ) )
{
red_armor = 0 ;
}
}
}
if ( ( self . buildtype = = IID_BUILD_AUTODOC ) )
{
if ( ( self . team = = 1 ) )
{
blue_gadget = 0 ;
}
else
{
if ( ( self . team = = 2 ) )
{
red_gadget = 0 ;
}
}
}
Explosion ( 2 ) ;
} ;
void ( ) station_think =
{
# define chemcount attack_finished
local entity te ;
local float r ;
self . nextthink = time + 2 ;
if ( self . track . team ! = self . team )
{
station_die ( ) ;
return ;
}
if ( self . chemcount < = 0 )
{
station_die ( ) ;
return ;
}
if ( self . buildtype = = IID_BUILD_SHIELDGEN ) //barricade
{
sound ( self , CHAN_BODY , " items/protect2.wav " , 1 , ATTN_NORM ) ;
te = findradius ( self . origin , 256 ) ;
while ( te )
{
if ( te . classname = = " player " & & te . team = = self . team & & ! te . deadflag )
{
if ( self . chemcount < = 0 )
{
sound ( self , CHAN_BODY , " misc/menu2.wav " , TRUE , ATTN_NORM ) ;
sprint ( te , 2 , " the shield generator is out of power. \n " ) ;
return ;
}
if ( te . classname = = " player " )
{
te . protect = 3 ;
self . chemcount = self . chemcount - 1 ;
stuffcmd ( te , " v_cshift 0 100 100 100 \n " ) ;
}
}
te = te . chain ;
}
}
if ( self . buildtype = = IID_BUILD_AUTODOC ) //autodoc
{
te = findradius ( self . origin , 70 ) ;
while ( te )
{
if ( te . classname = = " player " & & te . team = = self . team & & ! te . deadflag )
{
if ( self . chemcount < = 0 )
{
sound ( self , CHAN_BODY , " misc/item1.wav " , TRUE , ATTN_NORM ) ;
sprint ( te , 2 , " the autodoc is out of medical supplies. \n " ) ;
return ;
}
if ( te . deadflag )
RevivePlayer ( self , te ) ;
else if ( te . health < te . max_health )
{
sound ( self , CHAN_BODY , " items/r_item2.wav " , 1 , ATTN_NORM ) ;
sprint ( te , PRINT_MEDIUM , " the auto-doc heals you for 3 health. \n " ) ;
te . health = te . health + 3 ;
self . chemcount = self . chemcount - 1 ;
if ( te . health > te . max_health )
te . health = te . max_health ;
}
if ( random ( ) < 0.001 )
{
r = random ( ) * 6 ;
if ( r < 1 )
sprint ( te , PRINT_HIGH , " the auto-doc heals you of AIDS \n " ) ;
else if ( r < 2 )
sprint ( te , PRINT_HIGH , " the auto-doc heals you of Genital Herpes \n " ) ;
else if ( r < 3 )
sprint ( te , PRINT_HIGH , " the auto-doc heals you of Gonorrhea \n " ) ;
else if ( r < 4 )
sprint ( te , PRINT_HIGH , " the auto-doc heals you of Syphillis \n " ) ;
else if ( r < 5 )
sprint ( te , PRINT_HIGH , " the auto-doc rids you of Crabs \n " ) ;
else if ( r < 6 )
sprint ( te , PRINT_HIGH , " the auto-doc heals you of Chlamydia \n " ) ;
}
}
te = te . chain ;
}
}
if ( self . buildtype = = IID_BUILD_MRAMMO ) //mr. ammo
{
te = findradius ( self . origin , 60 ) ;
while ( te )
{
if ( te . classname = = " player " & & te . team = = self . team & & ! te . deadflag )
{
if ( self . chemcount < = 0 )
{
sound ( self , CHAN_BODY , " misc/item1.wav " , TRUE , ATTN_NORM ) ;
sprint ( te , 2 , " this mr.ammo is out of ammunition. \n " ) ;
return ;
}
local float x ;
x = 300 ;
local float curweap ;
local float ammotype ;
local float ammocount ;
local float ammoslot ;
curweap = ToIID ( ItemInSlot ( te , te . current_slot ) ) ;
ammotype = WeaponAmmoType ( curweap ) ;
if ( ammotype )
{
ammocount = TotalQuantity ( te , ammotype ) ;
x = x - ammocount ;
}
else
x = 0 ;
if ( x > 0 )
{
ammocount = WeaponMagQuant ( curweap ) ;
if ( x > ammocount / 2 )
x = ammocount / 2 ;
ammoslot = SlotOfItem ( te , ammotype ) ;
if ( ! ammoslot )
ammoslot = FindEmptySlot ( te ) ;
if ( ammoslot )
SetItemSlot ( te , ammoslot , SlotVal ( ammotype , x + ToStatus ( ItemInSlot ( te , ammoslot ) ) ) ) ;
sprint ( te , PRINT_MEDIUM , ftos ( ceil ( x ) ) , " ammo was received from the mr.ammo. \n " ) ;
/*
else if ( r < 2 )
sprint ( te , PRINT_MEDIUM , ftos ( ceil ( x ) ) , " potatos were received from the mr.ammo. \n " ) ;
else if ( r < 3 )
sprint ( te , PRINT_MEDIUM , ftos ( ceil ( x ) ) , " ammo was given by the mr.ammo. \n " ) ;
else if ( r < 4 )
sprint ( te , PRINT_MEDIUM , ftos ( ceil ( x ) ) , " ammo was stolen from the mr.ammo. \n " ) ;
else if ( r < 5 )
sprint ( te , PRINT_MEDIUM , ftos ( ceil ( x ) ) , " ammo was extracted from the mr.ammo. \n " ) ;
else
sprint ( te , PRINT_MEDIUM , ftos ( ceil ( x ) ) , " ammo was given by the mr.ammo, along with an std \n " ) ; */
self . chemcount = self . chemcount - 1 ;
}
}
te = te . chain ;
}
}
} ;
void ( ) Bar_Think =
{
local float dot1 ;
2009-11-09 04:48:58 +00:00
self . flags = self . flags ;
2009-11-15 02:36:24 +00:00
self . frame = floor ( ( ( self . owner . health / self . owner . max_health ) * TE_WIZSPIKE ) ) ;
2009-11-09 04:48:58 +00:00
2009-11-15 02:36:24 +00:00
if ( self . owner . position = = 0 )
setorigin ( self , ( self . owner . origin + ' 0 0 40 ' ) ) ;
else if ( self . owner . position = = 1 )
setorigin ( self , ( self . owner . origin + ' 0 0 32 ' ) ) ;
else
setorigin ( self , ( self . owner . origin + ' 0 0 24 ' ) ) ;
self . nextthink = ( time + 0.01 ) ;
setmodel ( self , " progs/hbar.spr " ) ;
2009-11-05 03:40:39 +00:00
} ;
void ( entity guy ) spawn_dot =
{
local entity hologram ;
hologram = spawn ( ) ;
hologram . movetype = MOVETYPE_NONE ;
hologram . solid = SOLID_NOT ;
hologram . owner = self ;
setmodel ( hologram , " progs/hbar.spr " ) ;
hologram . skin = self . skin ;
setorigin ( hologram , self . origin ) ;
setsize ( hologram , VEC_ORIGIN , VEC_ORIGIN ) ;
hologram . angles = self . angles ;
hologram . colormap = self . colormap ;
hologram . cnt = MULTICAST_ALL ;
hologram . think = Bar_Think ;
hologram . nextthink = ( time + 0.01 ) ;
2009-11-09 04:48:58 +00:00
hologram . scale = 0.5 ;
2009-11-05 03:40:39 +00:00
} ;
void ( ) FinishTurret ;
float ( float iid ) spawn_station =
{
local entity oself ;
local entity te ;
local vector org ;
if ( iid = = IID_BUILD_ROBOFANG )
{
te = find ( world , classname , " robofang " ) ;
while ( te )
{
if ( te . track = = self & & te . buildtype = = IID_BUILD_ROBOFANG )
{
makevectors ( self . v_angle ) ;
setorigin ( te , self . origin + v_forward * 32 ) ;
return false ;
}
te = find ( te , classname , " robofang " ) ;
}
}
te = find ( world , classname , " station " ) ;
while ( te )
{
if ( te . track = = self & & te . buildtype = = iid )
{
sprint ( self , 2 , " already have one. \n " ) ;
return false ;
}
te = find ( te , classname , " station " ) ;
}
if ( iid = = IID_BUILD_ROBOFANG )
{
te = findradius ( self . origin , 128 ) ;
while ( te )
{
if ( te ! = self & & te . classname = = " player " & & te . health > 0 )
{
sprint ( self , PRINT_HIGH , " not with other players nearby. \n " ) ;
return false ;
}
te = te . chain ;
}
}
makevectors ( self . v_angle ) ;
org = ( ( self . origin + ( v_forward * IT_LIGHTNING ) ) + ( v_up * EF_FLAG2 ) ) ;
if ( ( pointcontents ( ( org + ' 0 20 0 ' ) ) ! = CONTENT_EMPTY ) )
{
sprint ( self , 2 , " can't build there. \n " ) ;
return false ;
}
if ( ( pointcontents ( ( org + ' 0 - 20 0 ' ) ) ! = CONTENT_EMPTY ) )
{
sprint ( self , 2 , " can't build there. \n " ) ;
return false ;
}
if ( ( pointcontents ( ( org + ' 20 0 0 ' ) ) ! = CONTENT_EMPTY ) )
{
sprint ( self , 2 , " can't build there. \n " ) ;
return false ;
}
if ( ( pointcontents ( ( org + ' - 20 0 0 ' ) ) ! = CONTENT_EMPTY ) )
{
sprint ( self , 2 , " can't build there. \n " ) ;
return false ;
}
if ( ( pointcontents ( ( org + ' 0 0 50 ' ) ) ! = CONTENT_EMPTY ) )
{
sprint ( self , 2 , " can't build there. \n " ) ;
return false ;
}
if ( ( pointcontents ( ( org + ' 0 0 - 10 ' ) ) ! = CONTENT_EMPTY ) )
{
sprint ( self , 2 , " can't build there. \n " ) ;
return false ;
}
self . impulse = 0 ;
te = findradius ( org , 40 ) ;
while ( te )
{
if ( te . classname = = " spawn1 " )
{
sprint ( self , 2 , " can't build at spawn. \n " ) ;
return false ;
}
if ( te . classname = = " spawn2 " )
{
sprint ( self , 2 , " can't build at spawn. \n " ) ;
return false ;
}
if ( te . classname = = " ghoul " )
{
sprint ( self , 2 , " somethings in the way. \n " ) ;
return false ;
}
if ( ( ( te . classname = = " player " ) & & ( te . health > 0 ) ) )
{
sprint ( self , 2 , " can't build on players. \n " ) ;
return false ;
}
if ( ( ( te . classname = = " station " ) & & ( te . health > 0 ) ) )
{
sprint ( self , 2 , " can't build on other stations. \n " ) ;
return false ;
}
te = te . chain ;
}
oself = self ;
self = spawn ( ) ;
self . team = oself . team ;
self . track = oself ;
spawn_dot ( self ) ;
self . origin = org ;
self . takedamage = DAMAGE_YES ;
self . solid = SOLID_SLIDEBOX ;
self . movetype = MOVETYPE_TOSS ;
setsize ( self , ' - 16 - 16 0 ' , ' 16 16 40 ' ) ;
self . health = 30 ;
self . max_health = 300 ;
self . th_die = station_die ;
setmodel ( self , " progs/station.mdl " ) ;
self . classname = " station " ;
self . think = station_think ;
self . helmet = 2 ;
self . buildtype = iid ;
self . aflag = true ;
self . frame = 4 ;
self . chemcount = 75 ;
if ( self . buildtype = = IID_BUILD_MRAMMO )
self . netname = " mr. ammo " ;
if ( self . buildtype = = IID_BUILD_SHIELDGEN )
self . netname = " shield generator " ;
if ( self . buildtype = = IID_BUILD_AUTODOC )
self . netname = " autodoc " ;
if ( self . buildtype = = IID_BUILD_ROBOFANG )
{
setsize ( self , ' - 24 - 24 - 24 ' , ' 24 24 24 ' ) ;
self . netname = " robofang " ;
setmodel ( self , " progs/dog.mdl " ) ;
}
if ( self . buildtype = = IID_BUILD_TTURRET | | self . buildtype = = IID_BUILD_RTURRET | | self . buildtype = = IID_BUILD_GTURRET )
{
FinishTurret ( ) ;
}
self = oself ;
return true ;
} ;
float ( ) FireToolkit =
{
local float rr ;
makevectors ( self . v_angle ) ;
traceline ( self . origin , self . origin + v_forward * 64 , FALSE , self ) ;
//track is used for the owning player (without using the .owner field)
if ( trace_ent . track = = self & & trace_ent . classname = = " station " & & trace_ent . health > 0 )
{
if ( trace_ent . health > = trace_ent . max_health ) //already built - don't whack it!
return true ;
//play a random build sound
rr = random ( ) ;
if ( rr < 0.5 )
sound ( self , CHAN_WEAPON , " items/lockpick1.wav " , TRUE , ATTN_NORM ) ;
else
sound ( self , CHAN_WEAPON , " items/lockpick2.wav " , TRUE , ATTN_NORM ) ;
if ( ! trace_ent . nextthink )
if ( trace_ent . health > 200 )
trace_ent . frame = 5 ;
self . attack_finished = time + 0.1 + ( random ( ) * 0.1 ) ;
trace_ent . health = trace_ent . health + 6 ;
if ( trace_ent . health > = trace_ent . max_health )
{ //it's built!
trace_ent . health = trace_ent . max_health ;
if ( ! trace_ent . aflag )
return true ; //already complete
trace_ent . aflag = false ;
trace_ent . nextthink = time + 1 ;
sprint ( self , PRINT_MEDIUM , " BUILDING COMPLETED. \n " ) ;
if ( trace_ent . buildtype = = IID_BUILD_ROBOFANG )
{
trace_ent . solid = SOLID_NOT ;
trace_ent . think = SUB_Remove ;
trace_ent . nextthink = time ;
makevectors ( self . v_angle ) ;
sprint ( self , PRINT_HIGH , " Robofang appears to have malfunctioned \n " ) ;
}
if ( trace_ent . buildtype = = IID_BUILD_AUTODOC )
trace_ent . frame = 1 ;
if ( trace_ent . buildtype = = IID_BUILD_MRAMMO )
trace_ent . frame = 0 ;
if ( trace_ent . buildtype = = IID_BUILD_SHIELDGEN )
trace_ent . frame = 2 ;
}
return true ;
}
return false ;
} ;
void ( ) shop_face =
{
local entity te ;
te = findradius ( self . origin , 250 ) ;
while ( te )
{
if ( te . classname = = " player " )
{
self . enemy = te ;
te . safezone = 1 ;
2009-11-07 03:43:48 +00:00
te . xslot1 = self . xslot1 ;
2009-11-07 10:41:46 +00:00
te . xslot2 = self . xslot2 ;
te . xslot3 = self . xslot3 ;
te . xslot4 = self . xslot4 ;
te . xslot5 = self . xslot5 ;
te . xslot6 = self . xslot6 ;
te . xslot7 = self . xslot7 ;
te . xslot8 = self . xslot8 ;
te . xslot9 = self . xslot9 ;
te . xslot10 = self . xslot10 ;
te . xslot11 = self . xslot11 ;
te . xslot12 = self . xslot12 ;
te . xslot13 = self . xslot13 ;
te . xslot14 = self . xslot14 ;
te . xslot15 = self . xslot15 ;
te . xslot16 = self . xslot16 ;
te . xslot17 = self . xslot17 ;
te . xslot18 = self . xslot18 ;
te . xslot19 = self . xslot19 ;
te . xslot20 = self . xslot20 ;
2009-11-05 03:40:39 +00:00
}
te = te . chain ;
}
self . angles_y = vectoyaw ( self . enemy . origin - self . origin ) ;
self . nextthink = time + 0.1 ;
if ( vlen ( self . origin - self . enemy . origin ) > 500 )
self . enemy = world ;
} ;
void ( ) BuyMenu =
{
local float is_shop ;
local entity te ;
local string menu ;
if ( self . currentmenu = = " 777 " )
return ;
is_shop = 0 ;
if ( coop = = 0 )
{
te = findradius ( self . origin , 250 ) ;
while ( te )
{
if ( te . classname = = " buyzone1 " & & self . team = = 1 )
is_shop = 1 ;
if ( te . classname = = " buyzone2 " & & self . team = = 2 )
is_shop = 1 ;
te = te . chain ;
}
}
if ( coop = = 1 )
{
te = findradius ( self . origin , 80 ) ;
while ( te )
{
if ( te . classname = = " buyzone " )
is_shop = 1 ;
if ( te . classname = = " merchant " )
{
te . enemy = self ;
te . think = shop_face ;
te . nextthink = time + 0.5 ;
is_shop = 1 ;
}
te = te . chain ;
}
}
if ( ( is_shop = = 0 ) )
{
centerprint ( self , " nothing but the afterglow, here. \n (find a trader) " ) ;
return ;
}
if ( ( is_shop = = 1 ) )
{
self . missionbrief = 4 ;
menu = ShopString ( ) ;
centerprint ( self , menu ) ;
self . currentmenu = " shop_list " ;
if ( self . current_slot ! = 0 & & self . current_slot ! = 2 )
self . current_slot = 1 ;
return ;
}
} ;
void ( ) CharacterSheet =
{
local string x ;
local float qq ;
local float ratio ;
local float r1 ;
local float r2 ;
stuffcmd ( self , " toggleconsole \n " ) ;
sprint ( self , PRINT_HIGH , " \n \n \n \n ** INFO ** \n " ) ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Class <20> " ) ;
if ( self . class = = 1 )
sprint ( self , 2 , " Medic " ) ;
if ( self . class = = 2 )
sprint ( self , 2 , " Assassin " ) ;
if ( self . class = = 3 )
sprint ( self , 2 , " Soldier " ) ;
if ( self . class = = 4 )
sprint ( self , 2 , " Scientist " ) ;
sprint ( self , PRINT_HIGH , " \n <EFBFBD> Team <20> " ) ;
if ( self . team = = 1 )
sprint ( self , 2 , " Rangers \n " ) ;
if ( self . team = = 2 )
sprint ( self , 2 , " Raiders \n " ) ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Score <20> " ) ;
2009-11-06 04:34:08 +00:00
r1 = ( self . score ) ;
2009-11-05 03:40:39 +00:00
2009-11-06 04:34:08 +00:00
x = ftos ( r1 ) ;
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , x ) ;
2009-11-07 03:43:48 +00:00
2009-11-05 03:40:39 +00:00
sprint ( self , PRINT_HIGH , " \n <EFBFBD> Speed <20> " ) ;
x = ftos ( self . maxspeed ) ;
sprint ( self , 2 , x ) ;
sprint ( self , PRINT_HIGH , " /300 \n " ) ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Money <20> " ) ;
x = ftos ( self . ammo_shells ) ;
sprint ( self , 2 , x ) ;
sprint ( self , PRINT_HIGH , " $ \n " ) ;
/*
sprint ( self , PRINT_HIGH , " \n <EFBFBD> Armor <20> " ) ;
x = GetArmorName ( ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " ( " ) ;
x = ftos ( self . armor_weight ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " ) \n " ) ;
*/
sprint ( self , PRINT_HIGH , " <EFBFBD> Protective<EFBFBD> " ) ;
x = GetProtectName ( ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " \n " ) ;
/*
sprint ( self , PRINT_HIGH , " <EFBFBD> Chem <20> " ) ;
x = GetChemName ( ) ;
sprint ( self , 2 , x ) ;
x = ftos ( self . chemcount ) ;
sprint ( self , 2 , " [ " ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " ] " ) ;
sprint ( self , 2 , " \n " ) ;
*/
sprint ( self , PRINT_HIGH , " <EFBFBD> Gadget <20> " ) ;
x = GetEquipmentName ( ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " \n " ) ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Perk <20> " ) ;
x = GetPerkName ( ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " \n " ) ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Trait <20> " ) ;
x = GetTraitName ( ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " \n " ) ;
/*
sprint ( self , PRINT_HIGH , " <EFBFBD> Weapon 1 <20> " ) ;
x = GetWeaponName ( self , self . slot1 ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " ( " ) ;
x = ftos ( self . slot1_weight ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " ) ( " ) ;
sprint ( self , 2 , self . ammotype1 ) ;
sprint ( self , 2 , " ) \n " ) ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Weapon 2 <20> " ) ;
x = GetWeaponName ( self , self . slot2 ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " ( " ) ;
x = ftos ( self . slot2_weight ) ;
sprint ( self , 2 , x ) ;
sprint ( self , 2 , " ) ( " ) ;
sprint ( self , 2 , self . ammotype2 ) ;
sprint ( self , 2 , " ) \n \n " ) ;
*/
qq = weightx ( ) ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Weight <20> " ) ;
x = ftos ( qq ) ;
sprint ( self , 2 , x ) ;
qq = self . max_weight ;
sprint ( self , PRINT_HIGH , " / " ) ;
x = ftos ( qq ) ;
sprint ( self , 2 , x ) ;
sprint ( self , PRINT_HIGH , " \n " ) ;
return ;
} ;
void ( ) UseEquipment =
{
if ( self . equipment = = 0 )
{
centerprint ( self , " <EFBFBD> <EFBFBD> no extra equipment <20> <> \n " ) ;
return ;
}
if ( self . equipment = = 1 )
{
centerprint ( self , " <EFBFBD> <EFBFBD> medic's bag <20> <> \n lets you carry more stimpacks \n " ) ;
return ;
}
if ( self . equipment = = 4 )
{
centerprint ( self , " <EFBFBD> <EFBFBD> belt pouch <20> <> \n gives you room for two extra grenades \n " ) ;
return ;
}
if ( self . equipment = = 5 )
{
centerprint ( self , " <EFBFBD> <EFBFBD> backpack <20> <> \n lets you carry more ammunition \n " ) ;
return ;
}
if ( self . equipment = = 6 )
{
centerprint ( self , " <EFBFBD> <EFBFBD> toolkit mark ii <20> <> \n build, defuse and open doors faster \n " ) ;
return ;
}
/*
if ( self . equipment = = 7 & & self . equipment_slot = = 0 )
{
sprint ( self , PRINT_HIGH , " climbing gear in place. \n " ) ;
sound ( self , CHAN_BODY , " misc/item2.wav " , 1 , ATTN_NORM ) ;
self . maxspeed = 100 ;
self . velocity_z = 0 ;
self . equipment_state = 1 ;
}
if ( self . equipment = = 7 & & self . equipment_state = = 1 )
{
sprint ( self , PRINT_HIGH , " climbing gear retrieved. \n " ) ;
sound ( self , CHAN_BODY , " misc/item2.wav " , 1 , ATTN_NORM ) ;
self . grab = 0 ;
self . equipment_state = 0 ;
return ;
}
*/
if ( self . equipment = = 8 )
{
centerprint ( self , " <EFBFBD> <EFBFBD> enhanced battery <20> <> \n allows longer cloaking \n " ) ;
return ;
}
if ( self . equipment = = 9 )
2006-01-01 21:33:21 +00:00
{
Sneak ( ) ;
return ;
}
} ;
2009-11-05 03:40:39 +00:00
void ( vector s_aim , float dam , float tmp , float ran ) W_FireBuckshotSpread1 =
{
local vector source ;
local vector targ ;
local vector org ;
local float zdif ;
local float ydif ;
local float xdif ;
local float is_headshot ;
makevectors ( self . v_angle ) ;
if ( self . position = = 0 )
source = ( self . origin + ' 0 0 20 ' ) ;
if ( self . position = = 1 )
source = ( self . origin + ' 0 0 4 ' ) ;
if ( self . position = = 2 )
source = ( self . origin + ' 0 0 - 12 ' ) ;
targ = ( ( ( ( ( ( s_aim + ( ( v_right * random ( ) ) * tmp ) ) - ( ( v_right * random ( ) ) * tmp ) ) + ( ( v_up * random ( ) ) * tmp ) ) - ( ( v_up * random ( ) ) * tmp ) ) + ( ( ( v_up * random ( ) ) * tmp ) * 0.5 ) ) + ( v_forward * ran ) ) ;
traceline ( source , targ , FALSE , self ) ;
if ( ( trace_fraction = = 1 ) )
{
return ;
}
org = ( trace_endpos - ( v_forward * 2 ) ) ;
if ( trace_ent . takedamage )
{
dam = ( ( random ( ) * dam ) + dam ) ;
dam = ( dam * ( 1 - trace_fraction ) ) ;
if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & ( trace_ent . islot3 = = 0 | | self . critical = = 3 ) )
SpawnBlood ( org , 1 ) ;
else if ( trace_ent . solid ! = SOLID_BSP & & trace_ent . classname ! = " car " & & trace_ent . islot3 > 0 )
SpawnNonBlood ( org , 1 ) ;
else if ( trace_ent . solid = = SOLID_BSP | | trace_ent . classname = = " car " )
SpawnWood ( trace_ent , org , 1 ) ;
zdif = ( org_z - trace_ent . origin_z ) ;
ydif = ( org_y - trace_ent . origin_y ) ;
xdif = ( org_x - trace_ent . origin_x ) ;
is_headshot = 0 ;
if ( ( ( ydif > = CONTENT_SLIME ) & & ( ydif < = WEAPON_SPIKES ) ) )
{
is_headshot = 1 ;
}
if ( ( ( xdif > = CONTENT_SLIME ) & & ( xdif < = WEAPON_SPIKES ) ) )
{
is_headshot = 1 ;
}
if ( ( ( is_headshot = = 1 ) & & ( zdif > = ( ( trace_ent . size_z / 2 ) * 0.8 ) ) ) )
{
if ( self . attack > 2 )
dam = ( dam * 0.4 ) ;
self . critical = 3 ;
}
dam = dam + random ( ) * dam ;
T_Damage ( trace_ent , self , self , dam ) ;
loud_noise ( 5 ) ; //hit flesh
self . critical = 0 ;
}
else
{
loud_noise ( 15 ) ; //richochet
bullet_hole ( org ) ;
}
} ;
void ( float rec , float number , float dam , float spread , float ran , float auto , string snd ) W_FireShotgun =
{
local vector dir ;
local vector p_aim ;
local float var1 ;
local float var2 ;
local float var3 ;
local float var4 ;
local float weap ;
2009-11-13 05:05:32 +00:00
if ( getperk ( 5 ) )
2009-11-05 03:40:39 +00:00
{
if ( self . steadyaim = = 0 )
2009-11-13 05:47:13 +00:00
dam = dam + self . skill_doctor / 3 ;
2009-11-05 03:40:39 +00:00
}
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
2009-11-11 07:31:51 +00:00
var1 = ( ( random ( ) * 12 ) * ( self . recoil ) ) ;
var2 = ( ( random ( ) * 12 ) * ( self . recoil ) ) ;
var3 = ( ( random ( ) * 12 ) * ( self . recoil ) ) ;
var4 = ( ( random ( ) * 12 ) * ( self . recoil ) ) ;
2009-11-05 03:40:39 +00:00
if ( self . position = = 0 )
player_single1 ( ) ;
else
player_single1_s ( ) ;
if ( self . steadyaim = = 0 )
{
var1 = ( 8 + ( random ( ) * 6 ) * ( self . recoil ) ) ;
var2 = ( 8 + ( random ( ) * 6 ) * ( self . recoil ) ) ;
var3 = ( 8 + ( random ( ) * 6 ) * ( self . recoil ) ) ;
var4 = ( 8 + ( random ( ) * 6 ) * ( self . recoil ) ) ;
}
stuffcmd ( self , " +lookup \n " ) ;
stuffcmd ( self , " wait \n " ) ;
stuffcmd ( self , " -lookup \n " ) ;
sound ( self , CHAN_WEAPON , snd , 1.5 , ATTN_NORM ) ;
//only silenced weapons do not break stealth
if ( self . sneak > 0 )
{
self . equipment_slot = 0 ;
sprint ( self , PRINT_HIGH , " <EFBFBD> Uncloaked <20> \n " ) ;
setmodel ( self , " progs/guy.mdl " ) ;
self . sneak = 0 ;
sound ( self , CHAN_BODY , " items/inv1.wav " , 1 , ATTN_NORM ) ;
}
loud_noise ( 40 ) ;
p_aim = ( ( ( ( ( self . origin + ' 0 0 20 ' ) + ( v_right * var1 ) ) - ( v_right * var2 ) ) + ( v_up * var3 ) ) - ( v_up * var4 ) ) ;
msg_entity = self ;
WriteByte ( MSG_ONE , SVC_BIGKICK ) ;
DropAmmo ( ) ;
self . attack = ( self . attack + 1 ) ;
self . recoil = ( self . recoil + 8 * rec ) ;
if ( self . recoil > = 30 )
self . recoil = 30 ;
if ( auto = = 0 )
{
self . attack_finished = ( time + 0.5 ) ;
stuffcmd ( self , " -attack \n " ) ;
}
if ( auto = = 1 )
{
self . attack_finished = ( time + 0.25 ) ;
stuffcmd ( self , " -attack \n " ) ;
}
if ( auto = = 2 )
self . attack_finished = ( time + 0.2 ) ;
dir = aim ( self , 10000 ) ;
if ( ( number = = MULTICAST_PVS_R ) )
{
W_FireBuckshotSpread1 ( p_aim , dam , 30 , ran ) ;
W_FireBuckshotSpread1 ( ( p_aim + ( v_right * spread ) ) , dam , 30 , ran ) ;
W_FireBuckshotSpread1 ( ( p_aim - ( v_right * spread ) ) , dam , 30 , ran ) ;
W_FireBuckshotSpread1 ( ( p_aim + ( v_up * spread ) ) , dam , 30 , ran ) ;
W_FireBuckshotSpread1 ( ( p_aim - ( v_up * spread ) ) , dam , 30 , ran ) ;
}
else
{
if ( ( number = = AS_MELEE ) )
{
W_FireBuckshotSpread1 ( p_aim , dam , spread , ran ) ;
W_FireBuckshotSpread1 ( p_aim , dam , spread , ran ) ;
W_FireBuckshotSpread1 ( p_aim , dam , spread , ran ) ;
}
}
} ;
void ( vector org ) spawn_tracer =
{
local entity tracer ;
local float x ;
local string y ;
x = 0 ;
tracer = spawn ( ) ;
setmodel ( tracer , " progs/handgren.mdl " ) ;
setorigin ( tracer , org ) ;
setsize ( tracer , ' 0 0 0 ' , ' 0 0 0 ' ) ;
tracer . think = SUB_Remove ;
tracer . nextthink = time + 2 ;
if ( pointcontents ( org ) = = CONTENT_SOLID )
x = x + 1 ;
y = ftos ( x ) ;
bprint ( 2 , y ) ;
bprint ( 2 , " \n " ) ;
} ;
//the alien blaster
void ( ) FireAlienBlaster =
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
local float tmp ;
DropAmmo ( ) ;
self . recoil = self . recoil + 8 ;
msg_entity = self ;
WriteByte ( MSG_ONE , SVC_SMALLKICK ) ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
newmis = spawn ( ) ;
newmis . owner = self ;
newmis . movetype = MOVETYPE_FLYMISSILE ;
newmis . solid = SOLID_BBOX ;
newmis . effects = EF_DIMLIGHT ;
2006-01-01 21:33:21 +00:00
makevectors ( self . v_angle ) ;
2009-11-05 03:40:39 +00:00
newmis . velocity = aim ( self , 3000 ) ;
newmis . velocity = ( newmis . velocity * 3000 ) ;
newmis . angles = vectoangles ( newmis . velocity ) ;
2006-01-02 03:58:02 +00:00
2009-11-05 03:40:39 +00:00
newmis . nextthink = ( time + IDLE3A ) ;
newmis . think = SUB_Remove ;
setmodel ( newmis , " progs/plasma.mdl " ) ;
tmp = ( ( 30 + self . velocity_y ) + self . velocity_x ) ;
2006-01-02 00:14:21 +00:00
2006-01-02 03:58:02 +00:00
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
newmis . velocity = aim ( self , 1700 ) ;
newmis . velocity = newmis . velocity * 1700 ;
newmis . angles = vectoangles ( newmis . velocity ) ;
newmis . nextthink = time + 1.4 ;
sound ( self , CHAN_WEAPON , " weapons/blaster.wav " , WEAPON_SHOTGUN , ATTN_NORM ) ;
newmis . touch = PlasmaBolt ;
setmodel ( newmis , " progs/ray.mdl " ) ;
tmp = 90 + self . velocity_y + self . velocity_x ;
}
setsize ( newmis , ' 0 0 0 ' , ' 0 0 0 ' ) ;
setorigin ( newmis , self . origin + ( v_right * WEAPON_BIG ) + ( v_forward * WEAPON_ROCKET ) + ' 0 0 20 ' ) ;
newmis . velocity = newmis . velocity + ( v_right * random ( ) * tmp ) - ( v_right * random ( ) * tmp ) + ( v_up * random ( ) * tmp ) - ( v_up * random ( ) * tmp ) ;
self . attack_finished = time + 0.5 ;
} ;
void ( ) radio_think =
{
self . cnt = self . cnt - 1 ;
setorigin ( self , ( self . owner . origin + ' 0 0 48 ' ) ) ;
self . nextthink = ( time + 0.01 ) ;
if ( self . cnt < = 0 )
remove ( self ) ;
} ;
void ( entity jeb , float length ) spawn_excla =
{
local entity hologram ;
hologram = spawn ( ) ;
hologram . movetype = MOVETYPE_NONE ;
hologram . solid = SOLID_NOT ;
hologram . owner = jeb ;
setmodel ( hologram , " progs/radio.spr " ) ;
2009-11-15 02:36:24 +00:00
setorigin ( hologram , jeb . origin + ' 0 0 48 ' ) ;
setsize ( hologram , VEC_ORIGIN , VEC_ORIGIN ) ;
hologram . angles = jeb . angles ;
hologram . colormap = jeb . colormap ;
hologram . cnt = 100 * length ;
hologram . think = radio_think ;
hologram . nextthink = ( time + 0.01 ) ;
} ;
void ( entity jeb , float length ) spawn_stop =
{
local entity hologram ;
hologram = spawn ( ) ;
hologram . movetype = MOVETYPE_NONE ;
hologram . solid = SOLID_NOT ;
hologram . owner = jeb ;
setmodel ( hologram , " progs/stop.spr " ) ;
setorigin ( hologram , jeb . origin + ' 0 0 48 ' ) ;
2009-11-05 03:40:39 +00:00
setsize ( hologram , VEC_ORIGIN , VEC_ORIGIN ) ;
hologram . angles = jeb . angles ;
hologram . colormap = jeb . colormap ;
hologram . cnt = 100 * length ;
hologram . think = radio_think ;
hologram . nextthink = ( time + 0.01 ) ;
} ;
2009-11-16 17:42:41 +00:00
2009-11-05 03:40:39 +00:00
void ( string color ) ZoomInLarge =
{
if ( self . attack_finished > time )
return ;
self . weaponmodel = " progs/v_scope1.mdl " ;
self . zoom = 1 ;
stuffcmd ( self , " fov 30 \n " ) ;
if ( color = = " red " )
stuffcmd ( self , " v_cshift 100 0 0 50 \n " ) ;
2009-11-11 07:31:51 +00:00
if ( color = = " pink " )
stuffcmd ( self , " v_cshift 100 0 25 50 \n " ) ;
2009-11-05 03:40:39 +00:00
if ( color = = " blue " )
stuffcmd ( self , " v_cshift 0 0 100 75 \n " ) ;
if ( color = = " green " )
stuffcmd ( self , " v_cshift 0 100 0 100 \n " ) ;
if ( color = = " yellow " )
stuffcmd ( self , " v_cshift 100 100 0 50 \n " ) ;
if ( color = = " purple " )
stuffcmd ( self , " v_cshift 100 0 100 100 \n " ) ;
} ;
void ( string color ) ZoomInSmall =
{
if ( self . attack_finished > time )
return ;
self . weaponmodel = " progs/v_scope2.mdl " ;
self . zoom = 1 ;
stuffcmd ( self , " fov 60 \n " ) ;
if ( color = = " red " )
stuffcmd ( self , " v_cshift 100 0 0 50 \n " ) ;
2009-11-11 07:31:51 +00:00
if ( color = = " pink " )
stuffcmd ( self , " v_cshift 100 0 25 50 \n " ) ;
2009-11-05 03:40:39 +00:00
if ( color = = " blue " )
stuffcmd ( self , " v_cshift 0 0 100 75 \n " ) ;
if ( color = = " green " )
stuffcmd ( self , " v_cshift 0 100 0 100 \n " ) ;
if ( color = = " yellow " )
stuffcmd ( self , " v_cshift 100 100 0 50 \n " ) ;
if ( color = = " purple " )
stuffcmd ( self , " v_cshift 100 0 100 100 \n " ) ;
} ;
void ( ) ZoomOut =
{
SetWeaponModel ( ) ;
self . zoom = 0 ;
stuffcmd ( self , " fov 90 \n " ) ;
stuffcmd ( self , " v_cshift 0 0 0 0 \n " ) ;
} ;
void ( ) ZoomIn =
{
local float weap ;
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
if ( self . zoom > 0 )
{
ZoomOut ( ) ;
2006-01-01 21:33:21 +00:00
return ;
}
2009-11-05 03:40:39 +00:00
if ( weap = = IID_WP_DKS1 )
ZoomInLarge ( " purple " ) ;
if ( weap = = IID_WP_ACR )
ZoomInLarge ( " pink " ) ;
2009-11-11 07:31:51 +00:00
if ( weap = = IID_WP_AK112_M )
ZoomInSmall ( " pink " ) ;
2009-11-05 03:40:39 +00:00
if ( weap = = IID_WP_DKS1_S )
ZoomInLarge ( " purple " ) ;
if ( weap = = IID_WP_FNFAL )
ZoomInSmall ( " red " ) ;
if ( weap = = IID_WP_G11 )
ZoomInSmall ( " blue " ) ;
if ( weap = = IID_WP_MOONLIGHT )
ZoomInSmall ( " green " ) ;
if ( weap = = IID_WP_PIPERIFLE_SCOPE )
ZoomInLarge ( " green " ) ;
if ( weap = = IID_WP_PIPERIFLE_SCOPE_R )
ZoomInLarge ( " green " ) ;
if ( weap = = IID_WP_PIPERIFLE_SCOPE_S )
ZoomInLarge ( " green " ) ;
if ( weap = = IID_WP_PIPERIFLE_SCOPE_S_R )
ZoomInLarge ( " green " ) ;
} ;
void ( ) HostageReport =
{
local float acount , dcount ;
local entity te ;
local string ah , dh , rh ;
local vector dir , org ;
hostages = 0 ;
dead_hostage = 0 ;
org = self . origin ;
te = find ( world , classname , " rhostage " ) ;
while ( te )
{
if ( te . health > 0 )
acount = acount + 1 ;
if ( te . health < = 0 )
dcount = dcount + 1 ;
te = find ( te , classname , " rhostage " ) ;
}
te = find ( world , classname , " rhostage " ) ;
while ( te )
{
if ( te . health > 0 )
{
dir = normalize ( te . origin - self . origin ) ;
traceline ( self . origin , self . origin + dir * 2000 , FALSE , self ) ;
WriteByte ( MSG_MULTICAST , SVC_TEMPENTITY ) ;
WriteByte ( MSG_MULTICAST , TE_LIGHTNING2 ) ;
WriteEntity ( MSG_MULTICAST , self ) ;
WriteCoord ( MSG_MULTICAST , org_x ) ;
WriteCoord ( MSG_MULTICAST , org_y ) ;
WriteCoord ( MSG_MULTICAST , org_z ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_x ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_y ) ;
WriteCoord ( MSG_MULTICAST , trace_endpos_z ) ;
multicast ( org , MULTICAST_PHS ) ;
}
te = find ( te , classname , " rhostage " ) ;
}
hostages = acount ;
dead_hostage = dcount ;
ah = ftos ( acount ) ;
dh = ftos ( dcount ) ;
rh = ftos ( rescue ) ;
sprint ( self , PRINT_HIGH , " *** HOSTAGE REPORT *** \n " ) ;
sprint ( self , PRINT_HIGH , " rescued: " ) ;
sprint ( self , PRINT_HIGH , rh ) ;
sprint ( self , PRINT_HIGH , " \n " ) ;
sprint ( self , PRINT_HIGH , " alive: " ) ;
sprint ( self , PRINT_HIGH , ah ) ;
sprint ( self , PRINT_HIGH , " \n " ) ;
sprint ( self , PRINT_HIGH , " dead: " ) ;
sprint ( self , PRINT_HIGH , dh ) ;
sprint ( self , PRINT_HIGH , " \n " ) ;
rh = ftos ( supplies ) ;
sprint ( self , PRINT_HIGH , " *** SUPPLY REPORT *** \n " ) ;
sprint ( self , PRINT_HIGH , " supplies: " ) ;
sprint ( self , PRINT_HIGH , rh ) ;
sprint ( self , PRINT_HIGH , " \n " ) ;
} ;
void ( ) clone_think =
{
self . model = self . owner . model ;
self . frame = self . owner . frame ;
self . nextthink = time + 0.01 ;
} ;
void ( ) AddClone =
{
local entity clone ;
clone = spawn ( ) ;
setmodel ( clone , " progs/guy.mdl " ) ;
clone . owner = self ;
clone . movetype = MOVETYPE_BOUNCE ;
clone . solid = SOLID_NOT ;
clone . touch = SUB_Null ;
clone . owner = self ;
clone . think = clone_think ;
setsize ( clone , ' - 16 - 16 - 24 ' , ' 16 16 32 ' ) ;
setorigin ( clone , self . origin ) ;
clone . nextthink = time + 0.01 ;
sprint ( self , 2 , " clone added. \n " ) ;
self . health = 9000 ;
} ;
float ( float x ) find_percent =
{
if ( x = = 1 )
return world . map_ent1_percent ;
if ( x = = 2 )
return world . map_ent2_percent ;
if ( x = = 3 )
return world . map_ent3_percent ;
} ;
float ( vector org ) light_level =
{
local vector light ;
local float brightness ;
light = getlight ( self . origin ) ;
2009-11-15 02:36:24 +00:00
//brightness = light_x*0.3 + light_y*0.51 + light_z*0.2;
brightness = light_x + light_y + light_z ;
2009-11-05 03:40:39 +00:00
return brightness ;
} ;
void ( ) show_light_level =
{
local float x ;
local string y ;
x = light_level ( self . origin ) ;
y = ftos ( x ) ;
bprint ( 2 , " light level: " ) ;
bprint ( 2 , y ) ;
bprint ( 2 , " \n " ) ;
2009-11-15 02:36:24 +00:00
x = self . waterlevel ;
y = ftos ( x ) ;
bprint ( 2 , " water level: " ) ;
bprint ( 2 , y ) ;
bprint ( 2 , " \n " ) ;
2009-11-05 03:40:39 +00:00
} ;
void ( ) AttachSilencer =
{
local float weap , x , y ;
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
y = SlotOfItem ( self , IID_EQUIP_SILENCER ) ;
if ( weap = = IID_WP_USP )
{
sprint ( self , 2 , " silencer attached. \n " ) ;
DecreaseDestroySlot ( y ) ;
if ( self . current_slot = = 1 )
{
x = ToStatus ( self . islot1 ) ;
self . islot1 = 0 ;
SetItemSlot ( self , 1 , SlotVal ( IID_WP_USP_S , x ) ) ;
return ;
}
if ( self . current_slot = = 2 )
{
x = ToStatus ( self . islot2 ) ;
self . islot2 = 0 ;
SetItemSlot ( self , 2 , SlotVal ( IID_WP_USP_S , x ) ) ;
return ;
}
}
else if ( weap = = IID_WP_DKS1 )
{
sprint ( self , 2 , " silencer attached. \n " ) ;
DecreaseDestroySlot ( y ) ;
if ( self . current_slot = = 1 )
{
x = ToStatus ( self . islot1 ) ;
self . islot1 = 0 ;
SetItemSlot ( self , 1 , SlotVal ( IID_WP_DKS1_S , x ) ) ;
return ;
}
if ( self . current_slot = = 2 )
{
x = ToStatus ( self . islot2 ) ;
self . islot2 = 0 ;
SetItemSlot ( self , 2 , SlotVal ( IID_WP_DKS1_S , x ) ) ;
return ;
}
}
else if ( weap = = IID_WP_GLOCK )
{
sprint ( self , 2 , " silencer attached. \n " ) ;
DecreaseDestroySlot ( y ) ;
if ( self . current_slot = = 1 )
{
x = ToStatus ( self . islot1 ) ;
self . islot1 = 0 ;
SetItemSlot ( self , 1 , SlotVal ( IID_WP_GLOCK_S , x ) ) ;
return ;
}
if ( self . current_slot = = 2 )
{
x = ToStatus ( self . islot2 ) ;
self . islot2 = 0 ;
SetItemSlot ( self , 2 , SlotVal ( IID_WP_GLOCK_S , x ) ) ;
return ;
}
}
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_MP9 )
2009-11-05 03:40:39 +00:00
{
sprint ( self , 2 , " silencer attached. \n " ) ;
DecreaseDestroySlot ( y ) ;
if ( self . current_slot = = 1 )
{
x = ToStatus ( self . islot1 ) ;
self . islot1 = 0 ;
2009-11-09 04:48:58 +00:00
SetItemSlot ( self , 1 , SlotVal ( IID_WP_MP9_S , x ) ) ;
2009-11-05 03:40:39 +00:00
return ;
}
if ( self . current_slot = = 2 )
{
x = ToStatus ( self . islot2 ) ;
self . islot2 = 0 ;
2009-11-09 04:48:58 +00:00
SetItemSlot ( self , 2 , SlotVal ( IID_WP_MP9_S , x ) ) ;
2009-11-05 03:40:39 +00:00
return ;
}
}
2009-11-09 04:48:58 +00:00
else if ( weap = = IID_WP_GREASEGUN )
2009-11-05 03:40:39 +00:00
{
sprint ( self , 2 , " silencer attached. \n " ) ;
DecreaseDestroySlot ( y ) ;
if ( self . current_slot = = 1 )
{
x = ToStatus ( self . islot1 ) ;
self . islot1 = 0 ;
2009-11-09 04:48:58 +00:00
SetItemSlot ( self , 1 , SlotVal ( IID_WP_GREASEGUN_S , x ) ) ;
2009-11-05 03:40:39 +00:00
return ;
}
if ( self . current_slot = = 2 )
{
x = ToStatus ( self . islot2 ) ;
self . islot2 = 0 ;
2009-11-09 04:48:58 +00:00
SetItemSlot ( self , 2 , SlotVal ( IID_WP_GREASEGUN_S , x ) ) ;
2009-11-05 03:40:39 +00:00
return ;
}
}
else if ( weap = = IID_WP_PIPERIFLE )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , " silencer attached. \n " ) ;
DecreaseDestroySlot ( y ) ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . current_slot = = 1 )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
x = ToStatus ( self . islot1 ) ;
self . islot1 = 0 ;
SetItemSlot ( self , 1 , SlotVal ( IID_WP_PIPERIFLE_S , x ) ) ;
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . current_slot = = 2 )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
x = ToStatus ( self . islot2 ) ;
self . islot2 = 0 ;
SetItemSlot ( self , 2 , SlotVal ( IID_WP_PIPERIFLE_S , x ) ) ;
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
}
else if ( weap = = IID_WP_PIPERIFLE_R )
{
sprint ( self , 2 , " silencer attached. \n " ) ;
DecreaseDestroySlot ( y ) ;
if ( self . current_slot = = 1 )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
x = ToStatus ( self . islot1 ) ;
self . islot1 = 0 ;
SetItemSlot ( self , 1 , SlotVal ( IID_WP_PIPERIFLE_S_R , x ) ) ;
return ;
}
if ( self . current_slot = = 2 )
{
x = ToStatus ( self . islot2 ) ;
self . islot2 = 0 ;
SetItemSlot ( self , 2 , SlotVal ( IID_WP_PIPERIFLE_S_R , x ) ) ;
return ;
}
}
else if ( weap = = IID_WP_PIPERIFLE_SCOPE )
{
sprint ( self , 2 , " silencer attached. \n " ) ;
DecreaseDestroySlot ( y ) ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . current_slot = = 1 )
{
x = ToStatus ( self . islot1 ) ;
self . islot1 = 0 ;
SetItemSlot ( self , 1 , SlotVal ( IID_WP_PIPERIFLE_SCOPE_S , x ) ) ;
return ;
}
if ( self . current_slot = = 2 )
{
x = ToStatus ( self . islot2 ) ;
self . islot2 = 0 ;
SetItemSlot ( self , 2 , SlotVal ( IID_WP_PIPERIFLE_SCOPE_S , x ) ) ;
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
}
else if ( weap = = IID_WP_PIPERIFLE_SCOPE_R )
{
sprint ( self , 2 , " silencer attached. \n " ) ;
DecreaseDestroySlot ( y ) ;
2006-01-12 01:55:21 +00:00
2009-11-05 03:40:39 +00:00
if ( self . current_slot = = 1 )
{
x = ToStatus ( self . islot1 ) ;
self . islot1 = 0 ;
SetItemSlot ( self , 1 , SlotVal ( IID_WP_PIPERIFLE_SCOPE_S_R , x ) ) ;
return ;
}
if ( self . current_slot = = 2 )
{
x = ToStatus ( self . islot2 ) ;
self . islot2 = 0 ;
SetItemSlot ( self , 2 , SlotVal ( IID_WP_PIPERIFLE_SCOPE_S_R , x ) ) ;
return ;
}
2006-01-01 21:33:21 +00:00
}
else
{
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , " cannot be silenced. \n " ) ;
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
2006-01-01 21:33:21 +00:00
} ;
2009-11-05 03:40:39 +00:00
void ( ) AttachExtender =
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
local float weap ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
if ( weap = = IID_WP_NEEDLER | | weap = = IID_WP_MOONLIGHT )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , " that weapon already has a silencer attached \n " ) ;
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
if ( weap = = IID_WP_ALIENBLASTER )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , " how exactly do you extend that??? \n " ) ;
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . silencer = = weap )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( self , 2 , " that weapon already has a silencer attached \n " ) ;
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
else if ( ToIID ( self . islot4 ) = = IID_EQUIP_EXTENDER & & self . extender = = 0 )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
self . extender = weap ;
sprint ( self , 2 , " extender attached. \n " ) ;
self . islot4 = 0 ;
self . attack_finished = time + 1 ;
self . rtime = time + 1 ;
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
/*
else if ( ToIID ( self . islot4 ) = = IID_EQUIP_EXTENDER & & self . extender > 0 )
{
self . extender = 0 ;
sprint ( self , 2 , " removing extender... \n " ) ;
self . attack_finished = time + 1 ;
return ;
} */
} ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
void ( float iid ) RemoveSilencer =
{
if ( ToIID ( self . islot4 ) = = 0 )
{
SetItemSlot ( self , 4 , SlotVal ( IID_EQUIP_SILENCER , 1 ) ) ;
sprint ( self , 2 , " removing silencer... \n " ) ;
self . attack_finished = time + 1 ;
self . rtime = time + 1 ;
self . silencer = 0 ;
}
else if ( ToIID ( self . islot4 ) > 0 )
{
sprint ( self , 2 , " can't remove silencer, equipment slot is full \n " ) ;
return ;
}
} ;
2006-01-01 21:33:21 +00:00
2009-11-05 03:40:39 +00:00
void ( float iid ) RemoveExtender =
{
if ( ToIID ( self . islot4 ) = = 0 )
{
SetItemSlot ( self , 4 , SlotVal ( IID_EQUIP_EXTENDER , 1 ) ) ;
sprint ( self , 2 , " removing extender... \n " ) ;
self . attack_finished = time + 1 ;
self . rtime = time + 1 ;
self . extender = 0 ;
}
else if ( ToIID ( self . islot4 ) > 0 )
{
sprint ( self , 2 , " can't remove extender, equipment slot is full \n " ) ;
return ;
}
} ;
2006-01-02 00:14:21 +00:00
2009-11-05 03:40:39 +00:00
void ( string snd , float type ) function_radio =
{
local entity te ;
local vector dir ;
local vector vec ;
local float dot1 ;
local float dot2 ;
local float dot3 ;
local float dot4 ;
local float dot5 ;
local float dot6 ;
2006-01-02 00:14:21 +00:00
2009-11-05 03:40:39 +00:00
if ( ! self . attack_finished )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
return ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
self . attack_finished = ( time + 2 ) ;
spawn_excla ( self , 2 ) ;
te = find ( world , classname , " player " ) ;
while ( te )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
if ( te . team = = self . team )
2006-01-01 21:33:21 +00:00
{
2009-11-05 03:40:39 +00:00
sprint ( te , 2 , " radio " ) ;
makevectors ( te . angles ) ;
vec = normalize ( ( te . origin - self . origin ) ) ;
dot1 = ( ( vec * v_forward ) * 1 ) ;
dot2 = ( ( vec * v_right ) * CONTENT_EMPTY ) ;
dot3 = ( ( vec * v_right ) * 1 ) ;
dot4 = ( ( vec * v_forward ) * CONTENT_EMPTY ) ;
dot5 = ( ( vec * v_up ) * 1 ) ;
dot6 = ( ( vec * v_up ) * CONTENT_EMPTY ) ;
if ( ( te = = self ) )
{
sprint ( te , 2 , " (talk) " ) ;
}
else
{
if ( ( dot1 > 0.3 ) )
{
sprint ( te , 2 , " (ahead) " ) ;
}
else
{
if ( ( dot2 > 0.3 ) )
{
sprint ( te , 2 , " (left) " ) ;
}
else
{
if ( ( dot3 > 0.3 ) )
{
sprint ( te , 2 , " (right) " ) ;
}
else
{
if ( ( dot4 > 0.3 ) )
{
sprint ( te , 2 , " (behind) " ) ;
}
else
{
if ( ( dot5 > 0.3 ) )
{
sprint ( te , 2 , " (above) " ) ;
}
else
{
if ( ( dot6 > 0.3 ) )
{
sprint ( te , 2 , " (below) " ) ;
}
else
{
sprint ( te , 2 , " (???) " ) ;
}
}
}
}
}
}
}
sprint ( te , 2 , self . netname ) ;
if ( ( type = = 1 ) )
{
sprint ( te , 2 , " : affirmative " ) ;
}
else
{
if ( ( type = = 2 ) )
{
sprint ( te , 2 , " : negative " ) ;
}
else
{
if ( ( type = = 3 ) )
{
sprint ( te , 2 , " : lets go " ) ;
}
else
{
if ( ( type = = 4 ) )
{
sprint ( te , 2 , " : team, take cover " ) ;
}
else
{
if ( ( type = = 5 ) )
{
sprint ( te , 2 , " : team, get in formation! " ) ;
}
else
{
if ( ( type = = 6 ) )
{
sprint ( te , 2 , " : need backup! " ) ;
}
else
{
if ( ( type = = 7 ) )
{
sprint ( te , 2 , " : hold this position " ) ;
}
else
{
if ( ( type = = 8 ) )
{
sprint ( te , 2 , " : check your six " ) ;
}
else
{
if ( ( type = = 9 ) )
{
sprint ( te , 2 , " : secure this area " ) ;
}
else
{
if ( ( type = = 10 ) )
{
sprint ( te , 2 , " : squad, use suppressing fire! " ) ;
}
else
{
if ( ( type = = 11 ) )
{
sprint ( te , 2 , " : team, silence " ) ;
}
}
}
}
}
}
}
}
}
}
}
sprint ( te , 2 , " \n " ) ;
sound ( self , CHAN_VOICE , snd , 0.55 , ATTN_IDLE ) ;
2006-01-01 21:33:21 +00:00
}
2009-11-05 03:40:39 +00:00
te = find ( te , classname , " player " ) ;
2006-01-01 21:33:21 +00:00
}
} ;
2009-11-05 03:40:39 +00:00
void ( ) GModelThink =
2006-01-05 01:56:45 +00:00
{
2009-11-05 03:40:39 +00:00
local float weap ;
2006-01-05 01:56:45 +00:00
2009-11-05 03:40:39 +00:00
weap = ToIID ( self . ( SlotField ( self . owner . current_slot ) ) ) ;
2006-01-05 01:56:45 +00:00
2009-11-05 03:40:39 +00:00
local float dot1 ;
if ( self . owner . health < = 0 )
2006-01-05 01:56:45 +00:00
{
remove ( self ) ;
return ;
}
2009-11-05 03:40:39 +00:00
if ( ! IsMelee ( weap ) )
2006-01-05 01:56:45 +00:00
{
2009-11-05 03:40:39 +00:00
setmodel ( self , " " ) ;
return ;
2006-01-05 01:56:45 +00:00
}
2009-11-05 03:40:39 +00:00
if ( self . owner . health > = 1 )
2006-01-05 01:56:45 +00:00
{
2009-11-05 03:40:39 +00:00
self . frame = self . owner . weaponframe ;
self . nextthink = ( time + 0.01 ) ;
2006-01-05 01:56:45 +00:00
}
2009-11-05 03:40:39 +00:00
self . nextthink = time + 0.01 ;
2006-01-05 01:56:45 +00:00
2009-11-05 03:40:39 +00:00
} ;
2006-01-05 01:56:45 +00:00
2009-11-05 03:40:39 +00:00
void ( ) SpawnGModel =
{
local entity hologram ;
local float weap ;
2006-01-05 01:56:45 +00:00
2009-11-05 03:40:39 +00:00
weap = ToIID ( self . ( SlotField ( self . current_slot ) ) ) ;
2006-01-05 01:56:45 +00:00
2009-11-05 03:40:39 +00:00
if ( ! self . wielded )
{
hologram = spawn ( ) ;
hologram . movetype = MOVETYPE_NONE ;
hologram . solid = SOLID_NOT ;
hologram . owner = self ;
if ( weap = = IID_WP_KNIFE )
setmodel ( hologram , " progs/g_knife.mdl " ) ;
if ( weap = = IID_WP_WRENCH )
setmodel ( hologram , " progs/g_wrench.mdl " ) ;
2009-11-09 04:48:58 +00:00
if ( weap = = IID_WP_SLEDGE )
2009-11-05 03:40:39 +00:00
setmodel ( hologram , " progs/g_axe.mdl " ) ;
if ( weap = = IID_WP_SPEAR )
setmodel ( hologram , " progs/g_spear.mdl " ) ;
setsize ( hologram , VEC_ORIGIN , VEC_ORIGIN ) ;
setattachment ( hologram , self , " " ) ;
hologram . nextthink = time + 0.01 ;
hologram . think = GModelThink ;
self . wielded = hologram ;
}
else
2006-01-05 01:56:45 +00:00
{
2009-11-05 03:40:39 +00:00
hologram = self . wielded ;
hologram . movetype = MOVETYPE_NONE ;
hologram . solid = SOLID_NOT ;
hologram . owner = self ;
if ( weap = = IID_WP_KNIFE )
setmodel ( hologram , " progs/g_knife.mdl " ) ;
if ( weap = = IID_WP_WRENCH )
setmodel ( hologram , " progs/g_wrench.mdl " ) ;
2009-11-09 04:48:58 +00:00
if ( weap = = IID_WP_SLEDGE )
2009-11-05 03:40:39 +00:00
setmodel ( hologram , " progs/g_axe.mdl " ) ;
if ( weap = = IID_WP_SPEAR )
setmodel ( hologram , " progs/g_spear.mdl " ) ;
setsize ( hologram , VEC_ORIGIN , VEC_ORIGIN ) ;
setattachment ( hologram , self , " " ) ;
hologram . nextthink = time + 0.01 ;
hologram . think = GModelThink ;
2006-01-05 01:56:45 +00:00
}
} ;