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

main()
{
    maps\mp\mp_conflict_precache::main();
    maps\createart\mp_conflict_art::main();
    maps\mp\mp_conflict_fx::main();
    level.harrier_smoke = loadfx( "fx/fire/jet_afterburner_harrier_damaged" );
    level.harrier_deathfx = loadfx( "fx/explosions/aerial_explosion_harrier" );
    level.harrier_afterburnerfx = loadfx( "fx/fire/jet_afterburner_harrier" );
    level.mapcustomcratefunc = ::conflictcustomcratefunc;
    level.mapcustomkillstreakfunc = ::conflictcustomkillstreakfunc;
    level.mapcustombotkillstreakfunc = ::conflictcustombotkillstreakfunc;
    maps\mp\_load::main();
    maps\mp\_compass::setupminimap( "compass_map_mp_conflict" );
    maps\mp\_utility::setdvar_cg_ng( "r_specularColorScale", 2.5, 9 );
    setdvar( "r_lightGridEnableTweaks", 1 );
    setdvar( "r_lightGridIntensity", 1.33 );
    game["attackers"] = "allies";
    game["defenders"] = "axis";
    game["allies_outfit"] = "urban";
    game["axis_outfit"] = "woodland";
    thread maps\mp\killstreaks\_airstrike::init();
    thread maps\mp\_dlcalienegg::setupeggformap( "alienEasterEgg" );
}

conflictcustomcratefunc()
{
    if ( !isdefined( game["player_holding_level_killstrek"] ) )
        game["player_holding_level_killstrek"] = 0;

    if ( !maps\mp\_utility::allowlevelkillstreaks() || game["player_holding_level_killstrek"] )
        return;

    maps\mp\killstreaks\_airdrop::addcratetype( "airdrop_assault", "harrier_airstrike", 80, maps\mp\killstreaks\_airdrop::killstreakcratethink, maps\mp\killstreaks\_airdrop::get_friendly_crate_model(), maps\mp\killstreaks\_airdrop::get_enemy_crate_model(), &"MP_CONFLICT_KILLSTREAKS_HARRIER_PICKUP" );
    maps\mp\killstreaks\_airdrop::generatemaxweightedcratevalue();
    level thread watch_for_conflict_crate();
}

conflictcustomkillstreakfunc()
{
    level.killstreakfuncs["harrier_airstrike"] = ::tryuseconflictkillstreak;
}

tryuseconflictkillstreak( var_0, var_1 )
{
    return maps\mp\killstreaks\_airstrike::tryuseairstrike( var_0, var_1 );
}

watch_for_conflict_crate()
{
    for (;;)
    {
        level waittill( "createAirDropCrate", var_0 );

        if ( isdefined( var_0 ) && isdefined( var_0.cratetype ) && var_0.cratetype == "harrier_airstrike" )
        {
            maps\mp\killstreaks\_airdrop::changecrateweight( "airdrop_assault", "harrier_airstrike", 0 );
            var_1 = wait_for_capture( var_0 );

            if ( !var_1 )
            {
                maps\mp\killstreaks\_airdrop::changecrateweight( "airdrop_assault", "harrier_airstrike", 80 );
                continue;
            }

            game["player_holding_level_killstrek"] = 1;
            break;
        }
    }
}

wait_for_capture( var_0 )
{
    var_1 = watch_for_air_drop_death( var_0 );
    return !isdefined( var_1 );
}

watch_for_air_drop_death( var_0 )
{
    var_0 endon( "captured" );
    var_0 waittill( "death" );
    waittillframeend;
    return 1;
}

conflictcustombotkillstreakfunc()
{
    maps\mp\bots\_bots_ks::bot_register_killstreak_func( "harrier_airstrike", maps\mp\bots\_bots_ks::bot_killstreak_simple_use );
}
