1 #using scripts\codescripts\struct;
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\challenges_shared;
5 #using scripts\shared\clientfield_shared;
6 #using scripts\shared\damagefeedback_shared;
7 #using scripts\shared\entityheadicons_shared;
8 #using scripts\shared\killcam_shared;
9 #using scripts\shared\scoreevents_shared;
10 #using scripts\shared\system_shared;
11 #using scripts\shared\util_shared;
12 #using scripts\shared\weapons\_tacticalinsertion;
13 #using scripts\shared\weapons\_weaponobjects;
14 #using scripts\shared\_burnplayer;
16 #insert scripts\shared\shared.gsh;
17 #insert scripts\shared\version.gsh;
20 #namespace incendiary;
27 level.incendiaryfireDamage = GetDvarInt(
"scr_incendiaryfireDamage", 35 );
28 level.incendiaryfireDamageHardcore = GetDvarInt(
"scr_incendiaryfireDamageHardcore", 15 );
29 level.incendiaryfireDuration = GetDvarInt (
"scr_incendiaryfireDuration", 5 );
30 level.incendiaryfxDuration = GetDvarFloat(
"scr_incendiaryfxDuration", 0.4 );
31 level.incendiaryDamageRadius = GetDvarInt(
"scr_incendiaryDamageRadius", 125 );
32 level.incendiaryfireDamageTickTime = GetDvarFloat(
"scr_incendiaryfireDamageTickTime", 1 );
35 level.incendiaryDamageThisTick = [];
49 player endon(
"death" );
50 player endon(
"disconnect" );
51 level endon(
"game_ended" );
53 player AddWeaponStat(
self.weapon,
"used", 1 );
60 self endon(
"hacked" );
61 self endon(
"delete" );
63 killCamEnt =
spawn(
"script_model",
self.origin );
65 killCamEnt.startTime = gettime();
66 killCamEnt linkto(
self );
67 killCamEnt setWeapon(
self.weapon );
71 self waittill(
"projectile_impact_explode", origin, normal, surface );
73 PlaySoundAtPosition (
"wpn_incendiary_core_start" ,
self.origin);
80 if ( normal[2] < 0.5 )
82 stepoutdistance = normal * GetDvarInt(
"scr_incendiary_stepout_wall", 50 );
86 stepoutdistance = normal * GetDvarInt(
"scr_incendiary_stepout_ground", 12 );
88 return stepoutdistance;
94 desiredEndPos = startPos + ( 0, 0, 60 );
96 goalPos = ( ( physTrace[
"fraction" ] < 1 ) ? physTrace[
"position"] : desiredEndPos );
98 killCamEnt moveto( goalPos, 0.5 );
99 rotation = RandomInt( 360 );
101 if ( normal[2] < 0.1 )
103 black = ( 0.1, 0.1, 0.1 );
105 trace =
hitPos( startPos, startpos + ( -normal * 70 ) + ( 0,0, -1 ) * 70, black );
106 tracePosition =
trace[
"position"];
107 incendiaryGrenade = GetWeapon(
"incendiary_fire" );
109 if (
trace[
"fraction"] < 0.9 )
111 wallnormal =
trace[
"normal"];
112 SpawnTimedFX( incendiaryGrenade,
trace[
"position"], wallnormal, level.incendiaryfireDuration,
self.team );
116 fxCount = GetDvarInt(
"scr_incendiary_fx_count", 6 );
117 spawnAllLocs( owner, startPos, normal, 1, rotation, killcament, fxCount );
122 currentAngle = ( ( 360 / fxCount ) * fxIndex );
123 cosCurrent = cos( currentAngle + rotation );
124 sinCurrent = sin( currentAngle + rotation );
126 return startPos + ( defaultDistance * cosCurrent, defaultDistance * sinCurrent, 0 );
129 function spawnAllLocs( owner, startPos, normal, multiplier, rotation, killcament, fxCount )
131 defaultDistance = GetDvarInt(
"scr_incendiary_trace_distance", 220 ) * multiplier;
132 defaultDropDistance = GetDvarInt(
"scr_incendiary_trace_down_distance", 90 );
138 colorArray[colorArray.size] = ( 0.9, 0.2, 0.2 );
139 colorArray[colorArray.size] = ( 0.2, 0.9, 0.2 );
140 colorArray[colorArray.size] = ( 0.2, 0.2, 0.9 );
141 colorArray[colorArray.size] = ( 0.9, 0.9, 0.9 );
145 locations[
"color"] = [];
146 locations[
"loc"] = [];
147 locations[
"tracePos"] = [];
148 locations[
"distSqrd"] = [];
149 locations[
"fxtoplay"] = [];
150 locations[
"radius"] = [];
153 for( fxIndex = 0; fxIndex < fxCount; fxIndex++ )
155 locations[
"point"][fxIndex] =
getLocationForFX( startPos, fxIndex, fxCount, defaultDistance, rotation );
156 locations[
"color"][fxIndex] = colorArray[fxIndex % colorArray.size];
159 for ( count = 0; count < fxCount; count++ )
161 trace =
hitPos( startPos, locations[
"point"][count], locations[
"color"][count] );
162 tracePosition =
trace[
"position"];
163 locations[
"tracePos"][count] = tracePosition;
165 if (
trace[
"fraction"] < 0.7 )
167 locations[
"loc"][count] = tracePosition;
168 locations[
"normal"][count] =
trace[
"normal"];
172 average = startPos/2 + tracePosition/2;
174 trace =
hitPos( average, average - ( 0, 0, defaultDropDistance ), locations[
"color"][count] );
175 if (
trace[
"fraction"] != 1 )
177 locations[
"loc"][count] =
trace[
"position"];
178 locations[
"normal"][count] =
trace[
"normal"];
184 incendiaryGrenade = GetWeapon(
"incendiary_fire" );
186 SpawnTimedFX( incendiaryGrenade, startPos, normal, level.incendiaryfireDuration,
self.team );
188 level.incendiaryDamageRadius = GetDvarInt(
"scr_incendiaryDamageRadius", level.incendiaryDamageRadius );
190 thread
damageEffectArea ( owner, startPos, level.incendiaryDamageRadius, level.incendiaryDamageRadius, killCamEnt );
192 for ( count = 0; count < locations[
"point"].size; count++ )
194 if ( isdefined ( locations[
"loc"][count] ) )
196 normal = locations[
"normal"][count];
198 SpawnTimedFX( incendiaryGrenade, locations[
"loc"][count], normal, level.incendiaryfireDuration,
self.team );
205 trigger_radius_position = position - ( 0 , 0, height );
206 trigger_radius_height = height * 2;
208 fireEffectArea =
spawn(
"trigger_radius", trigger_radius_position, 0, radius, trigger_radius_height );
216 if ( isdefined( level.rapsOnBurnRaps ) )
218 owner thread [[level.rapsOnBurnRaps]]( fireEffectArea );
222 loopWaitTime = level.incendiaryFireDamageTickTime;
223 durationOfIncendiary = level.incendiaryFireDuration;
226 while (durationOfIncendiary > 0)
228 durationOfIncendiary -= loopWaitTime;
229 damageApplied =
false;
232 foreach( target
in potential_targets )
241 if ( isdefined( killCamEnt ) )
244 fireEffectArea
delete();
250 owner_team = ( isdefined( owner ) ? owner.team : undefined );
251 if ( level.teambased && isdefined( owner_team ) && level.friendlyfire == 0 )
253 enemy_team = ( owner_team ==
"axis" ?
"allies" :
"axis" );
254 potential_targets = [];
255 potential_targets = ArrayCombine( potential_targets, GetPlayers( enemy_team ),
false,
false );
256 potential_targets = ArrayCombine( potential_targets, GetAITeamArray( enemy_team ),
false,
false );
257 potential_targets = ArrayCombine( potential_targets, GetVehicleTeamArray( enemy_team ),
false,
false );
258 potential_targets[ potential_targets.size ] = owner;
259 return potential_targets;
264 all_targets = ArrayCombine( all_targets, level.players,
false,
false );
265 all_targets = ArrayCombine( all_targets, GetAIArray(),
false,
false );
266 all_targets = ArrayCombine( all_targets, GetVehicleArray(),
false,
false );
269 if ( level.friendlyfire > 0 )
273 potential_targets = [];
274 foreach( target
in all_targets )
276 if ( !isdefined( target ) )
279 if( !isdefined( target.team ) )
282 if( isdefined( owner ) )
284 if( target != owner )
286 if( !isdefined( owner_team ) )
289 if( target.team == owner_team )
295 if ( !isdefined(
self ) )
298 if( !isdefined(
self.team ) )
301 if( target.team ==
self.team )
305 potential_targets[ potential_targets.size ] = target;
308 return potential_targets;
314 if ( ( !isdefined(target.infireArea) ) || (target.infireArea ==
false) )
317 if ( target istouching(fireEffectArea) && ( !isdefined(target.sessionstate) || target.sessionstate ==
"playing" ) )
319 trace = bullettrace( position, target GetShootAtPos(),
false, target,
true );
321 if (
trace[
"fraction"] == 1 )
323 target.lastburnedBy = owner;
332 self endon(
"disconnect" );
333 self endon(
"death" );
337 damage = level.incendiaryfireDamage;
338 if( level.hardcoreMode )
340 damage = level.incendiaryfireDamageHardcore;
345 self DoDamage(
damage, fireEffectArea.origin,
self.lastburnedBy, killCamEnt,
"none",
"MOD_BURNED", 0, GetWeapon(
"incendiary_fire" ) );
347 entnum =
self getentitynumber();
356 self notify(
"sndFire" );
357 self endon(
"death" );
358 self endon(
"disconnect" );
359 self endon(
"sndFire" );
361 if( !isdefined(
self.sndFireEnt ) )
363 self.sndFireEnt =
spawn(
"script_origin",
self.origin );
364 self.sndFireEnt linkto(
self,
"tag_origin" );
365 self.sndFireEnt playsound(
"chr_burn_start" );
369 self.sndFireEnt playloopsound(
"chr_burn_start_loop", .5 );
371 self.sndFireEnt
delete();
372 self.sndFireEnt = undefined;
376 self endon(
"disconnect" );
377 self waittill(
"death" );
379 if( isdefined( ent ) )
386 trace = bullettrace( start,
end,
false, undefined );
393 entNum = victim getentitynumber();
394 if ( !isdefined( level.incendiaryDamageThisTick[entNum] ) )
396 level.incendiaryDamageThisTick[entNum] = 0;
410 level.incendiaryDamageThisTick[entnum] = undefined;