1 #using scripts\codescripts\struct;
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\fx_shared;
5 #using scripts\shared\system_shared;
6 #using scripts\shared\util_shared;
8 #insert scripts\shared\shared.gsh;
10 #namespace acousticsensor;
12 #precache( "client_fx", "_t6/misc/fx_equip_light_red" );
13 #precache( "client_fx", "_t6/misc/fx_equip_light_green" );
17 level._effect[
"acousticsensor_enemy_light"] =
"_t6/misc/fx_equip_light_red";
18 level._effect[
"acousticsensor_friendly_light"] =
"_t6/misc/fx_equip_light_green" ;
20 if ( !isdefined( level.acousticSensors ) )
21 level.acousticSensors = [];
22 if ( !isdefined( level.acousticSensorHandle ) )
23 level.acousticSensorHandle = 0;
31 SetLocalRadarEnabled( localClientNum, 0 );
32 if ( localClientNum == 0 )
40 acousticSensor = spawnstruct();
41 acousticSensor.handle = handle;
42 acousticSensor.sensorEnt = sensorEnt;
43 acousticSensor.owner = owner;
46 size = level.acousticSensors.size;
47 level.acousticSensors[size] = acousticSensor;
52 for ( i = 0 ; i < level.acousticSensors.size ; i++ )
54 last = level.acousticSensors.size - 1;
55 if ( level.acousticSensors[i].handle == acousticSensorHandle )
57 level.acousticSensors[i].handle = level.acousticSensors[last].handle;
58 level.acousticSensors[i].sensorEnt = level.acousticSensors[last].sensorEnt;
59 level.acousticSensors[i].owner = level.acousticSensors[last].owner;
61 level.acousticSensors[last] = undefined;
69 handle = level.acousticSensorHandle;
70 level.acousticSensorHandle++;
73 owner =
self GetOwner( localClientNum );
81 self endon(
"entityshutdown" );
83 self thread
fx::blinky_light( localClientNum,
"tag_light", level._effect[
"acousticsensor_friendly_light"], level._effect[
"acousticsensor_enemy_light"] );
88 self waittill(
"entityshutdown" );
94 self endon(
"entityshutdown" );
95 localRadarEnabled = [];
96 previousAcousticSensorCount = -1;
104 localPlayers = level.localPlayers;
105 if ( previousAcousticSensorCount != 0 || level.acousticSensors.size != 0 )
108 for ( i = 0 ; i < localPlayers.size ; i++ )
109 localRadarEnabled[i] = 0;
111 for ( i = 0 ; i < level.acousticSensors.size ; i++ )
113 if ( isdefined( level.acousticSensors[i].sensorEnt.stunned ) && level.acousticSensors[i].sensorEnt.stunned )
116 for ( j = 0 ; j < localPlayers.size ; j++ )
118 if ( localPlayers[j] == level.acousticSensors[i].sensorEnt GetOwner( j ) )
120 localRadarEnabled[j] = 1;
121 SetLocalRadarPosition( j, level.acousticSensors[i].sensorEnt.origin );
126 for ( i = 0 ; i < localPlayers.size ; i++ )
127 SetLocalRadarEnabled( i, localRadarEnabled[i] );
129 previousAcousticSensorCount = level.acousticSensors.size;