1 #using scripts\codescripts\struct;
2 #using scripts\shared\sound_shared;
3 #using scripts\shared\util_shared;
5 #insert scripts\shared\shared.gsh;
11 level.tabunInitialGasShockDuration = GetDvarInt(
"scr_tabunInitialGasShockDuration",
"7");
12 level.tabunWalkInGasShockDuration = GetDvarInt(
"scr_tabunWalkInGasShockDuration",
"4");
13 level.tabunGasShockRadius = GetDvarInt(
"scr_tabun_shock_radius",
"185" );
14 level.tabunGasShockHeight = GetDvarInt(
"scr_tabun_shock_height",
"20" );
15 level.tabunGasPoisonRadius = GetDvarInt(
"scr_tabun_effect_radius",
"185" );
16 level.tabunGasPoisonHeight = GetDvarInt(
"scr_tabun_shock_height",
"20" );
17 level.tabunGasDuration = GetDvarInt(
"scr_tabunGasDuration",
"8" );
18 level.poisonDuration = GetDvarInt(
"scr_poisonDuration",
"8" );
19 level.poisonDamage = GetDvarInt(
"scr_poisonDamage",
"13" );
20 level.poisonDamageHardcore = GetDvarInt(
"scr_poisonDamageHardcore",
"5" );
23 level.fx_tabun_0 =
"tabun_tiny_mp";
24 level.fx_tabun_1 =
"tabun_small_mp";
25 level.fx_tabun_2 =
"tabun_medium_mp";
26 level.fx_tabun_3 =
"tabun_large_mp";
27 level.fx_tabun_single =
"tabun_center_mp";
29 level.fx_tabun_radius0 = GetDvarInt(
"scr_fx_tabun_radius0", 55 );
30 level.fx_tabun_radius1 = GetDvarInt(
"scr_fx_tabun_radius1", 55 );
31 level.fx_tabun_radius2 = GetDvarInt(
"scr_fx_tabun_radius2", 50 );
32 level.fx_tabun_radius3 = GetDvarInt(
"scr_fx_tabun_radius3", 25 );
34 level.sound_tabun_start =
"wpn_gas_hiss_start";
35 level.sound_tabun_loop =
"wpn_gas_hiss_lp";
36 level.sound_tabun_stop =
"wpn_gas_hiss_end";
38 level.sound_shock_tabun_start =
"";
39 level.sound_shock_tabun_loop =
"";
40 level.sound_shock_tabun_stop =
"";
53 level.tabunGasPoisonRadius = GetDvarInt(
"scr_tabun_effect_radius", level.tabunGasPoisonRadius );
54 level.tabunGasPoisonHeight = GetDvarInt(
"scr_tabun_shock_height", level.tabunGasPoisonHeight );
55 level.tabunGasShockRadius = GetDvarInt(
"scr_tabun_shock_radius", level.tabunGasShockRadius );
56 level.tabunGasShockHeight = GetDvarInt(
"scr_tabun_shock_height", level.tabunGasShockHeight );
57 level.tabunInitialGasShockDuration = GetDvarInt(
"scr_tabunInitialGasShockDuration", level.tabunInitialGasShockDuration);
58 level.tabunWalkInGasShockDuration = GetDvarInt(
"scr_tabunWalkInGasShockDuration", level.tabunWalkInGasShockDuration);
59 level.tabunGasDuration = GetDvarInt(
"scr_tabunGasDuration", level.tabunGasDuration);
60 level.poisonDuration = GetDvarInt(
"scr_poisonDuration", level.poisonDuration );
61 level.poisonDamage = GetDvarInt(
"scr_poisonDamage", level.poisonDamage );
62 level.poisonDamageHardcore = GetDvarInt(
"scr_poisonDamageHardcore", level.poisonDamageHardcore );
64 level.fx_tabun_radius0 = GetDvarInt(
"scr_fx_tabun_radius0", level.fx_tabun_radius0 );
65 level.fx_tabun_radius1 = GetDvarInt(
"scr_fx_tabun_radius1", level.fx_tabun_radius1 );
66 level.fx_tabun_radius2 = GetDvarInt(
"scr_fx_tabun_radius2", level.fx_tabun_radius2 );
67 level.fx_tabun_radius3 = GetDvarInt(
"scr_fx_tabun_radius3", level.fx_tabun_radius3 );
74 self endon(
"trophy_destroyed" );
76 self waittill(
"explode", position, surface );
79 if( !isdefined(level.water_duds) || level.water_duds ==
true)
81 if( isdefined(surface) && surface ==
"water" )
89 if ( GetDvarInt (
"scr_enable_new_tabun", 1 ) )
102 shockEffectArea =
spawn(
"trigger_radius", position, 0, radius, height );
103 gasEffectArea =
spawn(
"trigger_radius", position, 0, radius, height );
106 if( GetDvarint(
"scr_draw_triggers" ) )
107 level thread
util::drawcylinder( position, radius, height, undefined,
"tabun_draw_cylinder_stop" );
111 if ( isdefined( level.dogsOnFlashDogs ) )
113 owner thread [[level.dogsOnFlashDogs]]( shockEffectArea );
114 owner thread [[level.dogsOnFlashDogs]]( gasEffectArea );
119 durationOfTabun = level.tabunGasDuration;
122 while (durationOfTabun > 0)
124 players = GetPlayers();
125 for (i = 0; i < players.size; i++)
128 if ( level.friendlyfire == 0 )
130 if ( players[i] != owner )
132 if (!isdefined (owner) || !isdefined(owner.team) )
134 if( level.teambased && players[i].team == owner.team )
140 if ((!isdefined (players[i].inPoisonArea)) || (players[i].inPoisonArea ==
false) )
143 if (players[i] istouching(gasEffectArea) && players[i].sessionstate ==
"playing")
146 if ( ! ( players[i] hasPerk (
"specialty_proximityprotection") ) )
148 trace = bullettrace( position, players[i].origin + (0,0,12),
false, players[i] );
150 if (
trace[
"fraction"] == 1 )
152 players[i].lastPoisonedBy = owner;
163 durationOfTabun -= loopWaitTime;
167 if ( level.tabunGasDuration < level.poisonDuration )
168 wait ( level.poisonDuration - level.tabunGasDuration );
171 shockEffectArea
delete();
172 gasEffectArea
delete();
175 if( GetDvarint(
"scr_draw_triggers" ) )
176 level notify(
"tabun_draw_cylinder_stop" );
182 self endon(
"disconnect" );
183 self endon(
"death" );
186 self.inPoisonArea =
true;
188 self startPoisoning();
190 tabunShockSound =
spawn (
"script_origin",(0,0,1));
192 tabunShockSound.origin = position;
193 tabunShockSound playsound( level.sound_shock_tabun_start );
195 tabunShockSound playLoopSound ( level.sound_shock_tabun_loop );
198 while ( (
trace[
"fraction"] == 1 ) && (isdefined (gasEffectArea) ) &&
self istouching(gasEffectArea) &&
self.sessionstate ==
"playing"&& isdefined (
self.lastPoisonedBy) )
202 if( level.hardcoreMode )
204 damage = level.poisonDamageHardcore;
206 self DoDamage(
damage, gasEffectArea.origin,
self.lastPoisonedBy, killCamEnt,
"none",
"MOD_GAS", 0, GetWeapon(
"tabun_gas" ) );
214 self ShellShock(
"tabun_gas_mp", 1.0 );
217 self ShellShock(
"tabun_gas_nokick_mp", 1.0 );
231 trace = bullettrace( position,
self.origin + (0,0,12),
false,
self );
233 tabunShockSound StopLoopSound( 0.5 );
238 tabunShockSound notify(
"delete" );
239 tabunShockSound
delete();
241 self stopPoisoning();
243 self.inPoisonArea =
false;
248 self endon(
"delete" );
249 owner waittill(
"death" );
256 self waittill(
"death");
271 oneFoot = ( 0, 0, 12 );
272 startPos = position + oneFoot;
276 level.tabun_debug = GetDvarInt(
"scr_tabun_debug", 0 );
277 if ( level.tabun_debug )
279 black = ( 0.2, 0.2, 0.2 );
280 debugstar(startPos, 2 * 1000, black);
289 SpawnTimedFX( level.fx_tabun_single, position );
290 killCamEnt =
spawn(
"script_model", position + (0,0,60) );
292 killCamEnt.startTime = gettime();
294 damageEffectArea ( owner, position, level.tabunGasPoisonRadius, level.tabunGasPoisonHeight, killcament );
301 trace = bullettrace( start,
end,
false, undefined );
304 level.tabun_debug = GetDvarInt(
"scr_tabun_debug", 0 );
305 if ( level.tabun_debug )
307 debugstar(
trace[
"position"], 2 * 1000, color);
313 return trace[
"position"];
318 defaultDistance = GetDvarInt(
"scr_defaultDistanceTabun", 220 );
322 red = ( 0.9, 0.2, 0.2 );
323 blue = ( 0.2, 0.2, 0.9 );
324 green = ( 0.2, 0.9, 0.2 );
325 white = ( 0.9, 0.9, 0.9 );
327 north = startPos + ( defaultDistance, 0, 0 );
328 south = startPos - ( defaultDistance, 0, 0 );
329 east = startPos + ( 0, defaultDistance, 0 );
330 west = startPos - ( 0, defaultDistance, 0 );
331 nw = startPos + ( cos45 * defaultDistance, negCos45 * defaultDistance, 0 );
332 ne = startPos + ( cos45 * defaultDistance, cos45 * defaultDistance, 0 );
333 sw = startPos + ( negCos45 * defaultDistance, negCos45 * defaultDistance, 0 );
334 se = startPos + ( negCos45 * defaultDistance, cos45 * defaultDistance, 0 );
337 locations[
"color"] = [];
338 locations[
"loc"] = [];
339 locations[
"tracePos"] = [];
340 locations[
"distSqrd"] = [];
341 locations[
"fxtoplay"] = [];
342 locations[
"radius"] = [];
345 locations[
"color"][0] = red;
346 locations[
"color"][1] = red;
347 locations[
"color"][2] = blue;
348 locations[
"color"][3] = blue;
349 locations[
"color"][4] = green;
350 locations[
"color"][5] = green;
351 locations[
"color"][6] = white;
352 locations[
"color"][7] = white;
354 locations[
"point"][0] = north;
355 locations[
"point"][1] = ne;
356 locations[
"point"][2] = east;
357 locations[
"point"][3] = se;
358 locations[
"point"][4] = south;
359 locations[
"point"][5] = sw;
360 locations[
"point"][6] = west;
361 locations[
"point"][7] = nw;
363 for ( count = 0; count < 8; count++ )
365 trace =
hitPos( startPos, locations[
"point"][count], locations[
"color"][count] );
366 locations[
"tracePos"][count] =
trace;
367 locations[
"loc"][count] = startPos/2 +
trace/2;
368 locations[
"loc"][count] = locations[
"loc"][count] - ( 0, 0, 12 );
369 locations[
"distSqrd"][count] = distancesquared( startPos,
trace );
373 killCamEnt =
spawn(
"script_model", centroid + (0,0,60) );
375 killCamEnt.startTime = gettime();
379 for ( i = 0; i < 8; i++ )
386 locations[
"fxtoplay"][i] = level.fx_tabun_0;
387 locations[
"radius"][i] = level.fx_tabun_radius0;
392 locations[
"fxtoplay"][i] = level.fx_tabun_1;
393 locations[
"radius"][i] = level.fx_tabun_radius1;
398 locations[
"fxtoplay"][i] = level.fx_tabun_2;
399 locations[
"radius"][i] = level.fx_tabun_radius2;
404 locations[
"fxtoplay"][i] = level.fx_tabun_3;
405 locations[
"radius"][i] = level.fx_tabun_radius3;
410 locations[
"fxtoplay"][i] = undefined;
411 locations[
"radius"][i] = 0;
417 freepassUsed =
false;
419 for ( i = 0; i < 8; i++ )
421 if ( locations[
"radius"][i] != level.fx_tabun_radius0 )
423 if (freePassUsed ==
false && locations[
"radius"][i] == level.fx_tabun_radius1 )
429 singleEffect =
false;
433 oneFoot = ( 0, 0, 12 );
434 startPos = startPos - oneFoot;
437 if ( singleEffect ==
true )
443 SpawnTimedFX( level.fx_tabun_3, startPos );
444 for ( count = 0; count < 8; count++ )
446 if ( isdefined ( locations[
"fxtoplay"][count] ) )
448 SpawnTimedFX( locations[
"fxtoplay"][count], locations[
"loc"][count] );
449 thread
damageEffectArea ( owner, locations[
"loc"][count], locations[
"radius"][count], locations[
"radius"][count], killCamEnt );
457 tabunSound =
spawn (
"script_origin",(0,0,1));
458 tabunSound.origin = position;
460 tabunSound playsound( level.sound_tabun_start );
461 tabunSound playLoopSound ( level.sound_tabun_loop );
462 wait( level.tabunGasDuration );
464 tabunSound StopLoopSound( .5);
471 fxToPlay = undefined;
473 previous = count - 1;
475 previous = previous + locations[
"loc"].size;
477 if ( next >= locations[
"loc"].size )
478 next = next - locations[
"loc"].size;
481 effect0Dist = level.fx_tabun_radius0 * level.fx_tabun_radius0;
482 effect1Dist = level.fx_tabun_radius1 * level.fx_tabun_radius1;
483 effect2Dist = level.fx_tabun_radius2 * level.fx_tabun_radius2;
484 effect3Dist = level.fx_tabun_radius3 * level.fx_tabun_radius3;
485 effect4Dist = level.fx_tabun_radius3;
488 if ( locations[
"distSqrd"][count] > effect0Dist && locations[
"distSqrd"][previous] > effect1Dist && locations[
"distSqrd"][next] > effect1Dist )
492 else if ( locations[
"distSqrd"][count] > effect1Dist && locations[
"distSqrd"][previous] > effect2Dist && locations[
"distSqrd"][next] > effect2Dist )
496 else if ( locations[
"distSqrd"][count] > effect2Dist && locations[
"distSqrd"][previous] > effect3Dist && locations[
"distSqrd"][next] > effect3Dist )
500 else if ( locations[
"distSqrd"][count] > effect3Dist && locations[
"distSqrd"][previous] > effect4Dist && locations[
"distSqrd"][next] > effect4Dist )
510 centroid = ( 0, 0, 0 );
512 for ( i = 0; i < locations[
"loc"].size; i++ )
514 centroid = centroid + ( locations[
"loc"][i] / locations[
"loc"].size );
519 level.tabun_debug = GetDvarInt(
"scr_tabun_debug", 0 );
520 if ( level.tabun_debug )
522 purple = ( 0.9, 0.2, 0.9 );
523 debugstar(centroid, 2 * 1000, purple);
532 center = ( 0, 0, 0 );
533 curX = locations[
"tracePos"][0][0];
534 curY = locations[
"tracePos"][0][1];
539 for ( i = 1; i < locations[
"tracePos"].size; i++ )
541 curX = locations[
"tracePos"][i][0];
542 curY = locations[
"tracePos"][i][1];
546 else if ( curX < minX )
551 else if ( curY < minY )
555 avgX = ( maxX + minX ) / 2;
556 avgY = ( maxY + minY ) / 2;
559 center = ( avgX, avgY, locations[
"tracePos"][0][2] );
562 level.tabun_debug = GetDvarInt(
"scr_tabun_debug", 0 );
563 if ( level.tabun_debug )
565 cyan = ( 0.2, 0.9, 0.9 );
566 debugstar(center, 2 * 1000, cyan);
579 debug_rcbomb = GetDvarInt(
"scr_tabun_debug", 0 );
580 if ( debug_rcbomb ==
"1" )
582 if ( !isdefined(time) )
586 if ( !isdefined(depthTest) )
590 Line( from, to, color, 1, depthTest, time);