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

init()
{
    level.splitscreen = issplitscreen();
    maps\mp\_utility::set_console_status();
    level.onlinegame = getdvarint( "onlinegame" );
    level.rankedmatch = level.onlinegame && !getdvarint( "xblive_privatematch" ) || getdvarint( "force_ranking" );
    level.script = tolower( getdvar( "mapname" ) );
    level.gametype = tolower( getdvar( "g_gametype" ) );
    level.teamnamelist = [ "axis", "allies" ];
    level.otherteam["allies"] = "axis";
    level.otherteam["axis"] = "allies";
    level.multiteambased = 0;
    level.teambased = 0;
    level.objectivebased = 0;
    level.endgameontimelimit = 1;
    level.showingfinalkillcam = 0;
    level.tispawndelay = getdvarint( "scr_tispawndelay" );

    if ( !isdefined( level.tweakablesinitialized ) )
        maps\mp\gametypes\_tweakables::init();

    level.halftimetype = "halftime";
    level.laststatustime = 0;
    level.waswinning = "none";
    level.lastslowprocessframe = 0;
    level.placement["allies"] = [];
    level.placement["axis"] = [];
    level.placement["all"] = [];
    level.postroundtime = 5.0;
    level.playerslookingforsafespawn = [];
    registerdvars();

    if ( maps\mp\_utility::matchmakinggame() )
    {
        var_0 = " LB_MAP_" + getdvar( "ui_mapname" );
        var_1 = "";
        var_2 = "";

        if ( issquadsmode() )
        {
            if ( getdvarint( "squad_match" ) )
            {
                var_1 = " LB_GM_SQUAD_ASSAULT";
                level thread endmatchonhostdisconnect();
            }
            else if ( level.gametype == "horde" )
                var_1 = " LB_GM_HORDE";
        }
        else
        {
            var_2 = "LB_GB_TOTALXP_AT LB_GB_TOTALXP_LT LB_GB_WINS_AT LB_GB_WINS_LT LB_GB_KILLS_AT LB_GB_KILLS_LT LB_GB_ACCURACY_AT LB_ACCOLADES";
            var_1 = " LB_GM_" + level.gametype;

            if ( getdvarint( "g_hardcore" ) )
                var_1 = var_1 + "_HC";
        }

        precacheleaderboards( var_2 + var_1 + var_0 );
    }

    level.teamcount["allies"] = 0;
    level.teamcount["axis"] = 0;
    level.teamcount["spectator"] = 0;
    level.alivecount["allies"] = 0;
    level.alivecount["axis"] = 0;
    level.alivecount["spectator"] = 0;
    level.livescount["allies"] = 0;
    level.livescount["axis"] = 0;
    level.onelefttime = [];
    level.hasspawned["allies"] = 0;
    level.hasspawned["axis"] = 0;
    var_3 = 9;
    init_multiteamdata( var_3 );
}

endmatchonhostdisconnect()
{
    level endon( "game_ended" );

    for (;;)
    {
        level waittill( "connected", var_0 );

        if ( var_0 ishost() )
        {
            var_1 = var_0;
            break;
        }
    }

    var_1 waittill( "disconnect" );
    thread maps\mp\gametypes\_gamelogic::endgame( "draw", game["end_reason"]["host_ended_game"] );
}

init_multiteamdata( var_0 )
{
    for ( var_1 = 0; var_1 < var_0; var_1++ )
    {
        var_2 = "team_" + var_1;
        level.placement[var_2] = [];
        level.teamcount[var_2] = 0;
        level.alivecount[var_2] = 0;
        level.livescount[var_2] = 0;
        level.hasspawned[var_2] = 0;
    }
}

registerdvars()
{
    setomnvar( "ui_bomb_timer", 0 );

    if ( getdvar( "r_reflectionProbeGenerate" ) != "1" )
        setomnvar( "ui_nuke_end_milliseconds", 0 );

    setdvar( "ui_danger_team", "" );
    setdvar( "ui_inhostmigration", 0 );
    setdvar( "ui_override_halftime", 0 );
    setdvar( "camera_thirdPerson", getdvarint( "scr_thirdPerson" ) );
}

setupcallbacks()
{
    level.onxpevent = ::onxpevent;
    level.getspawnpoint = ::blank;
    level.onspawnplayer = ::blank;
    level.onrespawndelay = ::blank;
    level.ontimelimit = maps\mp\gametypes\_gamelogic::default_ontimelimit;
    level.onhalftime = maps\mp\gametypes\_gamelogic::default_onhalftime;
    level.ondeadevent = maps\mp\gametypes\_gamelogic::default_ondeadevent;
    level.ononeleftevent = maps\mp\gametypes\_gamelogic::default_ononeleftevent;
    level.onprecachegametype = ::blank;
    level.onstartgametype = ::blank;
    level.onplayerkilled = ::blank;
    level.killstreakinit = maps\mp\killstreaks\_killstreaks_init::init;
    level.matcheventsinit = maps\mp\_matchevents::init;
    level.intelinit = maps\mp\gametypes\_intel::init;
}

blank( var_0, var_1, var_2, var_3, var_4, var_5, var_6, var_7, var_8, var_9 )
{

}

testmenu()
{
    self endon( "death" );
    self endon( "disconnect" );

    for (;;)
    {
        wait 10.0;
        var_0 = spawnstruct();
        var_0.titletext = &"MP_CHALLENGE_COMPLETED";
        var_0.notifytext = "wheee";
        var_0.sound = "mp_challenge_complete";
        thread maps\mp\gametypes\_hud_message::notifymessage( var_0 );
    }
}

testshock()
{
    self endon( "death" );
    self endon( "disconnect" );

    for (;;)
    {
        wait 3.0;
        var_0 = randomint( 6 );

        for ( var_1 = 0; var_1 < var_0; var_1++ )
        {
            iprintlnbold( var_0 );
            self shellshock( "frag_grenade_mp", 0.2 );
            wait 0.1;
        }
    }
}

onxpevent( var_0 )
{
    thread maps\mp\gametypes\_rank::giverankxp( var_0 );
}

debugline( var_0, var_1 )
{
    for ( var_2 = 0; var_2 < 50; var_2++ )
        wait 0.05;
}
