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\scoreevents_shared;
8 #using scripts\shared\system_shared;
9 #using scripts\shared\util_shared;
10 #using scripts\shared\weapons\_tacticalinsertion;
11 #using scripts\shared\weapons\_weaponobjects;
13 #insert scripts\shared\shared.gsh;
14 #insert scripts\shared\version.gsh;
16 #using_animtree ( "mp_trophy_system" );
18 #define TROPHY_STUN_TIME_SECONDS 1
19 #define TROPHY_AMMO_COUNT 3
20 #define TROPHY_ACTIVE_RADIUS 512
21 #define TROPHY_ACTIVATION_DELAY_SECONDS 0.1
22 #define TROPHY_SYSTEM_HEALTH 20
23 #define TROPHY_FLAK_Z 15
24 #define TROPHY_TRACE_Z 29
26 #precache( "fx", "weapon/fx_trophy_flash" );
27 #precache( "fx", "weapon/fx_trophy_detonation" );
28 #precache( "fx", "weapon/fx_trophy_radius_indicator" );
29 #precache( "triggerstring", "MP_TROPHY_SYSTEM_PICKUP" );
30 #precache( "triggerstring", "MP_TROPHY_SYSTEM_DESTROY" );
31 #precache( "triggerstring", "MP_TROPHY_SYSTEM_HACKING" );
33 #namespace trophy_system;
37 level.trophyLongFlashFX =
"weapon/fx_trophy_flash";
38 level.trophyDetonationFX =
"weapon/fx_trophy_detonation";
39 level.fx_trophy_radius_indicator =
"weapon/fx_trophy_radius_indicator";
41 trophyDeployAnim = %o_trophy_deploy;
42 trophySpinAnim = %o_trophy_spin;
44 level thread
register();
68 watcher.activateSound =
"wpn_claymore_alert";
69 watcher.hackable =
true;
70 watcher.hackerToolRadius = level.equipmentHackerToolRadius;
71 watcher.hackerToolTimeMs = level.equipmentHackerToolTimeMs;
72 watcher.ownerGetsAssist =
true;
73 watcher.ignoreDirection =
true;
75 watcher.headIcon =
false;
77 watcher.enemyDestroy =
true;
93 player endon(
"death" );
94 player endon(
"disconnect" );
95 level endon(
"game_ended" );
96 self endon(
"death" );
97 self UseAnimTree( #animtree );
99 self.trophySystemStationary =
false;
103 if ( moveState ==
"rolling" )
105 self SetAnim( %o_trophy_deploy, 1.0 );
111 self.trophySystemStationary =
true;
113 player AddWeaponStat(
self.weapon,
"used", 1 );
115 self.ammo = player
ammo_get(
self.weapon );
119 self SetAnim( %o_trophy_deploy, 0.0 );
120 self SetAnim( %o_trophy_spin, 1.0 );
123 self playsound(
"wpn_trophy_deploy_start");
125 self PlayLoopSound(
"wpn_trophy_spin", 0.25 );
132 if ( isdefined(
self.reconModelEntity ) )
144 self endon(
"death" );
146 self waittill(
"hacked", player );
157 PlayFX( level._effect[
"tacticalInsertionFizzle"],
self.origin );
158 self playsound (
"dst_trophy_smash");
160 if( isdefined( level.playEquipmentDestroyedOnPlayer ) )
162 self.owner [[level.playEquipmentDestroyedOnPlayer]]( );
180 owner endon(
"disconnect" );
181 self endon(
"death" );
182 self endon(
"hacked" );
186 if ( !isdefined(
self ) )
191 if (( level.missileEntities.size < 1 ) || isdefined(
self.disabled ))
197 for ( index=0; index < level.missileEntities.size; index++ )
201 if ( !isdefined(
self ) )
206 grenade = level.missileEntities[index];
208 if ( !isdefined(grenade) )
211 if ( grenade ==
self )
214 if ( !grenade.weapon.destroyableByTrophySystem )
219 switch( grenade.model )
221 case "t6_wpn_grenade_supply_projectile":
225 if ( grenade.weapon ==
self.weapon )
227 if (
self.trophySystemStationary ==
false && grenade.trophySystemStationary ==
true )
233 if ( !isdefined( grenade.owner ) )
235 grenade.owner = GetMissileOwner( grenade );
238 if ( isdefined( grenade.owner ))
240 if ( level.teamBased )
242 if ( grenade.owner.team == owner.team )
249 if ( grenade.owner == owner )
255 grenadeDistanceSquared = DistanceSquared( grenade.origin,
self.origin );
259 if ( BulletTracePassed( grenade.origin,
self.origin + (0,0,
TROPHY_TRACE_Z),
false,
self, grenade,
false,
true ) )
261 playFX( level.trophyLongFlashFX,
self.origin + (0,0,
TROPHY_FLAK_Z), ( grenade.origin -
self.origin ), AnglesToUp(
self.angles ) );
269 self playsound (
"wpn_trophy_alert" );
271 if ( GetDvarint(
"player_sustainAmmo" ) == 0 )
274 if (
self.ammo <= 0 )
294 self endon(
"death" );
296 projPosition = projectile.origin;
298 playFX( level.trophyDetonationFX, projPosition );
299 projectile notify (
"trophy_destroyed" );
301 trophy RadiusDamage( projPosition, 128, 105, 10,
self );
308 self AddPlayerStat(
"destroy_explosive_with_trophy", 1 );
310 self AddWeaponStat( trophy.weapon,
"CombatRecordStat", 1 );
321 self endon(
"death" );
323 tacPos = tacInsert.origin;
324 playFX( level.trophyDetonationFX, tacInsert.origin );
327 trophy RadiusDamage( tacPos, 128, 105, 10,
self );
332 self AddPlayerStat(
"destroy_explosive_with_trophy", 1 );
334 self AddWeaponStat( trophy.weapon,
"CombatRecordStat", 1 );
343 if ( !isdefined( weapon ) || !weapon.isEmp )
345 PlayFX( level._equipment_explode_fx_lg,
self.origin );
354 PlaySoundAtPosition (
"exp_trophy_system",
self.origin );
364 self endon(
"death" );
365 self endon(
"hacked" );
367 self SetCanDamage(
true );
372 self.damageTaken = 0;
375 self.maxhealth = 10000;
376 self.health =
self.maxhealth;
378 self setmaxhealth(
self.maxhealth );
380 attacker = undefined;
384 self waittill (
"damage",
damage, attacker, direction_vec, point, type, modelName, tagName, partName, weapon, iDFlags );
386 attacker =
self [[ level.figure_out_attacker ]]( attacker );
388 if( !isplayer( attacker ))
393 if ( level.teambased )
396 if( !level.hardcoreMode &&
self.owner.team == attacker.pers[
"team"] &&
self.owner != attacker )
406 if ( watcher.stunTime > 0 && weapon.doStun )
411 if ( weapon.doDamageFeedback )
414 if ( level.teambased &&
self.owner.team != attacker.team )
420 else if ( !level.teambased &&
self.owner != attacker )
427 if ( type ==
"MOD_MELEE" || weapon.isEmp || weapon.destroysEquipment )
429 self.damageTaken = damageMax;
436 if(
self.damageTaken >= damageMax )
451 self._trophy_system_ammo1 = undefined;
452 self._trophy_system_ammo2 = undefined;
457 totalAmmo = weapon.ammoCountEquipment;
459 if ( isdefined(
self._trophy_system_ammo1 ) && !
self util::isHacked() )
461 totalAmmo =
self._trophy_system_ammo1;
462 self._trophy_system_ammo1 = undefined;
464 if ( isdefined(
self._trophy_system_ammo2 ) )
466 self._trophy_system_ammo1 =
self._trophy_system_ammo2;
467 self._trophy_system_ammo2 = undefined;
476 if ( isdefined( ammo ) )
478 if ( isdefined(
self._trophy_system_ammo1 ) )
480 self._trophy_system_ammo2 =
self._trophy_system_ammo1;
481 self._trophy_system_ammo1 = ammo;
485 self._trophy_system_ammo1 = ammo;