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

main()
{
    level._effect["vfx_alien_bcn_miniboss_breach"] = loadfx( "vfx/moments/alien/vfx_alien_bcn_miniboss_breach" );
    level._effect["vfx_alien_bcn_miniboss_smash"] = loadfx( "vfx/moments/alien/vfx_alien_bcn_miniboss_smash" );
    level._effect["vfx_alien_bcn_miniboss_bang"] = loadfx( "vfx/moments/alien/vfx_alien_bcn_miniboss_bang" );
    level._effect["vfx_alien_tentacledoor_rainmist"] = loadfx( "vfx/moments/alien/vfx_alien_tentacledoor_rainmist" );
    level._effect["vfx_alien_beacon_ceiling_hit_dust"] = loadfx( "vfx/moments/alien/vfx_alien_beacon_ceiling_hit_dust" );
    level._effect["vfx_alien_beacon_light_burst"] = loadfx( "vfx/moments/alien/vfx_alien_beacon_light_burst" );
    level._effect["vfx_rain_ground_door"] = loadfx( "vfx/ambient/weather/rain/vfx_rain_ground_door" );
    level._effect["vfx_alien_beacon_cargo_light"] = loadfx( "vfx/moments/alien/vfx_alien_beacon_cargo_light" );
    level._effect["electrical_sparks_20_funner_far"] = loadfx( "vfx/ambient/sparks/electrical_sparks_20_funner_far" );
    level._effect["vfx_alien_bcn_miniboss_smash_02"] = loadfx( "vfx/moments/alien/vfx_alien_bcn_miniboss_smash_02" );
    level._effect["vfx_alien_tentacle_drips_static_emit"] = loadfx( "vfx/gameplay/alien/vfx_alien_tentacle_drips_static_emit" );
    level._effect["vfx_alien_tentacle_drips_emit"] = loadfx( "vfx/gameplay/alien/vfx_alien_tentacle_drips_emit" );
    level._effect["pipe_steam_looping_lrg_far"] = loadfx( "fx/impacts/pipe_steam_looping_lrg_far" );
    level._effect["splash_back"] = loadfx( "vfx/moments/alien/vfx_alien_water_explosion_kraken_back_01" );
    level._effect["splash_emerging_stage_one"] = loadfx( "vfx/moments/alien/vfx_alien_kraken_emerge_01" );
    level._effect["splash_emerging_stage_one_v2"] = loadfx( "vfx/moments/alien/vfx_alien_kraken_emerge_01_v2" );
    level._effect["splash_emerging_stage_two"] = loadfx( "vfx/moments/alien/vfx_alien_kraken_emerge_02" );
    level._effect["splash_submerging_stage_one"] = loadfx( "vfx/moments/alien/vfx_alien_kraken_submerge_01" );
    level._effect["splash_death_stage_one"] = loadfx( "vfx/moments/alien/vfx_alien_kraken_death_splash_01" );
    level._effect["splash_death_stage_two"] = loadfx( "vfx/moments/alien/vfx_alien_kraken_death_splash_02" );
    level._effect["kraken_blood_wall"] = loadfx( "vfx/moments/alien/blood_wall_karken" );
    level._effect["tentacle_hit_heat"] = loadfx( "vfx/gameplay/alien/kraken_tentacle_impact_heat" );
    level._effect["vfx_alien_krak_emp_edge"] = loadfx( "vfx/gameplay/alien/vfx_alien_krak_emp_edge" );
    level._effect["boss_turret_smoke"] = loadfx( "vfx/gameplay/alien/vfx_turret_offline_smoke" );
    level._effect["player_emp_scrn_fx"] = loadfx( "vfx/gameplay/alien/vfx_alien_scrnfx_emp_flicker" );
    level._effect["vfx_rain_drips_pour"] = loadfx( "vfx/ambient/weather/rain/vfx_rain_drips_pour" );
    level._effect["vfx_rain_blowoff"] = loadfx( "vfx/ambient/weather/rain/vfx_rain_blowoff" );
    level._effect["vfx_alien_dock_foam"] = loadfx( "vfx/moments/alien/vfx_alien_dock_foam" );
    level._effect["vfx_alien_baydoor_rainmist"] = loadfx( "vfx/moments/alien/vfx_alien_baydoor_rainmist" );
    level._effect["vfx_alien_cargodoor_rainmist"] = loadfx( "vfx/moments/alien/vfx_alien_cargodoor_rainmist" );
    level._effect["vfx_alien_cargo_rainmist"] = loadfx( "vfx/moments/alien/vfx_alien_cargo_rainmist" );
    level._effect["vfx_object_rain_mist"] = loadfx( "vfx/moments/alien/vfx_object_rain_mist" );
    level._effect["factory_floodlight_rain"] = loadfx( "vfx/moments/factory/factory_floodlight_rain" );
    level._effect["drips_fast"] = loadfx( "fx/misc/drips_fast" );
    level._effect["rain_splash_200x200_lrg"] = loadfx( "vfx/ambient/weather/rain/rain_splash_200x200_lrg" );
    level._effect["rain_splash_400x400_lrg"] = loadfx( "vfx/ambient/weather/rain/rain_splash_400x400_lrg" );
    level._effect["horizon_fog"] = loadfx( "vfx/ambient/alien/vfx_alien_beacon_horizonfog" );
    level._effect["vfx_alien_beacon_intro_horizonfog"] = loadfx( "vfx/ambient/alien/vfx_alien_beacon_intro_horizonfog" );
    level._effect["rain_mp_bootleg"] = loadfx( "vfx/ambient/alien/vfx_alien_rain_heavy" );
    level._effect["vfx_alien_hive_steam_long"] = loadfx( "vfx/ambient/alien/vfx_alien_hive_steam_long" );
    level._effect["vfx_alien_hive_drip"] = loadfx( "vfx/ambient/alien/vfx_alien_hive_drip" );
    level._effect["vfx_alien_drill_door"] = loadfx( "vfx/gameplay/alien/vfx_alien_drill_door" );
    level._effect["vfx_alien_drill_door_laser"] = loadfx( "vfx/gameplay/alien/vfx_alien_drill_door_laser" );
    level._effect["vfx_alien_drill_door_laser_loop"] = loadfx( "vfx/gameplay/alien/vfx_alien_drill_door_laser_loop" );
    level._effect["electrical_sparks_20_funner"] = loadfx( "vfx/ambient/sparks/electrical_sparks_20_funner" );
    level._effect["electrical_sparks_20_funner2"] = loadfx( "vfx/ambient/sparks/electrical_sparks_20_funner2" );
    level._effect["vfx_alien_beacon_lightning_run"] = loadfx( "vfx/moments/alien/vfx_alien_beacon_lightning_run" );
    level._effect["vfx_alien_beacon_lightning"] = loadfx( "vfx/moments/alien/vfx_alien_beacon_lightning" );
    level._effect["vfx_dust_motes"] = loadfx( "vfx/ambient/atmospheric/vfx_dust_motes" );
    level._effect["vfx_alien_room_mist_lrg"] = loadfx( "vfx/moments/alien/vfx_alien_room_mist_lrg" );
    level._effect["vfx_alien_room_mist"] = loadfx( "vfx/moments/alien/vfx_alien_room_mist" );
    level._effect["vfx_alien_beacon_steam"] = loadfx( "vfx/moments/alien/vfx_alien_beacon_steam" );
    level._effect["pipe_steam_looping_far"] = loadfx( "fx/impacts/pipe_steam_looping_far" );
    level._effect["beacon_stormsky"] = loadfx( "vfx/clouds/vfx_skyanim_beacon" );
    level._effect["storm_rays"] = loadfx( "vfx/ambient/alien/alien_godray_vista" );
    level._effect["storm_rays_ground"] = loadfx( "vfx/ambient/alien/alien_godray_groundglow_vista" );
    level._effect["alien_dockdoor_darkness"] = loadfx( "vfx/ambient/alien/alien_dockdoor_darkness" );
    level._effect["vfx_alien_hover_door_splash"] = loadfx( "vfx/ambient/alien/vfx_alien_hover_door_splash" );
    level._effect["vfx_alien_hovercraft_splash"] = loadfx( "vfx/ambient/alien/vfx_alien_hovercraft_splash" );
    level._effect["vfx_alien_hovercraft_splash_side"] = loadfx( "vfx/ambient/alien/vfx_alien_hovercraft_splash_side" );
    level._effect["vfx_scrnfx_waterdrops_area"] = loadfx( "vfx/gameplay/screen_effects/vfx_scrnfx_waterdrops_area" );
    level._effect["vfx_scrnfx_waterdrops_5_cam_run"] = loadfx( "vfx/gameplay/screen_effects/vfx_scrnfx_waterdrops_5_cam_run" );
    level._effect["vfx_mist_glow_orange_huge"] = loadfx( "vfx/ambient/weather/mist/vfx_mist_glow_orange_huge" );
    level._effect["boat_rain_splashes_run"] = loadfx( "vfx/moments/alien/boat_rain_splashes_run" );
    level._effect["factory_floodlight"] = loadfx( "vfx/moments/alien/alien_beacon_floodlight" );
    level._effect["floodlight_orange"] = loadfx( "vfx/moments/alien/alien_beacon_floodlight_orange" );
    level._effect["blinkylight_red"] = loadfx( "vfx/moments/alien/alien_beacon_blinky_light" );
    level._effect["blinkylight_green"] = loadfx( "vfx/moments/alien/alien_beacon_blinky_light_green" );
    level._effect["helipad_light"] = loadfx( "vfx/moments/alien/alien_beacon_helipad_light" );
    level._effect["glow_red_light_100_nolight"] = loadfx( "vfx/ambient/lights/vfx_glow_red_light_100_nolight" );
    level._effect["vfx_lens_flare_white"] = loadfx( "vfx/ambient/lights/vfx_lens_flare_white" );
    level._effect["warm_ceiling_light_cone"] = loadfx( "vfx/ambient/lights/warm_ceiling_light_cone_02" );
    level._effect["vfx_mist_glow_orange"] = loadfx( "vfx/ambient/weather/mist/vfx_mist_glow_orange" );
    level._effect["vfx_mist_glow_white"] = loadfx( "vfx/ambient/weather/mist/vfx_mist_glow_white" );
    level._effect["baydoors_lightglow"] = loadfx( "vfx/ambient/alien/alien_baydoors_glow" );
    level._effect["vfx_glow_green_light_100_nolight_far"] = loadfx( "vfx/ambient/lights/vfx_glow_green_light_100_nolight_far" );
    level._effect["vfx_glow_red_light_100_nolight_far"] = loadfx( "vfx/ambient/lights/vfx_glow_red_light_100_nolight_far" );
    level._effect["alien_dockdoor_glow"] = loadfx( "vfx/ambient/alien/alien_dockdoor_glow" );
    level._effect["beacon_cross_gas_bot"] = loadfx( "vfx/moments/alien/beacon_cross_gas_bot" );
    level._effect["beacon_cross_gas_top"] = loadfx( "vfx/moments/alien/beacon_cross_gas_top" );
    level._effect["beacon_cross_gas_window"] = loadfx( "vfx/moments/alien/beacon_cross_gas_window" );
    level._effect["beacon_cross_gas_small"] = loadfx( "vfx/moments/alien/beacon_cross_gas_smll" );
    level._effect["beacon_cross_gas_rush_out"] = loadfx( "vfx/moments/alien/beacon_cross_gas_rush_out" );
    level._effect["green_light"] = loadfx( "vfx/ambient/lights/vfx_green_light_120_nolight" );
    level._effect["vfx_spark_drip_r"] = loadfx( "vfx/moments/mp_redriver/vfx_spark_drip_r" );
    level._effect["alien_cloaking"] = loadfx( "vfx/gameplay/alien/vfx_alien_tele_trail_01" );
    level._effect["alien_uncloaking"] = loadfx( "vfx/gameplay/alien/vfx_alien_tele_trail_02" );
    level._effect["challenge_ring"] = loadfx( "vfx/gameplay/alien/vfx_alien_chopper_escape_ring" );
    level._effect["boatlight_ambient"] = loadfx( "vfx/ambient/alien/alien_boatlight_glow" );
    level._effect["alien_gib"] = loadfx( "vfx/gameplay/alien/vfx_alien_pipebomb_gib_01" );
    level._effect["sticky_flare"] = loadfx( "vfx/gameplay/alien/sticky_flare_dyn_orange" );
    level._effect["bot_headlight"] = loadfx( "vfx/moments/alien/vfx_alien_flashlight_bright" );
    level._effect["vfx_alien_heated_deck_steam_01"] = loadfx( "vfx/gameplay/alien/vfx_alien_heated_deck_steam_01" );
    level._effect["vfx_alien_heated_deck_steam_01_runner"] = loadfx( "vfx/gameplay/alien/vfx_alien_heated_deck_steam_01_runner" );
    level._effect["alien_ark_gib"] = loadfx( "vfx/gameplay/alien/vfx_alien_ark_gib_01" );
    maps\mp\agents\alien\_alien_seeder::load_seeder_fx();
    thread fx_intro_lightning();
    thread beacon_door_drilling_fx();
    thread fx_hide_top_deck_water();
    thread fx_top_deck_horizon_fog();
    thread fx_intofog_horizon_fog();
    level thread fx_cargo_lights_explode();
}

fx_hide_top_deck_water()
{
    var_0 = getent( "top_deck_water", "targetname" );
    var_1 = getent( "intro_water", "targetname" );
    var_0 hide();
    level waittill( "crane_started" );
    wait 8;
    var_0 show();
    var_1 hide();
}

fx_raindrops_screenfx_intro()
{
    level waittill( "boat_spawn", var_0 );
    var_0 thread fx_raindrops_intro();
}

fx_raindrops_intro()
{
    self endon( "disconnect" );
    var_0 = spawnfx( level._effect["vfx_scrnfx_waterdrops_5_cam_run"], self.origin );
    triggerfx( var_0 );
    var_0 thread fx_raindrops_intro_delete();
}

fx_raindrops_intro_delete()
{
    wait 26;

    if ( isdefined( self ) )
        self delete();
}

fx_tenticle_enter_water_fx()
{
    wait 3;
    playfxontag( level._effect["vfx_alien_tentacle_drips_emit"], level.miniboss, "J_tentacle_26" );
    wait 1;
    playfxontag( level._effect["vfx_alien_tentacle_drips_static_emit"], level.miniboss, "J_tentacle_25" );
    wait 0.5;
    playfxontag( level._effect["vfx_alien_tentacle_drips_static_emit"], level.miniboss, "J_tentacle_23" );
}

fx_cargo_lights_explode()
{
    level waittill( "miniboss_door_is_open" );
    var_0 = ( -1276.84, -36.6743, 81.9476 );
    var_1 = ( 36.2, 90, 0 );
    var_2 = anglestoup( var_1 );
    var_3 = anglestoforward( var_1 );
    var_4 = spawnfx( level._effect["vfx_alien_beacon_cargo_light"], var_0, var_3, var_2 );
    triggerfx( var_4 );
    var_0 = ( -1212.65, -35.7028, 81.9939 );
    var_1 = ( 36.2, 90, 0 );
    var_2 = anglestoup( var_1 );
    var_3 = anglestoforward( var_1 );
    var_5 = spawnfx( level._effect["vfx_alien_beacon_cargo_light"], var_0, var_3, var_2 );
    triggerfx( var_5 );

    for ( var_6 = 0; var_6 < 2; var_6++ )
    {
        level waittill( "left_is_hit" );

        if ( var_6 == 0 )
        {
            var_4 delete();
            common_scripts\utility::exploder( 17 );
        }

        if ( var_6 == 1 )
        {
            var_5 delete();
            common_scripts\utility::exploder( 18 );
        }
    }
}

fx_intofog_horizon_fog()
{
    wait 6;
    common_scripts\utility::exploder( 54 );
}

fx_top_deck_horizon_fog()
{
    level waittill( "crane_started" );
    var_0 = ( 4369.35, 2723.26, 1210.42 );
    var_1 = ( 360, 360, 0 );
    var_2 = anglestoup( var_1 );
    var_3 = anglestoforward( var_1 );
    var_4 = spawnfx( level._effect["horizon_fog"], var_0, var_3, var_2 );
    triggerfx( var_4 );
}

fx_intro_lightning()
{
    wait 17;
    common_scripts\utility::exploder( 11 );

    foreach ( var_1 in level.players )
        var_1 playsound( "scn_beacon_intro_lightning" );
}

fx_boatride_splashes()
{
    var_0 = ( -4840.26, 6661.55, 3484.91 );
    var_1 = ( 0, 312, 0 );
    var_2 = anglestoup( var_1 );
    var_3 = anglestoforward( var_1 );
    var_4 = spawnfx( level._effect["vfx_mist_glow_orange_huge"], var_0, var_3, var_2 );
    triggerfx( var_4 );
    playfxontag( level._effect["vfx_alien_hovercraft_splash"], level.boat_vehicle, "TAG_FX_WATER_SPLASH5" );
    wait 0.2;
    playfxontag( level._effect["vfx_alien_hovercraft_splash_side"], level.boat_vehicle, "TAG_FX_WATER_SPLASH8" );
    wait 0.2;
    playfxontag( level._effect["vfx_alien_hovercraft_splash_side"], level.boat_vehicle, "TAG_FX_WATER_SPLASH2" );
    wait 0.2;
    playfxontag( level._effect["boat_rain_splashes_run"], level.boat_vehicle, "TAG_TANK_BACK" );
    wait 25;
    stopfxontag( level._effect["vfx_alien_hovercraft_splash"], level.boat_vehicle, "TAG_FX_WATER_SPLASH5" );
    playfxontag( level._effect["vfx_alien_hover_door_splash"], level.boat_vehicle, "TAG_FX_WATER_SPLASH5" );
    wait 0.2;
    stopfxontag( level._effect["vfx_alien_hovercraft_splash_side"], level.boat_vehicle, "TAG_FX_WATER_SPLASH8" );
    wait 0.2;
    stopfxontag( level._effect["vfx_alien_hovercraft_splash_side"], level.boat_vehicle, "TAG_FX_WATER_SPLASH2" );
    wait 0.2;
    common_scripts\utility::exploder( 10 );
    var_4 delete();
}

ship_camera_tilting()
{
    level waittill( "boat_ride_over" );
    var_0 = spawn( "script_model", ( 0, 0, 0 ) );
    var_0.angles = ( 0, 0, 0 );
    level.pause_tilting = 0;
    var_1 = 0;
    level thread ship_camera_tilting_watcher();

    foreach ( var_3 in level.players )
        var_3 playersetgroundreferenceent( var_0 );

    for (;;)
    {
        var_5 = randomfloatrange( -1.5, 1.5 );
        var_6 = randomfloatrange( -0.6, 0.6 );
        var_7 = randomfloatrange( 2, 7 );
        var_8 = var_7 * 0.3;

        if ( level.pause_tilting )
        {
            if ( !var_1 )
            {
                var_0 rotateto( ( 0, 0, 0 ), var_7, var_8, var_8 );
                var_1 = 1;
            }
        }
        else
        {
            var_0 rotateto( ( var_5, 0, var_6 ), var_7, var_8, var_8 );
            var_1 = 0;
        }

        wait( var_7 );
    }
}

ship_camera_tilting_watcher()
{
    for (;;)
    {
        var_0 = level common_scripts\utility::waittill_any_return( "drill_planted", "drill_detonated" );

        if ( var_0 == "drill_planted" )
            level.pause_tilting = 1;
        else
            level.pause_tilting = 0;

        wait 0.2;
    }
}

beacon_door_drilling_fx()
{
    level thread beacon_door_drilling_stop_fx();

    for (;;)
    {
        level waittill( "drill_start_door_fx", var_0 );
        wait 2;

        if ( !isdefined( level.drill ) )
            return;

        wait 2;
        var_1 = 0;

        if ( level.encounter_name == "cargo_area_main" )
            var_1 = 1;

        playfxontag( level._effect["vfx_alien_drill_door"], level.drill, "tag_laser_end" );

        if ( isdefined( var_0 ) )
        {
            playfxontag( level._effect["vfx_alien_drill_door_laser_loop"], level.drill, "tag_laser" );
            wait( var_0 - 3 );
        }
        else
        {
            playfxontag( level._effect["vfx_alien_drill_door_laser"], level.drill, "tag_laser" );
            wait 25;
        }

        if ( var_1 )
            thread sfx_drill_off_cargo_blocker();
        else
            thread maps\mp\alien\_drill::sfx_drill_off( 1 );

        stopfxontag( level._effect["vfx_alien_drill_door_laser"], level.drill, "tag_laser" );
        stopfxontag( level._effect["vfx_alien_drill_door"], level.drill, "tag_laser_end" );

        if ( !isdefined( level.drill ) )
            return;
    }
}

beacon_door_drilling_stop_fx()
{
    for (;;)
    {
        var_0 = level common_scripts\utility::waittill_any_return( "drill_stop_door_fx", "drill_destroyed" );

        if ( !isdefined( level.drill ) )
            return;

        stopfxontag( level._effect["vfx_alien_drill_door"], level.drill, "tag_laser_end" );

        if ( isdefined( var_0 ) && var_0 == "drill_destroyed" )
            stopfxontag( level._effect["vfx_alien_drill_door_laser"], level.drill, "tag_laser" );

        wait 0.5;
    }
}

sfx_drill_off_cargo_blocker()
{
    var_0 = level.drill.origin;
    var_1 = ( -78, 840, 332 );
    var_2 = ( -515, 846, 332 );
    playsoundatpos( var_0, "alien_laser_drill_stop" );

    if ( isdefined( level.drill_sfx_lp ) )
        level.drill_sfx_lp delete();

    if ( isdefined( level.drill_sfx_dist_lp ) )
        level.drill_sfx_dist_lp delete();

    if ( isdefined( level.drill_overheat_lp_02 ) )
        level.drill_overheat_lp_02 delete();

    wait 0.1;
    playsoundatpos( var_1, "alien_laser_drill_door_open_quake" );
    wait 0.2;
    playsoundatpos( var_2, "alien_laser_drill_door_open_quake" );
    wait 5.4;
    playsoundatpos( var_1, "alien_laser_drill_door_open_cargo_01" );
    wait 0.1;
    playsoundatpos( var_2, "alien_laser_drill_door_open_cargo_02" );
}
