1 #using scripts\codescripts\struct;
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\clientfield_shared;
5 #using scripts\shared\duplicaterender_mgr;
6 #using scripts\shared\math_shared;
7 #using scripts\shared\system_shared;
8 #using scripts\shared\util_shared;
9 #using scripts\shared\visionset_mgr_shared;
10 #using scripts\shared\weapons\_flashgrenades;
12 #insert scripts\shared\duplicaterender.gsh;
13 #insert scripts\shared\shared.gsh;
14 #insert scripts\shared\version.gsh;
16 #define HACKING_PLAYER_WEAPON "pda_hack"
17 #define HACKER_MAX_RANGE 40
18 #define HACKER_SWEET_SPOT_RATIO 0.8
20 #namespace hacker_tool;
25 level.hackingSoundId = [];
26 level.hackingSweetSpotId = [];
27 level.friendlyHackingSoundId = [];
33 if(
self != GetLocalPlayer( localClientNum ) )
38 if ( isdefined( level.hackingSoundId[localclientnum] ) )
40 player stopLoopSound( level.hackingSoundId[localclientnum] );
41 level.hackingSoundId[localclientnum] = undefined;
43 if ( isdefined( level.hackingSweetSpotId[localclientnum] ) )
45 player stopLoopSound(level.hackingSweetSpotId[localclientnum] );
46 level.hackingSweetSpotId[localclientnum] = undefined;
48 if ( isdefined( level.friendlyHackingSoundId[localclientnum] ) )
50 player stopLoopSound( level.friendlyHackingSoundId[localclientnum] );
51 level.friendlyHackingSoundId[localclientnum] = undefined;
56 function player_hacking( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
58 self notify(
"player_hacking_callback" );
60 if ( isdefined( level.hackingSoundId[localclientnum] ) )
62 player stopLoopSound( level.hackingSoundId[localclientnum] );
63 level.hackingSoundId[localclientnum] = undefined;
65 if ( isdefined( level.hackingSweetSpotId[localclientnum] ) )
67 player stopLoopSound(level.hackingSweetSpotId[localclientnum] );
68 level.hackingSweetSpotId[localclientnum] = undefined;
70 if ( isdefined( level.friendlyHackingSoundId[localclientnum] ) )
72 player stopLoopSound( level.friendlyHackingSoundId[localclientnum] );
73 level.friendlyHackingSoundId[localclientnum] = undefined;
75 if ( isdefined( player.targetEnt ) )
79 player.targetEnt.isbreachingfirewall =
false;
80 player.targetEnt = undefined;
86 SetUIModelValue( CreateUIModel( GetUIModelForController( localClientNum ),
"hudItems.blackhat.status" ),
HACKER_TOOL_STATUS_HACKING );
96 SetUIModelValue( CreateUIModel( GetUIModelForController( localClientNum ),
"hudItems.blackhat.perc" ), 0 );
97 SetUIModelValue( CreateUIModel( GetUIModelForController( localClientNum ),
"hudItems.blackhat.offsetShaderValue" ), 0 +
" " + 0 +
" 0 0" );
102 SetUIModelValue( CreateUIModel( GetUIModelForController( localClientNum ),
"hudItems.blackhat.status" ),
HACKER_TOOL_STATUS_SCANNING );
103 SetUIModelValue( CreateUIModel( GetUIModelForController( localClientNum ),
"hudItems.blackhat.perc" ), 0 );
104 SetUIModelValue( CreateUIModel( GetUIModelForController( localClientNum ),
"hudItems.blackhat.offsetShaderValue" ), 0 +
" " + 0 +
" 0 0" );
111 self endon(
"entityshutdown" );
112 self endon(
"player_hacking_callback" );
117 targetEntArray =
self GetTargetLockEntityArray();
118 if ( targetEntArray.size > 0 )
120 targetEnt = targetEntArray[0];
130 self endon(
"entityshutdown" );
131 player endon(
"entityshutdown" );
132 self endon(
"player_hacking_callback" );
135 player.targetEnt = targetEnt;
136 if ( isBreachingFirewall )
138 targetEnt.isbreachingfirewall =
true;
146 distanceFromCenter = targetent getDistanceFromScreenCenter( localClientNum );
149 heatVal = GetWeaponHackRatio( localclientnum );
150 ratio = ratio * ratio * ratio * ratio;
151 if ( ratio > 1.0 || ratio < 0.001 )
158 horizontal = targetent getHorizontalOffsetFromScreenCenter( localClientNum,
HACKER_MAX_RANGE );
161 SetUIModelValue( CreateUIModel( GetUIModelForController( localClientNum ),
"hudItems.blackhat.offsetShaderValue" ), horizontal +
" " + ratio +
" 0 0" );
163 SetUIModelValue( CreateUIModel( GetUIModelForController( localClientNum ),
"hudItems.blackhat.perc" ), heatVal );
167 if ( !isdefined( level.hackingSweetSpotId[localclientnum] ) )
169 level.hackingSweetSpotId[localclientnum] = player playloopsound(
"evt_hacker_hacking_sweet" );
174 if ( isdefined( level.hackingSweetSpotId[localclientnum] ) )
176 player stopLoopSound( level.hackingSweetSpotId[localclientnum] );
177 level.hackingSweetSpotId[localclientnum] = undefined;
179 if ( !isdefined( level.hackingSoundId[localclientnum] ) )
181 level.hackingSoundId[localclientnum] = player playloopsound(
"evt_hacker_hacking_loop" );
183 if ( isdefined( level.hackingSoundId[localclientnum] ) )
185 setSoundPitch( level.hackingSoundId[localclientnum], ratio );
189 if ( !isBreachingFirewall )
191 friendlyHacking = WeaponFriendlyHacking( localclientnum );
193 if ( friendlyHacking && !isdefined( level.friendlyHackingSoundId[localclientnum] ) )
195 level.friendlyHackingSoundId[localclientnum] = player playloopsound(
"evt_hacker_hacking_loop_mult" );
197 else if ( !friendlyHacking && isdefined( level.friendlyHackingSoundId[localclientnum] ) )
199 player stopLoopSound( level.friendlyHackingSoundId[localclientnum] );
200 level.friendlyHackingSoundId[localclientnum] = undefined;
210 self endon(
"entityshutdown" );
211 killstreakEntity =
self;
212 hackerPlayer endon(
"player_hacking_callback" );
214 hackerPlayer waittill(
"entityshutdown" );
216 if ( isdefined( targetEnt ) )
218 targetEnt.isbreachingfirewall =
true;
227 self endon(
"entityshutdown" );
228 self endon(
"player_hacking_callback" );
232 if (
self IsEMPJammed() )
234 SetUIModelValue( CreateUIModel( GetUIModelForController( localClientNum ),
"hudItems.blackhat.status" ),
HACKER_TOOL_STATUS_EMPED );
238 SetUIModelValue( CreateUIModel( GetUIModelForController( localClientNum ),
"hudItems.blackhat.status" ),
HACKER_TOOL_STATUS_SCANNING );