1 #using scripts\shared\ai_shared;
2 #using scripts\shared\clientfield_shared;
3 #using scripts\shared\postfx_shared;
4 #using scripts\shared\visionset_mgr_shared;
6 #insert scripts\shared\shared.gsh;
7 #insert scripts\shared\version.gsh;
8 #insert scripts\shared\ai\mechz.gsh;
9 #insert scripts\shared\archetype_shared\archetype_shared.gsh;
11 #precache( "client_fx", MECHZ_FT_FX_FILE );
12 #precache( "client_fx", MECHZ_FACEPLATE_OFF_FX_FILE );
13 #precache( "client_fx", MECHZ_POWERCAP_OFF_FX_FILE );
14 #precache( "client_fx", MECHZ_CLAW_OFF_FX_FILE );
15 #precache( "client_fx", MECHZ_115_GUN_MUZZLE_FLASH_FX_FILE );
16 #precache( "client_fx", MECHZ_RKNEE_ARMOR_OFF_FX_FILE );
17 #precache( "client_fx", MECHZ_LKNEE_ARMOR_OFF_FX_FILE );
18 #precache( "client_fx", MECHZ_RSHOULDER_AMOR_OFF_FX_FILE );
19 #precache( "client_fx", MECHZ_LSHOULDER_AMOR_OFF_FX_FILE );
20 #precache( "client_fx", MECHZ_HEADLIGHT_FX_FILE );
21 #precache( "client_fx", MECHZ_ARMOR_OFF_SPARKS_FX_FILE );
22 #precache( "client_fx", MECHZ_GUN_OFF_SPARKS_FX_FILE );
23 #precache( "client_fx", MECHZ_FOOTSTEP_FX_FILE );
24 #precache( "client_fx", MECHZ_HEADLAMP_DESTROYED_FX_FILE );
25 #precache( "client_fx", MECHZ_FOOTSTEP_STEAM_FX_FILE );
26 #precache( "client_fx", MECHZ_KNEE_ARMOR_OFF_SPARKS_FX_FILE );
27 #precache( "client_fx", MECHZ_POWERCORE_FX_FILE );
46 level._mechz_face = [];
74 #namespace MechzClientUtils;
81 self.headlight_fx = PlayFXOnTag( localClientNum, level._effect[
MECHZ_HEADLIGHT_FX ],
self,
"tag_headlamp_FX" );
82 self.headlamp_on =
true;
88 if ( IsDefined( mechz ) )
90 mechz setsoundentcontext(
"movement",
"normal");
97 e_player = GetLocalPlayer( localClientNum );
98 n_dist = DistanceSquared( pos, e_player.origin );
101 n_scale = ( n_mechz_dist - n_dist ) / n_mechz_dist;
105 if( n_scale > 1 || n_scale < 0 )
return;
107 if( n_scale <= 0.01 )
return;
108 earthquake_scale = n_scale * 0.1;
110 if( earthquake_scale > 0.01)
112 e_player Earthquake( earthquake_scale, 0.1, pos, n_dist );
115 if( n_scale <= 1 && n_scale > 0.8 )
117 e_player PlayRumbleOnEntity( localClientNum,
"shotgun_fire" );
120 else if( n_scale <= 0.8 && n_scale > 0.4 )
122 e_player PlayRumbleOnEntity( localClientNum,
"damage_heavy" );
126 e_player PlayRumbleOnEntity( localClientNum,
"reload_small" );
130 if( bone ==
"j_ball_le" )
132 steam_bone =
"tag_foot_steam_le";
136 steam_bone =
"tag_foot_steam_ri";
147 self.fire_beam_id = BeamLaunch( localclientnum,
self,
MECHZ_FT_TAG, undefined,
"none",
"flamethrower_beam_3p_zm_mechz" );
148 self playsound (0 ,
"wpn_flame_thrower_start_mechz");
149 self.sndLoopID =
self PlayLoopSound (
"wpn_flame_thrower_loop_mechz");
153 self notify(
"stopFlamethrower" );
154 if ( IsDefined(
self.fire_beam_id ) )
156 BeamKill( localclientnum,
self.fire_beam_id );
157 self playsound (0 ,
"wpn_flame_thrower_stop_mechz");
158 self stoploopsound (
self.sndLoopID );
168 velocity =
self GetVelocity();
170 dynent = CreateDynEntAndLaunch( localClientNum,
MECHZ_MODEL_FACEPLATE, pos, ang,
self.origin, velocity );
172 self setsoundentcontext(
"movement",
"loud");
173 self playsound (0,
"zmb_ai_mechz_faceplate");
180 velocity =
self GetVelocity();
184 self playsound (0,
"zmb_ai_mechz_destruction");
189 function mechz_detach_claw( localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump )
191 if( IsDefined( level.mechz_detach_claw_override ) )
193 self [[level.mechz_detach_claw_override]]( localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump );
199 velocity =
self GetVelocity();
201 dynent = CreateDynEntAndLaunch( localClientNum,
MECHZ_MODEL_CLAW, pos, ang,
self.origin, velocity );
203 self playsound (0,
"zmb_ai_mechz_destruction");
216 velocity =
self GetVelocity();
220 self playsound (0,
"zmb_ai_mechz_destruction");
228 velocity =
self GetVelocity();
232 self playsound (0,
"zmb_ai_mechz_destruction");
240 velocity =
self GetVelocity();
244 self playsound (0,
"zmb_ai_mechz_destruction");
252 velocity =
self GetVelocity();
256 self playsound (0,
"zmb_ai_mechz_destruction");
260 function mechz_headlamp_off( localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump )
262 if(
self.headlamp_on ===
true && newValue != 0 && isDefined(
self.headlight_fx ))
264 StopFX( localClientNum,
self.headlight_fx );
265 self.headlamp_on =
false;
269 playFXonTag( localClientNum, level._effect[
MECHZ_FOOTSTEP_FX ],
self,
"tag_headlamp_fx" );
275 function private mechzFaceCallback( localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump )
279 if ( IsDefined(
self.prevFaceAnim ) )
281 self ClearAnim(
self.prevFaceAnim, 0.2 );
284 faceAnim = level._mechz_face[ newValue ];
285 self SetAnim( faceAnim, 1.0, 0.2, 1.0 );
286 self.prevFaceAnim = faceAnim;