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

main()
{
    maps\mp\mp_lonestar_precache::main();
    maps\createart\mp_lonestar_art::main();
    maps\mp\mp_lonestar_fx::main();
    level thread maps\mp\_movers::main();
    level thread maps\mp\_movable_cover::init();
    level thread quakes();
    maps\mp\_load::main();
    thread maps\mp\_fx::func_glass_handler();
    maps\mp\_compass::setupminimap( "compass_map_mp_lonestar" );
    setdvar( "r_ssaofadedepth", 384 );
    setdvar( "r_ssaorejectdepth", 1152 );
    maps\mp\_utility::setdvar_cg_ng( "r_specularColorScale", 3, 15 );
    maps\mp\_utility::setdvar_cg_ng( "r_diffuseColorScale", 1.25, 3.5 );
    setdvar( "r_lightGridEnableTweaks", 1 );
    setdvar( "r_lightGridIntensity", 1.33 );

    if ( level.ps3 )
    {
        setdvar( "sm_sunShadowScale", "0.5" );
        setdvar( "sm_sunsamplesizenear", ".19" );
    }
    else if ( level.xenon )
    {
        setdvar( "sm_sunShadowScale", "0.8" );
        setdvar( "sm_sunsamplesizenear", ".25" );
    }
    else
        setdvar( "sm_sunShadowScale", "0.9" );

    game["attackers"] = "allies";
    game["defenders"] = "axis";
    level thread exploder_triggers();
    level thread initextracollision();
}

initextracollision()
{
    var_0 = getent( "clip128x128x128", "targetname" );
    var_1 = spawn( "script_model", ( -714, -2022, 102 ) );
    var_1.angles = ( 0, 0, 0 );
    var_1 clonebrushmodeltoscriptmodel( var_0 );
    var_2 = getent( "clip128x128x128", "targetname" );
    var_3 = spawn( "script_model", ( -828, -2160, 80 ) );
    var_3.angles = ( 0, 0, 0 );
    var_3 clonebrushmodeltoscriptmodel( var_2 );
    var_4 = getent( "clip256x256x256", "targetname" );
    var_5 = spawn( "script_model", ( -2048, -336, 112 ) );
    var_5.angles = ( 0, 0, 0 );
    var_5 clonebrushmodeltoscriptmodel( var_4 );
    var_6 = getent( "player32x32x256", "targetname" );
    var_7 = spawn( "script_model", ( -572, -822, 276 ) );
    var_7.angles = ( 0, 0, 0 );
    var_7 clonebrushmodeltoscriptmodel( var_6 );
    var_8 = getent( "clip64x64x128", "targetname" );
    var_9 = spawn( "script_model", ( -990, -209.5, 323 ) );
    var_9.angles = ( 90, 0, 0 );
    var_9 clonebrushmodeltoscriptmodel( var_8 );
}

exploder_triggers()
{
    var_0 = getentarray( "exploder_trigger", "targetname" );

    foreach ( var_2 in var_0 )
    {
        if ( !isdefined( var_2.script_index ) )
            continue;

        var_2 thread exploder_trigger_run();
    }
}

exploder_trigger_run()
{
    self endon( "death" );
    var_0 = [];
    var_0[3] = "scn_mp_lonestar_bat";
    var_0[4] = "scn_mp_lonestar_bat";

    for (;;)
    {
        self waittill( "trigger" );
        common_scripts\utility::exploder( self.script_index );

        if ( isdefined( var_0[self.script_index] ) && isdefined( self.target ) )
        {
            var_1 = common_scripts\utility::getstructarray( self.target, "targetname" );

            foreach ( var_3 in var_1 )
                playsoundatpos( var_3.origin, var_0[self.script_index] );
        }

        wait( randomfloatrange( 60, 120 ) );
    }
}

#using_animtree("animated_props");

quakes()
{
    precachempanim( "mp_lonestar_bat_effect_path" );
    level._effect["bats"] = loadfx( "fx/animals/bats_swarm" );
    level._effect["gas_leak"] = loadfx( "fx/fire/heat_lamp_distortion" );
    level._effect["gas_leak_fire"] = loadfx( "fx/maps/mp_lonestar/mp_ls_gaspipe_fire" );
    level.quake_anims = [];
    level.quake_anims["ground_collapse"] = "mp_lonestar_road_slab_quake";
    level.quake_anims["ground_collapse_start_idle"] = "mp_lonestar_road_slab_quake_idle";
    level.quake_anims["pole_fall_on_police_car"] = "mp_lonestar_police_car_crush_pole";
    level.quake_anims["police_car_hit_by_pole"] = "mp_lonestar_police_car_crush_car";
    level.quake_anims["wire_shake"] = "mp_lonestar_earthquake_wire_shake";
    level.quake_anims["hanging_cable_loop"] = "mp_lonestar_hanging_wire_loop";
    level.quake_anims["hanging_cable"] = "mp_lonestar_hanging_wire_earthquake";
    level.quake_anims_ref = [];
    level.quake_anims_ref["hanging_cable"] = %mp_lonestar_hanging_wire_earthquake;

    foreach ( var_2, var_1 in level.quake_anims )
        precachempanim( var_1 );

    level.pre_quake_scriptables = [];
    level.quake_scriptables = [];
    add_quake_scriptable( "qauke_script_hanging_wire", getanimlength( %mp_lonestar_hanging_wire_earthquake ), 0 );
    add_quake_scriptable( "qauke_script_telephone_wire", getanimlength( %mp_lonestar_earthquake_wire_shake ), 1 );
    level.quake_anim_funcs["police_car_hit_by_pole"] = [];
    level.quake_anim_funcs["police_car_hit_by_pole"][0] = ::quake_event_pole_fall_on_car;
    level.quake_anim_init_funcs["police_car_hit_by_pole"] = [];
    level.quake_anim_init_funcs["police_car_hit_by_pole"][0] = ::quake_event_pole_fall_on_car_init;
    common_scripts\utility::waitframe();

    if ( level.createfx_enabled )
        return;

    var_3 = gettime();
    var_4 = quake_events();
    var_5 = common_scripts\utility::getstruct( "quake", "targetname" );
    var_6 = 3;
    var_7 = [];
    var_8 = [];

    for ( var_9 = 0; var_9 < var_6; var_9++ )
    {
        var_7[var_9] = [];
        var_8[var_9] = var_9;
    }

    var_4 = common_scripts\utility::array_randomize( var_4 );

    foreach ( var_11 in var_4 )
    {
        if ( var_11.count > 0 )
            var_8 = array_shift( var_8 );

        for ( var_9 = 0; var_9 < var_8.size && var_11.count != 0; var_9++ )
        {
            var_12 = var_8[var_9];
            var_7[var_12][var_7[var_12].size] = var_11;
            var_11.count--;
        }
    }

    var_7 = common_scripts\utility::array_randomize( var_7 );
    var_14 = max( 5, maps\mp\_utility::gettimelimit() );
    var_15 = [];

    for ( var_9 = 0; var_9 < var_6; var_9++ )
    {
        var_16 = 1 / var_6 * ( var_9 + 0.2 );
        var_17 = 1 / var_6 * ( var_9 + 0.8 );
        var_15[var_9] = randomfloatrange( var_16, var_17 ) * var_14 * 60;
    }

    for ( var_9 = 0; var_9 < var_6; var_9++ )
    {
        var_18 = var_15[var_9];
        earthqauke_wait( var_18 );
        var_5 thread quake_run( var_7[var_9] );
    }
}

earthqauke_wait( var_0 )
{
    level endon( "earthquake_start" );
    wait( var_0 );
    level notify( "earthquake_start" );
}

array_shift( var_0 )
{
    var_1 = [];

    for ( var_2 = 0; var_2 < var_0.size - 1; var_2++ )
        var_1[var_2] = var_0[var_2 + 1];

    var_1[var_1.size] = var_0[0];
    return var_1;
}

add_quake_scriptable( var_0, var_1, var_2 )
{
    var_3 = getscriptablearray( var_0, "targetname" );

    foreach ( var_5 in var_3 )
        var_5.quake_scriptable_time = var_1;

    if ( var_2 )
        level.pre_quake_scriptables = common_scripts\utility::array_combine( level.pre_quake_scriptables, var_3 );
    else
        level.quake_scriptables = common_scripts\utility::array_combine( level.quake_scriptables, var_3 );
}

quake_run_scriptables( var_0 )
{
    foreach ( var_2 in var_0 )
    {
        var_2 setscriptablepartstate( "main", "quake" );
        var_2 common_scripts\utility::delaycall( var_2.quake_scriptable_time, ::setscriptablepartstate, "main", "idle" );
    }
}

quake_run( var_0 )
{
    quake_run_scriptables( level.pre_quake_scriptables );
    var_1 = undefined;

    foreach ( var_3 in var_0 )
    {
        if ( isdefined( var_3.script_noteworthy ) && var_3.script_noteworthy == "wires" )
        {
            var_1 = var_3;
            var_1 thread quake_event_trigger( 0, var_1 quake_event_wait() );
            break;
        }
    }

    wait 4.0;
    quake_run_scriptables( level.quake_scriptables );
    var_5 = randomfloatrange( 7, 9 );
    playsoundatpos( ( 0, 0, 0 ), "mp_earthquake_lr" );
    earthquake( 0.3, var_5, self.origin, self.radius );
    common_scripts\utility::exploder( 1 );

    foreach ( var_3 in var_0 )
    {
        if ( !isdefined( var_1 ) || var_3 != var_1 )
            var_3 thread quake_event_trigger( var_5, var_3 quake_event_wait() );
    }
}

quake_event_trigger( var_0, var_1 )
{
    if ( isdefined( var_1 ) && var_1 > 0 )
        wait( var_1 );

    self notify( "trigger", var_0 );
}

quake_event_wait()
{
    if ( isdefined( self.script_wait ) )
        return self.script_wait;
    else if ( isdefined( self.script_wait_min ) && isdefined( self.script_wait_max ) )
        return randomfloatrange( self.script_wait_min, self.script_wait_max );

    return 0;
}

quake_event_trigger_wait( var_0, var_1, var_2, var_3, var_4, var_5, var_6 )
{
    for (;;)
    {
        self waittill( "trigger", var_7 );

        if ( isdefined( var_6 ) )
        {
            self thread [[ var_0 ]]( var_7, var_1, var_2, var_3, var_4, var_5, var_6 );
            continue;
        }

        if ( isdefined( var_5 ) )
        {
            self thread [[ var_0 ]]( var_7, var_1, var_2, var_3, var_4, var_5 );
            continue;
        }

        if ( isdefined( var_4 ) )
        {
            self thread [[ var_0 ]]( var_7, var_1, var_2, var_3, var_4 );
            continue;
        }

        if ( isdefined( var_3 ) )
        {
            self thread [[ var_0 ]]( var_7, var_1, var_2, var_3 );
            continue;
        }

        if ( isdefined( var_2 ) )
        {
            self thread [[ var_0 ]]( var_7, var_1, var_2 );
            continue;
        }

        if ( isdefined( var_1 ) )
        {
            self thread [[ var_0 ]]( var_7, var_1 );
            continue;
        }

        self thread [[ var_0 ]]( var_7 );
    }
}

quake_events()
{
    var_0 = common_scripts\utility::getstructarray( "quake_event", "targetname" );
    common_scripts\utility::array_thread( var_0, ::quake_event_init );
    return var_0;
}

quake_event_init()
{
    var_0 = getentarray( self.target, "targetname" );

    if ( isdefined( self.script_noteworthy ) )
    {
        var_1 = strtok( self.script_noteworthy, "," );

        foreach ( var_3 in var_1 )
        {
            var_4 = getentarray( var_3, "targetname" );
            var_0 = common_scripts\utility::array_combine( var_0, var_4 );
        }
    }

    foreach ( var_7 in var_0 )
    {
        if ( var_7 maps\mp\_movers::script_mover_is_script_mover() )
        {
            thread quake_event_trigger_wait( ::quake_event_send_notify, var_7, "trigger" );
            continue;
        }

        quake_event_init_ent( var_7 );

        if ( !isdefined( var_7.script_noteworthy ) )
            continue;

        var_8 = strtok( var_7.script_noteworthy, "," );

        foreach ( var_10 in var_8 )
        {
            switch ( var_10 )
            {
                case "ground_collapse":
                    thread quake_event_trigger_wait( ::quake_event_move_to, var_7, 1, undefined, 1, 0, 1 );
                    break;
                case "shake":
                    thread quake_event_trigger_wait( ::quake_event_shake, var_7 );
                    break;
                case "hurt":
                    if ( !isdefined( var_7.script_damage ) )
                        var_7.script_damage = 25;

                    if ( !isdefined( var_7.script_delay ) )
                        var_7.script_delay = 1;

                    thread quake_event_trigger_wait( ::quake_event_hurt, var_7, var_7.script_delay, var_7.script_damage );
                    break;
                case "hurt_fire":
                    thread quake_event_trigger_wait( ::quake_event_hurt, var_7, 1, 25 );
                    break;
                case "delete":
                    thread quake_event_trigger_wait( ::quake_event_delete, var_7 );
                    break;
                case "animate":
                    if ( isdefined( var_7.script_animation ) )
                    {
                        if ( isdefined( level.quake_anim_init_funcs[var_7.script_animation] ) )
                        {
                            foreach ( var_12 in level.quake_anim_init_funcs[var_7.script_animation] )
                                level thread [[ var_12 ]]( var_7 );
                        }

                        if ( isdefined( level.quake_anims[var_7.script_animation + "_start_idle"] ) )
                            var_7 scriptmodelplayanim( level.quake_anims[var_7.script_animation + "_start_idle"] );

                        if ( isdefined( level.quake_anims[var_7.script_animation + "_loop"] ) )
                            var_7 scriptmodelplayanim( level.quake_anims[var_7.script_animation + "_loop"] );

                        if ( isdefined( level.quake_anims[var_7.script_animation] ) )
                            thread quake_event_trigger_wait( ::quake_event_animate, var_7, var_7.script_animation );
                    }

                    break;
                case "show":
                    var_7 hide();
                    thread quake_event_trigger_wait( ::quake_event_show, var_7 );
                    break;
                case "move_to_end":
                    var_14 = 1;

                    if ( isdefined( var_7.script_parameters ) )
                        var_14 = float( var_7.script_parameters );

                    thread quake_event_trigger_wait( ::quake_event_move_to, var_7, 0.5, var_7.script_delay );
                    break;
                case "gas_leak":
                    if ( isdefined( self.target ) )
                    {
                        var_7.fx_location = common_scripts\utility::getstruct( var_7.target, "targetname" );
                        var_7.hurt_trigger = getent( var_7.target, "targetname" );
                        thread quake_event_trigger_wait( ::quake_event_gas_leak, var_7 );
                    }

                    break;
                case "sound":
                    thread quake_event_trigger_wait( ::quake_event_playsound, var_7 );
                    break;
                default:
                    break;
            }
        }
    }

    var_17 = common_scripts\utility::getstructarray( self.target, "targetname" );

    foreach ( var_19 in var_17 )
    {
        if ( !isdefined( var_19.script_noteworthy ) )
            continue;

        switch ( var_19.script_noteworthy )
        {
            case "fx":
                if ( !isdefined( var_19.script_parameters ) )
                    var_19.script_parameters = "gas_leak";

                if ( !isdefined( var_19.angles ) )
                    var_19.angles = ( 0, 0, 0 );

                var_20 = spawnfx( level._effect[var_19.script_parameters], var_19.origin, anglestoforward( var_19.angles ) );
                thread quake_event_trigger_wait( ::quake_event_fx, var_20 );
                break;
            case "exploder":
                var_21 = var_19.script_prefab_exploder;

                if ( !isdefined( var_21 ) )
                    var_21 = var_19.script_exploder;

                if ( isdefined( var_21 ) )
                    thread quake_event_trigger_wait( ::quake_event_exploder, var_21 );

                break;
            case "sound":
                thread quake_event_trigger_wait( ::quake_event_playsound, var_19 );
                break;
            default:
                break;
        }
    }

    var_23 = getvehiclenodearray( self.target, "targetname" );

    foreach ( var_25 in var_23 )
    {
        if ( !isdefined( var_25.script_noteworthy ) )
            continue;

        switch ( var_25.script_noteworthy )
        {
            case "bats":
                thread quake_event_trigger_wait( ::quake_event_bats, var_25 );
            default:
                break;
        }
    }

    var_27 = maps\mp\_utility::getlinknamenodes();

    foreach ( var_25 in var_27 )
    {
        if ( !isdefined( var_25.script_noteworthy ) )
            continue;

        switch ( var_25.script_noteworthy )
        {
            case "connect_traverse":
                disconnect_traverse( var_25 );
                thread quake_event_trigger_wait( ::quake_event_connect_traverse, var_25 );
                break;
            case "disconnect_traverse":
                thread quake_event_trigger_wait( ::quake_event_disconnect_traverse, var_25 );
                break;
            case "connect":
                var_25 disconnectnode();
                thread quake_event_trigger_wait( ::quake_event_connect_node, var_25 );
                break;
            case "disconnect":
                thread quake_event_trigger_wait( ::quake_event_disconnect_node, var_25 );
                break;
            default:
                break;
        }
    }

    if ( !isdefined( self.count ) )
        self.count = 1;
}

is_dynamic_path()
{
    return isdefined( self.spawnflags ) && self.spawnflags & 1;
}

quake_event_init_ent( var_0 )
{
    var_0.move_ent = var_0;

    if ( !isdefined( var_0.target ) )
        return;

    var_1 = common_scripts\utility::getstructarray( var_0.target, "targetname" );
    var_2 = getentarray( var_0.target, "targetname" );
    var_3 = common_scripts\utility::array_combine( var_1, var_2 );

    foreach ( var_5 in var_3 )
    {
        if ( !isdefined( var_5.script_noteworthy ) )
            continue;

        switch ( var_5.script_noteworthy )
        {
            case "link":
                var_5 linkto( var_0 );
                break;
            case "origin":
                var_0.move_ent = spawn( "script_model", var_5.origin );
                var_0.move_ent.angles = ( 0, 0, 0 );

                if ( isdefined( var_5.angles ) )
                    var_0.move_ent.angles = var_5.angles;

                var_0.move_ent setmodel( "tag_origin" );
                var_0 linkto( var_0.move_ent );
                break;
            case "end":
                var_0.end_location = var_5;
                break;
            case "start":
                if ( var_0 is_dynamic_path() )
                    var_0 connectpaths();

                var_0.origin = var_5.origin;

                if ( isdefined( var_5.angles ) )
                    var_0.angles = var_5.angles;

                break;
            default:
                break;
        }
    }
}

quake_event_move_to( var_0, var_1, var_2, var_3, var_4, var_5, var_6 )
{
    if ( !isdefined( var_1.end_location ) )
        return;

    if ( !isdefined( var_4 ) )
        var_4 = 0;

    if ( !isdefined( var_5 ) )
        var_5 = 0;

    if ( !isdefined( var_6 ) )
        var_6 = 0;

    if ( isdefined( var_3 ) && var_3 > 0 )
        wait( var_3 );

    if ( var_1.end_location.origin != var_1.origin )
        var_1.move_ent moveto( var_1.end_location.origin, var_2, var_4, var_5 );

    if ( isdefined( var_1.end_location.angles ) && var_1.end_location.angles != var_1.angles )
        var_1.move_ent rotateto( var_1.end_location.angles, var_2, var_4, var_5 );

    wait( var_2 );

    if ( var_1 is_dynamic_path() )
        var_1 disconnectpaths();

    if ( var_6 )
    {
        var_1.move_ent delete();

        if ( isdefined( var_1 ) )
            var_1 delete();
    }
}

quake_event_shake( var_0, var_1 )
{

}

quake_event_bats( var_0, var_1 )
{
    var_2 = ( 752, -3536, 132 );
    var_3 = spawn( "script_model", var_2 );
    var_3.angles = ( 0, 0, 0 );
    var_3 setmodel( "generic_prop_raven" );
    common_scripts\utility::waitframe();
    var_4 = spawn( "script_model", var_2 );
    var_4 setmodel( "tag_origin" );
    var_4 linkto( var_3, "j_prop_2" );
    common_scripts\utility::waitframe();
    playfxontag( level._effect["bats"], var_3, "j_prop_2" );
    var_3 scriptmodelplayanimdeltamotion( "mp_lonestar_bat_effect_path" );
    var_4 playloopsound( "mp_quake_bat_lp" );
    wait( getanimlength( %mp_lonestar_bat_effect_path ) );
    var_4 delete();
    var_3 delete();
}

quake_event_hurt( var_0, var_1, var_2, var_3 )
{
    thread quake_hurt_trigger( var_1, var_2, var_3 );
}

quake_hurt_trigger( var_0, var_1, var_2 )
{
    self endon( "stop_hurt_trigger" );
    var_3 = var_0 getentitynumber();
    var_4 = var_1 * 1000;

    for (;;)
    {
        var_0 waittill( "trigger", var_5 );

        if ( !isdefined( var_5.quake_hurt_time ) )
            var_5.quake_hurt_time = [];

        if ( !isdefined( var_5.quake_hurt_time[var_3] ) )
            var_5.quake_hurt_time[var_3] = -1 * var_4;

        if ( var_5.quake_hurt_time[var_3] + var_4 > gettime() )
            continue;

        var_5.quake_hurt_time[var_3] = gettime();
        var_5 dodamage( var_2, var_0.origin );
    }
}

quake_event_show( var_0, var_1 )
{
    var_1 show();
}

quake_event_delete( var_0, var_1 )
{
    var_1 delete();
}

quake_event_fx( var_0, var_1 )
{
    triggerfx( var_1 );
}

quake_event_exploder( var_0, var_1 )
{
    common_scripts\utility::exploder( var_1 );
}

quake_event_send_notify( var_0, var_1, var_2 )
{
    var_1 notify( var_2 );
}

quake_event_animate( var_0, var_1, var_2 )
{
    var_1 scriptmodelplayanimdeltamotion( level.quake_anims[var_2] );

    if ( isdefined( level.quake_anim_funcs[var_2] ) )
    {
        foreach ( var_4 in level.quake_anim_funcs[var_2] )
            level thread [[ var_4 ]]( var_0, var_1 );
    }

    if ( isdefined( level.quake_anims[var_2 + "_loop"] ) && isdefined( level.quake_anims_ref[var_2] ) )
    {
        var_6 = getanimlength( level.quake_anims_ref[var_2] );
        wait( var_6 );
        var_1 scriptmodelplayanim( level.quake_anims[var_1.script_animation + "_loop"] );
    }
}

quake_event_gas_leak( var_0, var_1 )
{
    for (;;)
    {
        var_2 = spawnfx( level._effect["gas_leak_fire"], var_1.fx_location.origin, anglestoforward( var_1.fx_location.angles ) );
        triggerfx( var_2 );
        var_1 playloopsound( "emt_lone_gas_pipe_fire_lp" );
        thread quake_hurt_trigger( var_1.hurt_trigger, 0.25, 10 );
        wait 30;
        self notify( "stop_hurt_trigger" );
        var_2 delete();
        var_1 stoploopsound( "emt_lone_gas_pipe_fire_lp" );
        var_3 = spawnfx( level._effect["gas_leak"], var_1.fx_location.origin, anglestoforward( var_1.fx_location.angles ) );
        triggerfx( var_3 );
        var_1 common_scripts\utility::waittill_notify_or_timeout( "trigger", 30 );
        var_3 delete();
    }
}

quake_event_pole_unlink_nodes()
{
    var_0 = getnodearray( "dog_pole_vault", "script_noteworthy" );

    if ( isdefined( var_0 ) )
        disconnectnodepair( var_0[0], var_0[1] );

    var_1 = getnodearray( "dog_pole_vault2", "script_noteworthy" );

    if ( isdefined( var_1 ) )
        disconnectnodepair( var_1[0], var_1[1] );
}

quake_event_pole_link_nodes()
{
    var_0 = getnodearray( "dog_pole_vault", "script_noteworthy" );

    if ( isdefined( var_0 ) )
    {
        if ( isdefined( var_0[0].target ) && isdefined( var_0[1].targetname ) && var_0[0].target == var_0[1].targetname )
            connectnodepair( var_0[0], var_0[1], 1 );
        else
            connectnodepair( var_0[1], var_0[0], 1 );
    }

    var_1 = getnodearray( "dog_pole_vault2", "script_noteworthy" );

    if ( isdefined( var_1 ) )
    {
        if ( isdefined( var_1[0].target ) && isdefined( var_1[1].targetname ) && var_1[0].target == var_1[1].targetname )
            connectnodepair( var_1[0], var_1[1], 1 );
        else
            connectnodepair( var_1[1], var_1[0], 1 );
    }
}

quake_event_pole_fall_on_car_init( var_0 )
{
    var_1 = getent( "pole_that_falls_on_cop_car_base", "targetname" );

    if ( isdefined( var_1 ) )
        var_1 hide();

    var_2 = getent( "pole_that_falls_on_cop_car", "targetname" );

    if ( !isdefined( var_2 ) )
        return;

    var_3 = getentarray( var_2.target, "targetname" );

    foreach ( var_5 in var_3 )
    {
        if ( var_5.script_noteworthy == "clip_up" )
        {
            var_5 linkto( var_2 );
            var_2.clip_up = var_5;
            continue;
        }

        if ( var_5.script_noteworthy == "clip_down" )
        {
            var_5 connectpaths();
            var_5 common_scripts\utility::trigger_off();
            var_2.clip_down = var_5;
        }
    }

    quake_event_pole_unlink_nodes();
}

quake_event_pole_fall_on_car( var_0, var_1 )
{
    var_2 = getent( "pole_that_falls_on_cop_car_base", "targetname" );

    if ( isdefined( var_2 ) )
        var_2 show();

    var_3 = getent( "pole_that_falls_on_cop_car", "targetname" );

    if ( !isdefined( var_3 ) )
        return;

    var_3 setmodel( "ls_telephone_pole_snap" );
    var_3 playsound( "scn_pole_fall" );
    var_4 = spawn( "script_model", var_3.origin );
    var_4 setmodel( "generic_prop_raven" );
    var_4.angles = var_3.angles;
    var_3 linkto( var_4, "j_prop_1" );
    var_4 scriptmodelplayanimdeltamotion( "mp_lonestar_police_car_crush_pole" );
    var_5 = getnotetracktimes( %mp_lonestar_police_car_crush_pole, "car_swap" );
    var_6 = getanimlength( %mp_lonestar_police_car_crush_pole );
    wait( var_5[0] * var_6 );
    var_1 playsound( "scn_police_car_crush" );
    common_scripts\utility::exploder( 7 );
    var_3.clip_down common_scripts\utility::trigger_on();
    var_3.clip_down disconnectpaths();
    quake_event_pole_link_nodes();
    var_3.clip_up delete();
    var_1 setmodel( "ls_police_sedan_smashed" );

    foreach ( var_8 in level.characters )
    {
        if ( var_8 istouching( var_3.clip_down ) )
            var_8 maps\mp\_movers::mover_suicide();
    }
}

quake_event_playsound( var_0, var_1 )
{
    if ( !isdefined( var_1.script_sound ) )
        return;

    playsoundatpos( var_1.origin, var_1.script_sound );
}

quake_event_disconnect_node( var_0, var_1 )
{
    var_1 disconnectnode();
}

quake_event_connect_node( var_0, var_1 )
{
    var_1 connectnode();
}

quake_event_disconnect_traverse( var_0, var_1 )
{
    disconnect_traverse( var_1 );
}

disconnect_traverse( var_0 )
{
    if ( !isdefined( var_0.end_nodes ) )
        var_0.end_nodes = getnodearray( var_0.target, "targetname" );

    foreach ( var_2 in var_0.end_nodes )
        disconnectnodepair( var_0, var_2, 1 );
}

quake_event_connect_traverse( var_0, var_1 )
{
    connect_traverse( var_1 );
}

connect_traverse( var_0 )
{
    if ( !isdefined( var_0.end_nodes ) )
        var_0.end_nodes = getnodearray( var_0.target, "targetname" );

    foreach ( var_2 in var_0.end_nodes )
        connectnodepair( var_0, var_2, 1 );
}
