// IW6 GSC SOURCE
// Generated by https://github.com/xensik/gsc-tool

minion_init()
{
    thread minion_chatter_monitor();
}

minion_chatter_monitor()
{
    self endon( "death" );

    for (;;)
    {
        var_0 = randomfloatrange( 8.0, 15.0 );
        wait( var_0 );
        self playsoundonmovingent( "alien_minion_idle" );
    }
}

minion_approach( var_0, var_1 )
{
    self.attacking_player = 1;
    self.bypass_max_attacker_counter = 0;
    var_2 = 0.0;
    var_3 = randomfloat( 1.0 ) < var_2;

    if ( var_3 )
        return maps\mp\agents\alien\_alien_think::go_for_swipe( var_0 );

    self playsoundonmovingent( "alien_minion_alert" );
    var_4 = maps\mp\agents\alien\_alien_think::approach_enemy( 80, var_0, 3 );
    return "explode";
}

explode_attack( var_0 )
{
    self.melee_type = "explode";
    maps\mp\agents\alien\_alien_think::alien_melee( var_0 );
}

explode( var_0 )
{
    maps\mp\alien\_utility::set_alien_emissive( 0.2, 1.0 );
    self playsoundonmovingent( "alien_minion_attack" );
    playfxontag( level._effect["alien_minion_preexplode"], self, "tag_origin" );
    self scragentsetanimmode( "anim deltas" );
    var_1 = 1.25;
    self setanimstate( "minion_explode", 0, var_1 );
    wait( getanimlength( self getanimentry( "minion_explode", 0 ) ) * ( 1 / var_1 ) );
    self suicide();
}

load_minion_fx()
{
    level._effect["alien_minion_explode"] = loadfx( "vfx/gameplay/alien/vfx_alien_minion_explode" );
    level._effect["alien_minion_preexplode"] = loadfx( "vfx/gameplay/alien/vfx_alien_minion_preexplosion" );
}

minion_explode_on_death( var_0 )
{
    common_scripts\utility::waitframe();
    playfx( level._effect["alien_minion_explode"], var_0 + ( 0, 0, 32 ) );
    playsoundatpos( var_0, "alien_minion_explode" );
    radiusdamage( var_0, 200, level.alien_types["minion"].attributes["explode_max_damage"], level.alien_types["minion"].attributes["explode_min_damage"], undefined, "MOD_EXPLOSIVE", "alien_minion_explosion" );
}
