68 lines
7.3 KiB
Plaintext
68 lines
7.3 KiB
Plaintext
#using scripts\codescripts\struct;
|
|
#using scripts\shared\callbacks_shared;
|
|
#using scripts\shared\fx_shared;
|
|
#using scripts\shared\util_shared;
|
|
|
|
|
|
|
|
function main()
|
|
{
|
|
callback::on_localplayer_spawned( &on_player_spawned );
|
|
}
|
|
|
|
function on_player_spawned( localClientNum )
|
|
{
|
|
level thread startStopExploderTrigger( localClientNum );
|
|
}
|
|
|
|
function startStopExploderTrigger( localClientNum )
|
|
{
|
|
localPlayer = GetLocalPlayer( localClientNum );
|
|
|
|
triggers = GetEntArray( localClientNum, "clientLightExploder", "targetname" );
|
|
|
|
foreach ( trigger in triggers )
|
|
trigger thread triggerStartStopExploder( localClientNum, localPlayer );
|
|
}
|
|
|
|
function triggerStartStopExploder( localClientNum, localPlayer )
|
|
{
|
|
localPlayer endon( "death" );
|
|
|
|
assert( isdefined( self.script_stop_exploder_radiant ) || isdefined( self.script_exploder_radiant ) );
|
|
|
|
string = ( isdefined( self.script_exploder_radiant ) ? self.script_exploder_radiant : self.script_stop_exploder_radiant );
|
|
|
|
while ( true )
|
|
{
|
|
while ( true )
|
|
{
|
|
self waittill( "trigger", client );
|
|
|
|
if ( client == localPlayer )
|
|
break;
|
|
}
|
|
|
|
PlayRadiantExploder( localClientNum, string );
|
|
self thread triggerStopExploderOnDeath( localClientNum, localPlayer, string );
|
|
|
|
{wait(.016);};
|
|
|
|
while ( isdefined( localPlayer ) && localPlayer IsTouching( self ) )
|
|
wait 0.1;
|
|
|
|
StopRadiantExploder( localClientNum, string );
|
|
self notify( "exploderStopped" );
|
|
|
|
{wait(.016);};
|
|
}
|
|
}
|
|
|
|
function triggerStopExploderOnDeath( localClientNum, localPlayer, string )
|
|
{
|
|
self endon( "exploderStopped" );
|
|
|
|
localPlayer waittill( "death" );
|
|
|
|
StopRadiantExploder( localClientNum, string );
|
|
} |