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

init_combat_resources()
{
    if ( !isdefined( level.alien_combat_resources_table ) )
        level.alien_combat_resources_table = "mp/alien/dpad_tree.csv";

    init_combat_resource_callback();
    init_combat_resource_overrides();
    init_combat_resource_from_table();
    init_sentry_function_pointers();
    init_ims_upgrade_function_pointers();
    init_ball_drone_upgrade_function_pointers();
}

init_sentry_function_pointers()
{
    level.createsentryforplayer_func = maps\mp\alien\_autosentry_alien::createsentryforplayer;
    level.sentry_setcarried_func = maps\mp\alien\_autosentry_alien::sentry_setcarried;
    level.sentry_setplaced_func = maps\mp\alien\_autosentry_alien::sentry_setplaced;
    level.sentry_setcancelled_func = maps\mp\alien\_autosentry_alien::sentry_setcancelled;
}

init_combat_resource_callback()
{
    level.alien_combat_resource_callbacks = [];
    level.alien_combat_resource_callbacks["dpad_team_ammo_reg"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_ammo_reg"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_ammo_reg"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_ammo_reg"].tryuse = ::tryuse_dpad_team_ammo;
    level.alien_combat_resource_callbacks["dpad_team_ammo_reg"].use = ::use_dpad_team_ammo;
    level.alien_combat_resource_callbacks["dpad_team_ammo_reg"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_team_armor"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_armor"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_armor"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_armor"].tryuse = ::tryuse_dpad_team_armor;
    level.alien_combat_resource_callbacks["dpad_team_armor"].use = ::use_dpad_team_armor;
    level.alien_combat_resource_callbacks["dpad_team_armor"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_team_explosives"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_explosives"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_explosives"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_explosives"].tryuse = ::tryuse_dpad_team_explosives;
    level.alien_combat_resource_callbacks["dpad_team_explosives"].use = ::use_dpad_team_explosives;
    level.alien_combat_resource_callbacks["dpad_team_explosives"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_team_randombox"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_randombox"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_randombox"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_randombox"].tryuse = ::tryuse_dpad_team_randombox;
    level.alien_combat_resource_callbacks["dpad_team_randombox"].use = ::use_dpad_team_randombox;
    level.alien_combat_resource_callbacks["dpad_team_randombox"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_team_boost"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_boost"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_boost"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_boost"].tryuse = ::tryuse_dpad_team_boost;
    level.alien_combat_resource_callbacks["dpad_team_boost"].use = ::use_dpad_team_boost;
    level.alien_combat_resource_callbacks["dpad_team_boost"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_team_adrenaline"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_adrenaline"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_adrenaline"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_adrenaline"].tryuse = ::tryuse_dpad_team_adrenaline;
    level.alien_combat_resource_callbacks["dpad_team_adrenaline"].use = ::use_dpad_team_adrenaline;
    level.alien_combat_resource_callbacks["dpad_team_adrenaline"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_ims"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_ims"].canuse = ::alt_canuse;
    level.alien_combat_resource_callbacks["dpad_ims"].canpurchase = ::canpurchase_dpad_ims;
    level.alien_combat_resource_callbacks["dpad_ims"].tryuse = ::tryuse_dpad_ims;
    level.alien_combat_resource_callbacks["dpad_ims"].use = ::use_dpad_ims;
    level.alien_combat_resource_callbacks["dpad_ims"].canceluse = ::canceluse_dpad_ims;
    level.alien_combat_resource_callbacks["dpad_sentry"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_sentry"].canuse = ::alt_canuse;
    level.alien_combat_resource_callbacks["dpad_sentry"].canpurchase = ::canpurchase_dpad_sentry;
    level.alien_combat_resource_callbacks["dpad_sentry"].tryuse = ::tryuse_dpad_sentry;
    level.alien_combat_resource_callbacks["dpad_sentry"].use = ::use_dpad_sentry;
    level.alien_combat_resource_callbacks["dpad_sentry"].canceluse = ::canceluse_dpad_sentry;
    level.alien_combat_resource_callbacks["dpad_gl_sentry"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_gl_sentry"].canuse = ::alt_canuse;
    level.alien_combat_resource_callbacks["dpad_gl_sentry"].canpurchase = ::canpurchase_dpad_glsentry;
    level.alien_combat_resource_callbacks["dpad_gl_sentry"].tryuse = ::tryuse_dpad_glsentry;
    level.alien_combat_resource_callbacks["dpad_gl_sentry"].use = ::use_dpad_glsentry;
    level.alien_combat_resource_callbacks["dpad_gl_sentry"].canceluse = ::canceluse_dpad_glsentry;
    level.alien_combat_resource_callbacks["dpad_minigun_turret"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_minigun_turret"].canuse = ::alt_canuse;
    level.alien_combat_resource_callbacks["dpad_minigun_turret"].canpurchase = ::canpurchase_dpad_minigun_turret;
    level.alien_combat_resource_callbacks["dpad_minigun_turret"].tryuse = ::tryuse_dpad_minigun_turret;
    level.alien_combat_resource_callbacks["dpad_minigun_turret"].use = ::use_dpad_minigun_turret;
    level.alien_combat_resource_callbacks["dpad_minigun_turret"].canceluse = ::canceluse_dpad_minigun_turret;
    level.alien_combat_resource_callbacks["dpad_backup_buddy"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_backup_buddy"].canuse = ::alt_canuse;
    level.alien_combat_resource_callbacks["dpad_backup_buddy"].canpurchase = ::canpurchase_dpad_backup_buddy;
    level.alien_combat_resource_callbacks["dpad_backup_buddy"].tryuse = ::tryuse_dpad_backup_buddy;
    level.alien_combat_resource_callbacks["dpad_backup_buddy"].use = ::use_dpad_backup_buddy;
    level.alien_combat_resource_callbacks["dpad_backup_buddy"].canceluse = ::canceluse_dpad_backup_buddy;
    level.alien_combat_resource_callbacks["dpad_mortar"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_mortar"].canuse = ::alt_canuse;
    level.alien_combat_resource_callbacks["dpad_mortar"].canpurchase = ::default_canpurchase;
    level.alien_combat_resource_callbacks["dpad_mortar"].tryuse = ::tryuse_dpad_airstrike;
    level.alien_combat_resource_callbacks["dpad_mortar"].use = ::use_dpad_airstrike;
    level.alien_combat_resource_callbacks["dpad_mortar"].canceluse = ::canceluse_dpad_airstrike;
    level.alien_combat_resource_callbacks["dpad_war_machine"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_war_machine"].canuse = ::alt_canuse;
    level.alien_combat_resource_callbacks["dpad_war_machine"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_war_machine"].tryuse = ::tryuse_dpad_war_machine;
    level.alien_combat_resource_callbacks["dpad_war_machine"].use = ::use_dpad_war_machine;
    level.alien_combat_resource_callbacks["dpad_war_machine"].canceluse = ::canceluse_dpad_war_machine;
    level.alien_combat_resource_callbacks["dpad_death_machine"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_death_machine"].canuse = ::alt_canuse;
    level.alien_combat_resource_callbacks["dpad_death_machine"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_death_machine"].tryuse = ::tryuse_dpad_death_machine;
    level.alien_combat_resource_callbacks["dpad_death_machine"].use = ::use_dpad_death_machine;
    level.alien_combat_resource_callbacks["dpad_death_machine"].canceluse = ::canceluse_dpad_death_machine;
    level.alien_combat_resource_callbacks["dpad_predator"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_predator"].canuse = ::alt_canuse;
    level.alien_combat_resource_callbacks["dpad_predator"].canpurchase = ::default_canpurchase;
    level.alien_combat_resource_callbacks["dpad_predator"].tryuse = ::tryuse_dpad_predator;
    level.alien_combat_resource_callbacks["dpad_predator"].use = ::use_dpad_predator;
    level.alien_combat_resource_callbacks["dpad_predator"].canceluse = ::canceluse_dpad_predator;
    level.alien_combat_resource_callbacks["dpad_riotshield"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_riotshield"].canuse = ::alt_canuse;
    level.alien_combat_resource_callbacks["dpad_riotshield"].canpurchase = ::canpurchase_dpad_riotshield;
    level.alien_combat_resource_callbacks["dpad_riotshield"].tryuse = ::tryuse_dpad_riotshield;
    level.alien_combat_resource_callbacks["dpad_riotshield"].use = ::use_dpad_riotshield;
    level.alien_combat_resource_callbacks["dpad_riotshield"].canceluse = ::canceluse_dpad_riotshield;
    level.alien_combat_resource_callbacks["dpad_team_ammo_stun"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_ammo_stun"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_ammo_stun"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_ammo_stun"].tryuse = ::tryuse_dpad_team_specialammo;
    level.alien_combat_resource_callbacks["dpad_team_ammo_stun"].use = ::use_dpad_team_specialammo;
    level.alien_combat_resource_callbacks["dpad_team_ammo_stun"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_team_ammo_explo"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_ammo_explo"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_ammo_explo"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_ammo_explo"].tryuse = ::tryuse_dpad_team_specialammo_explo;
    level.alien_combat_resource_callbacks["dpad_team_ammo_explo"].use = ::use_dpad_team_specialammo_explo;
    level.alien_combat_resource_callbacks["dpad_team_ammo_explo"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_team_ammo_ap"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_ammo_ap"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_ammo_ap"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_ammo_ap"].tryuse = ::tryuse_dpad_team_specialammo_ap;
    level.alien_combat_resource_callbacks["dpad_team_ammo_ap"].use = ::use_dpad_team_specialammo;
    level.alien_combat_resource_callbacks["dpad_team_ammo_ap"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_team_ammo_in"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_ammo_in"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_ammo_in"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_ammo_in"].tryuse = ::tryuse_dpad_team_specialammo_in;
    level.alien_combat_resource_callbacks["dpad_team_ammo_in"].use = ::use_dpad_team_specialammo_in;
    level.alien_combat_resource_callbacks["dpad_team_ammo_in"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_team_currency"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_team_currency"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_team_currency"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_team_currency"].tryuse = ::tryuse_dpad_team_currency;
    level.alien_combat_resource_callbacks["dpad_team_currency"].use = ::use_dpad_team_currency;
    level.alien_combat_resource_callbacks["dpad_team_currency"].canceluse = ::canceluse_default_deployable_box;
    level.alien_combat_resource_callbacks["dpad_placeholder_ammo_2"] = spawnstruct();
    level.alien_combat_resource_callbacks["dpad_placeholder_ammo_2"].canuse = ::default_canuse;
    level.alien_combat_resource_callbacks["dpad_placeholder_ammo_2"].canpurchase = ::alt_canpurchase;
    level.alien_combat_resource_callbacks["dpad_placeholder_ammo_2"].tryuse = ::tryuse_dpad_team_specialammo_comb;
    level.alien_combat_resource_callbacks["dpad_placeholder_ammo_2"].use = ::use_dpad_team_specialammo_comb;
    level.alien_combat_resource_callbacks["dpad_placeholder_ammo_2"].canceluse = ::canceluse_default_deployable_box;
    level.mortar_fx["tracer"] = loadfx( "fx/misc/tracer_incoming" );
    level.mortar_fx["explosion"] = loadfx( "vfx/gameplay/alien/vfx_alien_mortar_explosion" );
    level._effect["stun_attack"] = loadfx( "vfx/gameplay/alien/vfx_alien_stun_ammo_attack" );
    level._effect["stun_shock"] = loadfx( "vfx/gameplay/alien/vfx_alien_tesla_shock" );
}

init_ims_upgrade_function_pointers()
{
    level.ims_alien_fire_func = ::ims_fire_cloud;
    level.ims_alien_grace_period_func = ::ims_grace_period_scalar;
}

init_ball_drone_upgrade_function_pointers()
{
    level.ball_drone_alien_timeout_func = ::ball_drone_timeout_scalar;
    level.ball_drone_faster_rocket_func = ::ball_drone_fire_rocket_scalar;
}

init_combat_resource_overrides()
{
    level.imssettings = [];
    var_0 = spawnstruct();
    var_0.weaponinfo = "alienims_projectile_mp";
    var_0.modelbase = "ims_scorpion_body_iw6";
    var_0.modelplacement = "ims_scorpion_body_iw6_placement";
    var_0.modelplacementfailed = "ims_scorpion_body_iw6_placement_failed";
    var_0.modeldestroyed = "ims_scorpion_body_iw6";
    var_0.modelbombsquad = "ims_scorpion_body_iw6_bombsquad";
    var_0.hintstring = &"ALIEN_COLLECTIBLES_IMS_PICKUP";
    var_0.placestring = &"ALIEN_COLLECTIBLES_IMS_PLACE";
    var_0.cannotplacestring = &"ALIEN_COLLECTIBLES_IMS_CANNOT_PLACE";
    var_0.streakname = "alien_ims";
    var_0.splashname = "used_ims";
    var_0.lifespan = 600.0;
    var_0.graceperiod = 0.8;
    var_0.rearmtime = 2.0;
    var_0.numexplosives = 4;
    var_0.attacks = var_0.numexplosives;
    var_0.explosivemodel = "ims_scorpion_explosive_iw6";
    var_0.placementheighttolerance = 11.5;
    var_0.placementradius = 24.0;
    var_0.lidtagroot = "tag_lid";
    var_0.lidopenanims = [];
    var_0.lidopenanims[1] = "IMS_Scorpion_door_1";
    var_0.lidopenanims[2] = "IMS_Scorpion_door_2";
    var_0.lidopenanims[3] = "IMS_Scorpion_door_3";
    var_0.lidopenanims[4] = "IMS_Scorpion_door_4";
    var_0.lidsnapopenanims = [];
    var_0.lidsnapopenanims[1] = "IMS_Scorpion_1_opened";
    var_0.lidsnapopenanims[2] = "IMS_Scorpion_2_opened";
    var_0.lidsnapopenanims[3] = "IMS_Scorpion_3_opened";
    var_0.expltagroot = "tag_explosive";
    var_0.killcamoffset = ( 0, 0, 12 );
    var_0.maxhealth = 1000;
    level.imssettings["alien_ims"] = var_0;
    var_0 = spawnstruct();
    var_0.weaponinfo = "alienims_projectileradius_mp";
    var_0.modelbase = "ims_scorpion_body_iw6";
    var_0.modelplacement = "ims_scorpion_body_iw6_placement";
    var_0.modelplacementfailed = "ims_scorpion_body_iw6_placement_failed";
    var_0.modeldestroyed = "ims_scorpion_body_iw6";
    var_0.modelbombsquad = "ims_scorpion_body_iw6_bombsquad";
    var_0.hintstring = &"ALIEN_COLLECTIBLES_IMS_PICKUP";
    var_0.placestring = &"ALIEN_COLLECTIBLES_IMS_PLACE";
    var_0.cannotplacestring = &"ALIEN_COLLECTIBLES_IMS_CANNOT_PLACE";
    var_0.streakname = "alien_ims_1";
    var_0.splashname = "used_ims";
    var_0.lifespan = 600.0;
    var_0.graceperiod = 0.8;
    var_0.rearmtime = 2.0;
    var_0.numexplosives = 4;
    var_0.attacks = var_0.numexplosives;
    var_0.explosivemodel = "ims_scorpion_explosive_iw6";
    var_0.placementheighttolerance = 11.5;
    var_0.placementradius = 24.0;
    var_0.lidtagroot = "tag_lid";
    var_0.lidopenanims = [];
    var_0.lidopenanims[1] = "IMS_Scorpion_door_1";
    var_0.lidopenanims[2] = "IMS_Scorpion_door_2";
    var_0.lidopenanims[3] = "IMS_Scorpion_door_3";
    var_0.lidopenanims[4] = "IMS_Scorpion_door_4";
    var_0.lidsnapopenanims = [];
    var_0.lidsnapopenanims[1] = "IMS_Scorpion_1_opened";
    var_0.lidsnapopenanims[2] = "IMS_Scorpion_2_opened";
    var_0.lidsnapopenanims[3] = "IMS_Scorpion_3_opened";
    var_0.expltagroot = "tag_explosive";
    var_0.killcamoffset = ( 0, 0, 12 );
    var_0.maxhealth = 1000;
    level.imssettings["alien_ims_1"] = var_0;
    var_0 = spawnstruct();
    var_0.weaponinfo = "alienims_projectileradius_mp";
    var_0.modelbase = "ims_scorpion_body_iw6";
    var_0.modelplacement = "ims_scorpion_body_iw6_placement";
    var_0.modelplacementfailed = "ims_scorpion_body_iw6_placement_failed";
    var_0.modeldestroyed = "ims_scorpion_body_iw6";
    var_0.modelbombsquad = "ims_scorpion_body_iw6_bombsquad";
    var_0.hintstring = &"ALIEN_COLLECTIBLES_IMS_PICKUP";
    var_0.placestring = &"ALIEN_COLLECTIBLES_IMS_PLACE";
    var_0.cannotplacestring = &"ALIEN_COLLECTIBLES_IMS_CANNOT_PLACE";
    var_0.streakname = "alien_ims_2";
    var_0.splashname = "used_ims";
    var_0.lifespan = 600.0;
    var_0.graceperiod = 0.2;
    var_0.rearmtime = 2.0;
    var_0.numexplosives = 4;
    var_0.attacks = var_0.numexplosives;
    var_0.explosivemodel = "ims_scorpion_explosive_iw6";
    var_0.placementheighttolerance = 11.5;
    var_0.placementradius = 24.0;
    var_0.lidtagroot = "tag_lid";
    var_0.lidopenanims = [];
    var_0.lidopenanims[1] = "IMS_Scorpion_door_1";
    var_0.lidopenanims[2] = "IMS_Scorpion_door_2";
    var_0.lidopenanims[3] = "IMS_Scorpion_door_3";
    var_0.lidopenanims[4] = "IMS_Scorpion_door_4";
    var_0.lidsnapopenanims = [];
    var_0.lidsnapopenanims[1] = "IMS_Scorpion_1_opened";
    var_0.lidsnapopenanims[2] = "IMS_Scorpion_2_opened";
    var_0.lidsnapopenanims[3] = "IMS_Scorpion_3_opened";
    var_0.expltagroot = "tag_explosive";
    var_0.killcamoffset = ( 0, 0, 12 );
    var_0.maxhealth = 1000;
    level.imssettings["alien_ims_2"] = var_0;
    var_0 = spawnstruct();
    var_0.weaponinfo = "alienims_projectiledamage_mp";
    var_0.modelbase = "ims_scorpion_body_iw6";
    var_0.modelplacement = "ims_scorpion_body_iw6_placement";
    var_0.modelplacementfailed = "ims_scorpion_body_iw6_placement_failed";
    var_0.modeldestroyed = "ims_scorpion_body_iw6";
    var_0.modelbombsquad = "ims_scorpion_body_iw6_bombsquad";
    var_0.hintstring = &"ALIEN_COLLECTIBLES_IMS_PICKUP";
    var_0.placestring = &"ALIEN_COLLECTIBLES_IMS_PLACE";
    var_0.cannotplacestring = &"ALIEN_COLLECTIBLES_IMS_CANNOT_PLACE";
    var_0.streakname = "alien_ims_3";
    var_0.splashname = "used_ims";
    var_0.lifespan = 600.0;
    var_0.graceperiod = 0.2;
    var_0.rearmtime = 2.0;
    var_0.numexplosives = 4;
    var_0.attacks = var_0.numexplosives;
    var_0.explosivemodel = "ims_scorpion_explosive_iw6";
    var_0.placementheighttolerance = 11.5;
    var_0.placementradius = 24.0;
    var_0.lidtagroot = "tag_lid";
    var_0.lidopenanims = [];
    var_0.lidopenanims[1] = "IMS_Scorpion_door_1";
    var_0.lidopenanims[2] = "IMS_Scorpion_door_2";
    var_0.lidopenanims[3] = "IMS_Scorpion_door_3";
    var_0.lidopenanims[4] = "IMS_Scorpion_door_4";
    var_0.lidsnapopenanims = [];
    var_0.lidsnapopenanims[1] = "IMS_Scorpion_1_opened";
    var_0.lidsnapopenanims[2] = "IMS_Scorpion_2_opened";
    var_0.lidsnapopenanims[3] = "IMS_Scorpion_3_opened";
    var_0.expltagroot = "tag_explosive";
    var_0.killcamoffset = ( 0, 0, 12 );
    var_0.maxhealth = 1000;
    level.imssettings["alien_ims_3"] = var_0;
    var_0 = spawnstruct();
    var_0.weaponinfo = "alienims_projectiledamage_mp";
    var_0.modelbase = "ims_scorpion_body_iw6";
    var_0.modelplacement = "ims_scorpion_body_iw6_placement";
    var_0.modelplacementfailed = "ims_scorpion_body_iw6_placement_failed";
    var_0.modeldestroyed = "ims_scorpion_body_iw6";
    var_0.modelbombsquad = "ims_scorpion_body_iw6_bombsquad";
    var_0.hintstring = &"ALIEN_COLLECTIBLES_IMS_PICKUP";
    var_0.placestring = &"ALIEN_COLLECTIBLES_IMS_PLACE";
    var_0.cannotplacestring = &"ALIEN_COLLECTIBLES_IMS_CANNOT_PLACE";
    var_0.streakname = "alien_ims_4";
    var_0.splashname = "used_ims";
    var_0.lifespan = 600.0;
    var_0.graceperiod = 0.2;
    var_0.rearmtime = 2.0;
    var_0.numexplosives = 6;
    var_0.attacks = var_0.numexplosives;
    var_0.explosivemodel = "ims_scorpion_explosive_iw6";
    var_0.placementheighttolerance = 11.5;
    var_0.placementradius = 24.0;
    var_0.lidtagroot = "tag_lid";
    var_0.lidopenanims = [];
    var_0.lidopenanims[1] = "IMS_Scorpion_door_1";
    var_0.lidopenanims[2] = "IMS_Scorpion_door_2";
    var_0.lidopenanims[3] = "IMS_Scorpion_door_3";
    var_0.lidopenanims[4] = "IMS_Scorpion_door_4";
    var_0.lidsnapopenanims = [];
    var_0.lidsnapopenanims[1] = "IMS_Scorpion_1_opened";
    var_0.lidsnapopenanims[2] = "IMS_Scorpion_2_opened";
    var_0.lidsnapopenanims[3] = "IMS_Scorpion_3_opened";
    var_0.expltagroot = "tag_explosive";
    var_0.killcamoffset = ( 0, 0, 12 );
    var_0.maxhealth = 1000;
    level.imssettings["alien_ims_4"] = var_0;

    if ( !isdefined( level.balldronesettings ) )
        level.balldronesettings = [];

    level.balldronesettings["alien_ball_drone"] = spawnstruct();
    level.balldronesettings["alien_ball_drone"].timeout = 35.0;
    level.balldronesettings["alien_ball_drone"].health = 999999;
    level.balldronesettings["alien_ball_drone"].maxhealth = 250;
    level.balldronesettings["alien_ball_drone"].streakname = "ball_drone_backup";
    level.balldronesettings["alien_ball_drone"].vehicleinfo = "backup_drone_mp";
    level.balldronesettings["alien_ball_drone"].modelbase = "vehicle_drone_backup_buddy";
    level.balldronesettings["alien_ball_drone"].teamsplash = "used_ball_drone_radar";
    level.balldronesettings["alien_ball_drone"].fxid_sparks = loadfx( "vfx/gameplay/mp/killstreaks/vfx_ims_sparks" );
    level.balldronesettings["alien_ball_drone"].fxid_explode = loadfx( "fx/explosions/bouncing_betty_explosion" );
    level.balldronesettings["alien_ball_drone"].sound_explode = "ball_drone_explode";
    level.balldronesettings["alien_ball_drone"].vodestroyed = "backup_destroyed";
    level.balldronesettings["alien_ball_drone"].xppopup = "destroyed_ball_drone";
    level.balldronesettings["alien_ball_drone"].weaponinfo = "alien_ball_drone_gun_mp";
    level.balldronesettings["alien_ball_drone"].weaponmodel = "vehicle_drone_backup_buddy_gun";
    level.balldronesettings["alien_ball_drone"].weapontag = "tag_turret_attach";
    level.balldronesettings["alien_ball_drone"].sound_weapon = "weap_p99_fire_npc";
    level.balldronesettings["alien_ball_drone"].sound_targeting = "ball_drone_targeting";
    level.balldronesettings["alien_ball_drone"].sound_lockon = "ball_drone_lockon";
    level.balldronesettings["alien_ball_drone"].sentrymode = "sentry";
    level.balldronesettings["alien_ball_drone"].visual_range_sq = 422500;
    level.balldronesettings["alien_ball_drone"].burstmin = 5;
    level.balldronesettings["alien_ball_drone"].burstmax = 10;
    level.balldronesettings["alien_ball_drone"].pausemin = 0.15;
    level.balldronesettings["alien_ball_drone"].pausemax = 0.35;
    level.balldronesettings["alien_ball_drone"].lockontime = 0.5;
    level.balldronesettings["alien_ball_drone"].playfxcallback = maps\mp\killstreaks\_ball_drone::backupbuddyplayfx;
    level.balldronesettings["alien_ball_drone"].fxid_light1 = [];
    level.balldronesettings["alien_ball_drone"].fxid_light1["enemy"] = loadfx( "vfx/gameplay/mp/killstreaks/vfx_light_detonator_blink" );
    level.balldronesettings["alien_ball_drone"].fxid_light1["friendly"] = loadfx( "fx/misc/light_mine_blink_friendly" );
    level.balldronesettings["alien_ball_drone_1"] = spawnstruct();
    level.balldronesettings["alien_ball_drone_1"].timeout = 35.0;
    level.balldronesettings["alien_ball_drone_1"].health = 999999;
    level.balldronesettings["alien_ball_drone_1"].maxhealth = 250;
    level.balldronesettings["alien_ball_drone_1"].streakname = "ball_drone_backup";
    level.balldronesettings["alien_ball_drone_1"].vehicleinfo = "backup_drone_mp";
    level.balldronesettings["alien_ball_drone_1"].modelbase = "vehicle_drone_backup_buddy";
    level.balldronesettings["alien_ball_drone_1"].teamsplash = "used_ball_drone_radar";
    level.balldronesettings["alien_ball_drone_1"].fxid_sparks = loadfx( "vfx/gameplay/mp/killstreaks/vfx_ims_sparks" );
    level.balldronesettings["alien_ball_drone_1"].fxid_explode = loadfx( "fx/explosions/bouncing_betty_explosion" );
    level.balldronesettings["alien_ball_drone_1"].sound_explode = "ball_drone_explode";
    level.balldronesettings["alien_ball_drone_1"].vodestroyed = "backup_destroyed";
    level.balldronesettings["alien_ball_drone_1"].xppopup = "destroyed_ball_drone";
    level.balldronesettings["alien_ball_drone_1"].weaponinfo = "alien_ball_drone_gun1_mp";
    level.balldronesettings["alien_ball_drone_1"].weaponmodel = "vehicle_drone_backup_buddy_gun";
    level.balldronesettings["alien_ball_drone_1"].weapontag = "tag_turret_attach";
    level.balldronesettings["alien_ball_drone_1"].sound_weapon = "weap_p99_fire_npc";
    level.balldronesettings["alien_ball_drone_1"].sound_targeting = "ball_drone_targeting";
    level.balldronesettings["alien_ball_drone_1"].sound_lockon = "ball_drone_lockon";
    level.balldronesettings["alien_ball_drone_1"].sentrymode = "sentry";
    level.balldronesettings["alien_ball_drone_1"].visual_range_sq = 422500;
    level.balldronesettings["alien_ball_drone_1"].burstmin = 5;
    level.balldronesettings["alien_ball_drone_1"].burstmax = 10;
    level.balldronesettings["alien_ball_drone_1"].pausemin = 0.15;
    level.balldronesettings["alien_ball_drone_1"].pausemax = 0.35;
    level.balldronesettings["alien_ball_drone_1"].lockontime = 0.5;
    level.balldronesettings["alien_ball_drone_1"].playfxcallback = maps\mp\killstreaks\_ball_drone::backupbuddyplayfx;
    level.balldronesettings["alien_ball_drone_1"].fxid_light1 = [];
    level.balldronesettings["alien_ball_drone_1"].fxid_light1["enemy"] = loadfx( "vfx/gameplay/mp/killstreaks/vfx_light_detonator_blink" );
    level.balldronesettings["alien_ball_drone_1"].fxid_light1["friendly"] = loadfx( "fx/misc/light_mine_blink_friendly" );
    level.balldronesettings["alien_ball_drone_2"] = spawnstruct();
    level.balldronesettings["alien_ball_drone_2"].timeout = 35.0;
    level.balldronesettings["alien_ball_drone_2"].health = 999999;
    level.balldronesettings["alien_ball_drone_2"].maxhealth = 250;
    level.balldronesettings["alien_ball_drone_2"].streakname = "ball_drone_backup";
    level.balldronesettings["alien_ball_drone_2"].vehicleinfo = "backup_drone_mp";
    level.balldronesettings["alien_ball_drone_2"].modelbase = "vehicle_drone_backup_buddy";
    level.balldronesettings["alien_ball_drone_2"].teamsplash = "used_ball_drone_radar";
    level.balldronesettings["alien_ball_drone_2"].fxid_sparks = loadfx( "vfx/gameplay/mp/killstreaks/vfx_ims_sparks" );
    level.balldronesettings["alien_ball_drone_2"].fxid_explode = loadfx( "fx/explosions/bouncing_betty_explosion" );
    level.balldronesettings["alien_ball_drone_2"].sound_explode = "ball_drone_explode";
    level.balldronesettings["alien_ball_drone_2"].vodestroyed = "backup_destroyed";
    level.balldronesettings["alien_ball_drone_2"].xppopup = "destroyed_ball_drone";
    level.balldronesettings["alien_ball_drone_2"].weaponinfo = "alien_ball_drone_gun2_mp";
    level.balldronesettings["alien_ball_drone_2"].weaponmodel = "vehicle_drone_backup_buddy_gun";
    level.balldronesettings["alien_ball_drone_2"].weapontag = "tag_turret_attach";
    level.balldronesettings["alien_ball_drone_2"].sound_weapon = "weap_p99_fire_npc";
    level.balldronesettings["alien_ball_drone_2"].sound_targeting = "ball_drone_targeting";
    level.balldronesettings["alien_ball_drone_2"].sound_lockon = "ball_drone_lockon";
    level.balldronesettings["alien_ball_drone_2"].sentrymode = "sentry";
    level.balldronesettings["alien_ball_drone_2"].visual_range_sq = 722500;
    level.balldronesettings["alien_ball_drone_2"].burstmin = 5;
    level.balldronesettings["alien_ball_drone_2"].burstmax = 10;
    level.balldronesettings["alien_ball_drone_2"].pausemin = 0.15;
    level.balldronesettings["alien_ball_drone_2"].pausemax = 0.35;
    level.balldronesettings["alien_ball_drone_2"].lockontime = 0.5;
    level.balldronesettings["alien_ball_drone_2"].playfxcallback = maps\mp\killstreaks\_ball_drone::backupbuddyplayfx;
    level.balldronesettings["alien_ball_drone_2"].fxid_light1 = [];
    level.balldronesettings["alien_ball_drone_2"].fxid_light1["enemy"] = loadfx( "vfx/gameplay/mp/killstreaks/vfx_light_detonator_blink" );
    level.balldronesettings["alien_ball_drone_2"].fxid_light1["friendly"] = loadfx( "fx/misc/light_mine_blink_friendly" );
    level.balldronesettings["alien_ball_drone_3"] = spawnstruct();
    level.balldronesettings["alien_ball_drone_3"].timeout = 50.0;
    level.balldronesettings["alien_ball_drone_3"].health = 999999;
    level.balldronesettings["alien_ball_drone_3"].maxhealth = 250;
    level.balldronesettings["alien_ball_drone_3"].streakname = "ball_drone_backup";
    level.balldronesettings["alien_ball_drone_3"].vehicleinfo = "backup_drone_mp";
    level.balldronesettings["alien_ball_drone_3"].modelbase = "vehicle_drone_backup_buddy";
    level.balldronesettings["alien_ball_drone_3"].teamsplash = "used_ball_drone_radar";
    level.balldronesettings["alien_ball_drone_3"].fxid_sparks = loadfx( "vfx/gameplay/mp/killstreaks/vfx_ims_sparks" );
    level.balldronesettings["alien_ball_drone_3"].fxid_explode = loadfx( "fx/explosions/bouncing_betty_explosion" );
    level.balldronesettings["alien_ball_drone_3"].sound_explode = "ball_drone_explode";
    level.balldronesettings["alien_ball_drone_3"].vodestroyed = "backup_destroyed";
    level.balldronesettings["alien_ball_drone_3"].xppopup = "destroyed_ball_drone";
    level.balldronesettings["alien_ball_drone_3"].weaponinfo = "alien_ball_drone_gun3_mp";
    level.balldronesettings["alien_ball_drone_3"].weaponmodel = "vehicle_drone_backup_buddy_gun";
    level.balldronesettings["alien_ball_drone_3"].weapontag = "tag_turret_attach";
    level.balldronesettings["alien_ball_drone_3"].sound_weapon = "weap_p99_fire_npc";
    level.balldronesettings["alien_ball_drone_3"].sound_targeting = "ball_drone_targeting";
    level.balldronesettings["alien_ball_drone_3"].sound_lockon = "ball_drone_lockon";
    level.balldronesettings["alien_ball_drone_3"].sentrymode = "sentry";
    level.balldronesettings["alien_ball_drone_3"].visual_range_sq = 722500;
    level.balldronesettings["alien_ball_drone_3"].burstmin = 5;
    level.balldronesettings["alien_ball_drone_3"].burstmax = 10;
    level.balldronesettings["alien_ball_drone_3"].pausemin = 0.15;
    level.balldronesettings["alien_ball_drone_3"].pausemax = 0.35;
    level.balldronesettings["alien_ball_drone_3"].lockontime = 0.5;
    level.balldronesettings["alien_ball_drone_3"].playfxcallback = maps\mp\killstreaks\_ball_drone::backupbuddyplayfx;
    level.balldronesettings["alien_ball_drone_3"].fxid_light1 = [];
    level.balldronesettings["alien_ball_drone_3"].fxid_light1["enemy"] = loadfx( "vfx/gameplay/mp/killstreaks/vfx_light_detonator_blink" );
    level.balldronesettings["alien_ball_drone_3"].fxid_light1["friendly"] = loadfx( "fx/misc/light_mine_blink_friendly" );
    level.balldronesettings["alien_ball_drone_4"] = spawnstruct();
    level.balldronesettings["alien_ball_drone_4"].timeout = 50.0;
    level.balldronesettings["alien_ball_drone_4"].health = 999999;
    level.balldronesettings["alien_ball_drone_4"].maxhealth = 250;
    level.balldronesettings["alien_ball_drone_4"].streakname = "ball_drone_backup";
    level.balldronesettings["alien_ball_drone_4"].vehicleinfo = "backup_drone_mp";
    level.balldronesettings["alien_ball_drone_4"].modelbase = "vehicle_drone_backup_buddy";
    level.balldronesettings["alien_ball_drone_4"].teamsplash = "used_ball_drone_radar";
    level.balldronesettings["alien_ball_drone_4"].fxid_sparks = loadfx( "vfx/gameplay/mp/killstreaks/vfx_ims_sparks" );
    level.balldronesettings["alien_ball_drone_4"].fxid_explode = loadfx( "fx/explosions/bouncing_betty_explosion" );
    level.balldronesettings["alien_ball_drone_4"].sound_explode = "ball_drone_explode";
    level.balldronesettings["alien_ball_drone_4"].vodestroyed = "backup_destroyed";
    level.balldronesettings["alien_ball_drone_4"].xppopup = "destroyed_ball_drone";
    level.balldronesettings["alien_ball_drone_4"].weaponinfo = "alien_ball_drone_gun4_mp";
    level.balldronesettings["alien_ball_drone_4"].weaponmodel = "vehicle_drone_backup_buddy_gun";
    level.balldronesettings["alien_ball_drone_4"].weapontag = "tag_turret_attach";
    level.balldronesettings["alien_ball_drone_4"].sound_weapon = "weap_p99_fire_npc";
    level.balldronesettings["alien_ball_drone_4"].sound_targeting = "ball_drone_targeting";
    level.balldronesettings["alien_ball_drone_4"].sound_lockon = "ball_drone_lockon";
    level.balldronesettings["alien_ball_drone_4"].sentrymode = "sentry";
    level.balldronesettings["alien_ball_drone_4"].visual_range_sq = 722500;
    level.balldronesettings["alien_ball_drone_4"].burstmin = 5;
    level.balldronesettings["alien_ball_drone_4"].burstmax = 10;
    level.balldronesettings["alien_ball_drone_4"].pausemin = 0.15;
    level.balldronesettings["alien_ball_drone_4"].pausemax = 0.35;
    level.balldronesettings["alien_ball_drone_4"].lockontime = 0.5;
    level.balldronesettings["alien_ball_drone_4"].playfxcallback = maps\mp\killstreaks\_ball_drone::backupbuddyplayfx;
    level.balldronesettings["alien_ball_drone_4"].fxid_light1 = [];
    level.balldronesettings["alien_ball_drone_4"].fxid_light1["enemy"] = loadfx( "vfx/gameplay/mp/killstreaks/vfx_light_detonator_blink" );
    level.balldronesettings["alien_ball_drone_4"].fxid_light1["friendly"] = loadfx( "fx/misc/light_mine_blink_friendly" );
    level.boxsettings["deployable_vest"].hintstring = &"ALIEN_COLLECTIBLES_DEPLOYABLE_VEST_PICKUP";
    level.boxsettings["deployable_vest"].capturingstring = &"ALIEN_COLLECTIBLES_DEPLOYABLE_VEST_GETTING";
    level.boxsettings["deployable_vest"].eventstring = &"ALIEN_COLLECTIBLES_DEPLOYED_VEST";
    level.boxsettings["deployable_ammo"].hintstring = &"ALIEN_COLLECTIBLES_DEPLOYABLE_AMMO_PICKUP";
    level.boxsettings["deployable_ammo"].capturingstring = &"ALIEN_COLLECTIBLES_DEPLOYABLE_AMMO_TAKING";
    level.boxsettings["deployable_ammo"].eventstring = &"ALIEN_COLLECTIBLES_DEPLOYABLE_AMMO_TAKEN";
    level.boxsettings["deployable_juicebox"].hintstring = &"ALIEN_COLLECTIBLES_DEPLOYABLE_BOOST_PICKUP";
    level.boxsettings["deployable_juicebox"].capturingstring = &"ALIEN_COLLECTIBLES_DEPLOYABLE_BOOST_TAKING";
    level.boxsettings["deployable_juicebox"].eventstring = &"ALIEN_COLLECTIBLES_DEPLOYABLE_BOOST_TAKEN";
    level.boxsettings["deployable_ammo"].deathdamagemax = undefined;
    level.minedamagemin = 325;
    level.minedamagemax = 750;
    level.maxperplayerexplosives = 5;
    level.deployablebox_vest_rank = [];
    level.deployablebox_vest_rank[0] = 25;
    level.deployablebox_vest_rank[1] = 50;
    level.deployablebox_vest_rank[2] = 75;
    level.deployablebox_vest_rank[3] = 100;
    level.deployablebox_vest_rank[4] = 125;
    level.deployablebox_vest_max = 125;
    level.deployablebox_juicebox_rank = [];
    level.deployablebox_juicebox_rank[0] = 15;
    level.deployablebox_juicebox_rank[1] = 30;
    level.deployablebox_juicebox_rank[2] = 30;
    level.deployablebox_juicebox_rank[3] = 45;
    level.deployablebox_juicebox_rank[4] = 60;
    level.deployablebox_juicebox_max = 60;
    level.deployablebox_adrenalinebox_rank = [];
    level.deployablebox_adrenalinebox_rank[0] = 15;
    level.deployablebox_adrenalinebox_rank[1] = 15;
    level.deployablebox_adrenalinebox_rank[2] = 15;
    level.deployablebox_adrenalinebox_rank[3] = 30;
    level.deployablebox_adrenalinebox_rank[4] = 45;
    level.deployablebox_adrenalinebox_max = 45;
}

init_combat_resource_from_table()
{
    level.alien_combat_resources = [];
    populate_combat_resource_from_table( 0, "munition" );
    populate_combat_resource_from_table( 100, "support" );
    populate_combat_resource_from_table( 200, "defense" );
    populate_combat_resource_from_table( 300, "offense" );
}

canceluse_default_deployable_box( var_0, var_1 )
{
    self takeweapon( "aliendeployable_crate_marker_mp" );
    self.deployable = 0;
    self switchtoweapon( self.last_weapon );
    self notify( "cancel_deployable_via_marker" );
}

populate_combat_resource_from_table( var_0, var_1 )
{
    level.alien_combat_resources[var_1] = [];

    for ( var_2 = var_0; var_2 <= var_0 + 99; var_2++ )
    {
        var_3 = get_resource_ref_by_index( var_2 );

        if ( var_3 == "" )
            break;

        if ( !isdefined( level.alien_combat_resources[var_3] ) )
        {
            var_4 = spawnstruct();
            var_4.upgrades = [];
            var_4.unlock = get_unlock_by_ref( var_3 );
            var_4.name = get_name_by_ref( var_3 );
            var_4.icon = get_icon_by_ref( var_3 );
            var_4.dpad_icon = get_dpad_icon_by_ref( var_3 );
            var_4.ref = var_3;
            var_4.type = var_1;
            var_4.callbacks = level.alien_combat_resource_callbacks[var_3];
            level.alien_combat_resources[var_1][var_3] = var_4;
        }

        var_5 = 0;

        for ( var_6 = var_2; var_6 <= var_0 + 99; var_6++ )
        {
            var_7 = get_resource_ref_by_index( var_6 );

            if ( var_7 == "" )
                break;

            if ( var_3 == var_7 || is_resource_set( var_3, var_7 ) )
            {
                var_8 = spawnstruct();
                var_8.ref = var_7;
                var_8.desc = get_desc_by_ref( var_7 );
                var_8.cost = get_cost_by_ref( var_7 );
                var_8.point_cost = get_point_cost_by_ref( var_7 );
                var_8.dpad_icon = get_dpad_upgrade_icon_by_ref( var_7 );
                var_5 = var_5 + int( var_8.point_cost );
                var_8.total_cost = var_5;
                level.alien_combat_resources[var_1][var_3].upgrades[var_6 - var_2] = var_8;
                continue;
            }

            break;
        }

        var_2 = var_6 - 1;
    }
}

is_resource_set( var_0, var_1 )
{
    if ( var_0 == var_1 )
        return 0;

    if ( !issubstr( var_1, var_0 ) )
        return 0;

    var_2 = strtok( var_0, "_" );
    var_3 = strtok( var_1, "_" );

    if ( var_3.size - var_2.size != 1 )
        return 0;

    for ( var_4 = 0; var_4 < var_3.size - 1; var_4++ )
    {
        if ( var_3[var_4] != var_2[var_4] )
            return 0;
    }

    return 1;
}

get_resource_ref_by_index( var_0 )
{
    return tablelookup( level.alien_combat_resources_table, 0, var_0, 1 );
}

get_name_by_ref( var_0 )
{
    return tablelookup( level.alien_combat_resources_table, 1, var_0, 5 );
}

get_icon_by_ref( var_0 )
{
    return tablelookup( level.alien_combat_resources_table, 1, var_0, 7 );
}

get_dpad_icon_by_ref( var_0 )
{
    return tablelookup( level.alien_combat_resources_table, 1, var_0, 8 );
}

get_desc_by_ref( var_0 )
{
    return tablelookup( level.alien_combat_resources_table, 1, var_0, 6 );
}

get_point_cost_by_ref( var_0 )
{
    return int( tablelookup( level.alien_combat_resources_table, 1, var_0, 3 ) );
}

get_cost_by_ref( var_0 )
{
    return int( tablelookup( level.alien_combat_resources_table, 1, var_0, 4 ) );
}

get_unlock_by_ref( var_0 )
{
    return int( tablelookup( level.alien_combat_resources_table, 1, var_0, 2 ) );
}

get_is_upgrade_by_ref( var_0 )
{
    return int( tablelookup( level.alien_combat_resources_table, 1, var_0, 9 ) );
}

get_dpad_upgrade_icon_by_ref( var_0 )
{
    return tablelookup( level.alien_combat_resources_table, 1, var_0, 8 );
}

has_ims()
{
    if ( isdefined( self.imslist ) && self.imslist.size > 0 && isalive( self.imslist[0] ) )
        return 1;

    return 0;
}

has_backup_uav()
{
    if ( isdefined( self.balldrone ) )
        return 1;

    return 0;
}

tryuse_dpad_team_ammo( var_0, var_1 )
{
    self.team_ammo_rank = var_1;
    common_tryuse_actions();
    thread maps\mp\alien\_deployablebox::default_tryusedeployable( var_1, "deployable_ammo" );
}

deployable_ammo_placed_listener()
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self waittill( "new_deployable_box", var_0 );
    track_deployables( var_0 );
    var_0 setcandamage( 0 );
    var_0 setcanradiusdamage( 0 );

    if ( var_0.upgrade_rank == 4 )
        var_0 thread team_ammo_regen();
}

track_deployables( var_0 )
{
    if ( !isdefined( self.active_deployables ) )
        self.active_deployables = [];

    if ( isdefined( self.active_deployables[var_0.boxtype] ) )
        self.active_deployables[var_0.boxtype] notify( "death" );

    self.active_deployables[var_0.boxtype] = var_0;
}

team_ammo_regen()
{
    self endon( "death" );
    self endon( "ammo_regen_timeout" );
    var_0 = 65536.0;
    var_1 = 0.1;

    for (;;)
    {
        foreach ( var_3 in level.players )
        {
            if ( isalive( var_3 ) && distancesquared( self.origin, var_3.origin ) < var_0 )
                var_3 maps\mp\alien\_deployablebox_functions::addratiomaxstocktoallweapons( var_1 );

            wait 5.0;
        }
    }
}

use_dpad_team_ammo( var_0, var_1 )
{
    thread deployable_ammo_placed_listener();
    self.deployable = 0;
    level thread maps\mp\alien\_music_and_dialog::playvoforteamammo( self );
}

tryuse_dpad_team_boost( var_0, var_1 )
{
    self.team_boost_rank = var_1;
    common_tryuse_actions();
    thread maps\mp\alien\_deployablebox::default_tryusedeployable( var_1, "deployable_juicebox" );
}

deployable_boost_placed_listener()
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self waittill( "new_deployable_box", var_0 );
    track_deployables( var_0 );
    var_0 setcandamage( 0 );
    var_0 setcanradiusdamage( 0 );
}

use_dpad_team_boost( var_0, var_1 )
{
    thread deployable_boost_placed_listener();
    self.deployable = 0;
    level thread maps\mp\alien\_music_and_dialog::playvoforteamboost( self );
}

tryuse_dpad_team_adrenaline( var_0, var_1 )
{
    self.team_adrenaline_rank = var_1;
    common_tryuse_actions();
    thread maps\mp\alien\_deployablebox::default_tryusedeployable( var_1, "deployable_adrenalinebox" );
}

deployable_adrenaline_placed_listener()
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self waittill( "new_deployable_box", var_0 );
    track_deployables( var_0 );
    var_0 setcandamage( 0 );
    var_0 setcanradiusdamage( 0 );
}

use_dpad_team_adrenaline( var_0, var_1 )
{
    thread deployable_adrenaline_placed_listener();
    self.deployable = 0;
    level thread maps\mp\alien\_music_and_dialog::playvoforteamboost( self );
}

tryuse_dpad_team_armor( var_0, var_1 )
{
    self.team_armor_rank = var_1;
    common_tryuse_actions();
    thread maps\mp\alien\_deployablebox::default_tryusedeployable( var_1, "deployable_vest" );
}

deployable_armor_placed_listener()
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self waittill( "new_deployable_box", var_0 );
    track_deployables( var_0 );
    var_0 setcandamage( 0 );
    var_0 setcanradiusdamage( 0 );
}

use_dpad_team_armor( var_0, var_1 )
{
    thread deployable_armor_placed_listener();
    self.deployable = 0;
    level thread maps\mp\alien\_music_and_dialog::playvoforteamarmor( self );
}

tryuse_dpad_team_explosives( var_0, var_1 )
{
    self.team_explosives_rank = var_1;
    common_tryuse_actions();
    thread maps\mp\alien\_deployablebox::default_tryusedeployable( var_1, "deployable_explosives" );
}

deployable_explosives_placed_listener()
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self waittill( "new_deployable_box", var_0 );
    track_deployables( var_0 );
    var_0 setcandamage( 0 );
    var_0 setcanradiusdamage( 0 );
}

use_dpad_team_explosives( var_0, var_1 )
{
    thread deployable_explosives_placed_listener();
    self.deployable = 0;
    level notify( "dlc_vo_notify", "inform_explosives", self );

    if ( !isdefined( level.use_dlc_vo ) )
        level thread maps\mp\alien\_music_and_dialog::playvoforsupportitems( self );
}

tryuse_dpad_team_randombox( var_0, var_1 )
{
    self.team_randombox_rank = var_1;
    common_tryuse_actions();
    thread maps\mp\alien\_deployablebox::default_tryusedeployable( var_1, "deployable_randombox" );
}

deployable_randombox_placed_listener()
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self waittill( "new_deployable_box", var_0 );
    track_deployables( var_0 );
    var_0 setcandamage( 0 );
    var_0 setcanradiusdamage( 0 );
}

use_dpad_team_randombox( var_0, var_1 )
{
    thread deployable_randombox_placed_listener();
    self.deployable = 0;
    level thread maps\mp\alien\_music_and_dialog::playvoforrandombox( self );
}

tryuse_dpad_team_currency( var_0, var_1 )
{
    self.team_currency_rank = var_1;
    common_tryuse_actions();
    thread maps\mp\alien\_deployablebox::default_tryusedeployable( var_1, "deployable_currency" );
}

deployable_currency_placed_listener()
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self waittill( "new_deployable_box", var_0 );
    var_0 setcandamage( 0 );
    var_0 setcanradiusdamage( 0 );
}

use_dpad_team_currency( var_0, var_1 )
{
    thread deployable_currency_placed_listener();
    self.deployable = 0;
}

canpurchase_dpad_riotshield( var_0, var_1 )
{
    if ( self.hasriotshield )
    {
        maps\mp\_utility::setlowermessage( "riot_shield_equipped", &"ALIEN_COLLECTIBLES_RIOT_SHIELD_EQUIPPED", 3 );
        return 0;
    }

    return alt_canpurchase( var_0, var_1 );
}

tryuse_dpad_riotshield( var_0, var_1 )
{
    tryuse_dpad_riotshield_internal( var_0, var_1 );
}

tryuse_dpad_riotshield_internal( var_0, var_1 )
{
    maps\mp\alien\_utility::store_weapons_status();
    self.last_weapon = self getcurrentweapon();

    if ( var_1 == 0 )
    {
        maps\mp\_utility::_giveweapon( "iw5_alienriotshield_mp" );
        self setweaponammoclip( "iw5_alienriotshield_mp", 10 );
        self switchtoweapon( "iw5_alienriotshield_mp" );
    }

    if ( var_1 == 1 )
    {
        maps\mp\_utility::_giveweapon( "iw5_alienriotshield1_mp" );
        self setweaponammoclip( "iw5_alienriotshield1_mp", 15 );
        self switchtoweapon( "iw5_alienriotshield1_mp" );
    }

    if ( var_1 == 2 )
    {
        maps\mp\_utility::_giveweapon( "iw5_alienriotshield2_mp" );
        self setweaponammoclip( "iw5_alienriotshield2_mp", 15 );
        self switchtoweapon( "iw5_alienriotshield2_mp" );
    }

    if ( var_1 == 3 )
    {
        maps\mp\_utility::_giveweapon( "iw5_alienriotshield3_mp" );
        self setweaponammoclip( "iw5_alienriotshield3_mp", 20 );
        self switchtoweapon( "iw5_alienriotshield3_mp" );
    }

    if ( var_1 == 4 )
    {
        maps\mp\_utility::_giveweapon( "iw5_alienriotshield4_mp" );
        self setweaponammoclip( "iw5_alienriotshield4_mp", 25 );
        self.fireshield = 1.0;
        self switchtoweapon( "iw5_alienriotshield4_mp" );
    }

    wait 0.5;
}

use_dpad_riotshield( var_0, var_1 )
{
    self notify( "action_use" );
    self setclientomnvar( "ui_alien_riotshield_equipped", 1 );
    level notify( "dlc_vo_notify", "inform_shield", self );
}

canceluse_dpad_riotshield( var_0, var_1 )
{
    if ( var_1 == 0 )
        self takeweapon( "iw5_alienriotshield_mp" );

    if ( var_1 == 1 )
        self takeweapon( "iw5_alienriotshield1_mp" );

    if ( var_1 == 2 )
        self takeweapon( "iw5_alienriotshield2_mp" );

    if ( var_1 == 3 )
        self takeweapon( "iw5_alienriotshield3_mp" );

    if ( var_1 == 4 )
        self takeweapon( "iw5_alienriotshield4_mp" );

    if ( !isdefined( level.drill_carrier ) || isdefined( level.drill_carrier ) && self != level.drill_carrier )
    {
        if ( isdefined( self.last_weapon ) )
            self switchtoweapon( self.last_weapon );
    }

    self setclientomnvar( "ui_alien_riotshield_equipped", -1 );
    return 1;
}

canpurchase_dpad_sentry( var_0, var_1 )
{
    var_2 = get_valid_sentry_count();
    var_3 = get_max_sentry_count( var_1, "sentry" );

    if ( var_2 >= var_3 )
    {
        self iprintlnbold( &"ALIEN_COLLECTIBLES_MAX_TURRETS" );
        return 0;
    }

    if ( maps\mp\alien\_utility::is_true( self.iscarrying ) )
        return 0;

    return default_canpurchase( var_0, var_1 );
}

tryuse_dpad_sentry( var_0, var_1 )
{
    if ( maps\mp\alien\_utility::is_true( self.iscarrying ) )
        return 0;

    self.last_weapon = self getcurrentweapon();

    if ( var_1 == 0 )
    {
        self.last_sentry = "alien_sentry";
        var_2 = [[ level.createsentryforplayer_func ]]( "alien_sentry", self );
        var_2 setconvergencetime( 1.5, "pitch" );
        var_2 setconvergencetime( 1.5, "yaw" );
        self.carriedsentry = var_2;
        var_2 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 1 )
    {
        self.last_sentry = "alien_sentry_1";
        var_3 = [[ level.createsentryforplayer_func ]]( "alien_sentry_1", self );
        var_3 setconvergencetime( 1.0, "pitch" );
        var_3 setconvergencetime( 1.0, "yaw" );
        self.carriedsentry = var_3;
        var_3 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 2 )
    {
        self.last_sentry = "alien_sentry_2";
        var_4 = [[ level.createsentryforplayer_func ]]( "alien_sentry_2", self );
        var_4 setconvergencetime( 1.0, "pitch" );
        var_4 setconvergencetime( 1.0, "yaw" );
        self.carriedsentry = var_4;
        var_4 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 3 )
    {
        self.last_sentry = "alien_sentry_3";
        var_5 = [[ level.createsentryforplayer_func ]]( "alien_sentry_3", self );
        var_5 setconvergencetime( 1.0, "pitch" );
        var_5 setconvergencetime( 1.0, "yaw" );
        self.carriedsentry = var_5;
        var_5 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 4 )
    {
        self.last_sentry = "alien_sentry_4";
        var_6 = [[ level.createsentryforplayer_func ]]( "alien_sentry_4", self );
        var_6 setconvergencetime( 1.0, "pitch" );
        var_6 setconvergencetime( 1.0, "yaw" );
        self.carriedsentry = var_6;
        var_6 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }
}

sentry_placed_listener( var_0 )
{
    var_1 = 1.5;
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self disableweaponswitch();
    self waittill( "new_sentry", var_2 );
    self enableweaponswitch();
    thread manage_sentry_count( var_0, "sentry" );

    if ( issentient( var_2 ) )
    {
        if ( !maps\mp\alien\_utility::is_chaos_mode() )
            var_2.threatbias = -1000;
        else
            var_2.threatbias = -3500;
    }

    var_2.maxhealth = 150;

    if ( isdefined( var_2.owner ) && var_2.owner maps\mp\alien\_persistence::is_upgrade_enabled( "sentry_health_upgrade" ) )
        var_2.maxhealth = int( var_2.maxhealth * var_1 );

    var_3 = 450;

    switch ( var_0 )
    {
        case 1:
            var_3 = 450;
            break;
        case 2:
            var_3 = 450;
            break;
        case 3:
            var_3 = 600;
            break;
        case 4:
            var_3 = 600;
            break;
        default:
            var_3 = 450;
    }

    var_2 thread sentry_watch_ammo( var_3 );
}

sentry_watch_ammo( var_0 )
{
    self endon( "death" );

    while ( var_0 > 0 )
    {
        self waittill( "bullet_fired" );
        var_0--;
    }

    self notify( "death" );
}

use_dpad_sentry( var_0, var_1 )
{
    thread sentry_placed_listener( var_1 );
    self.carriedsentry [[ level.sentry_setplaced_func ]]();
    self enableweapons();
    self.carriedsentry = undefined;
    self.iscarrying = 0;

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );

    level thread maps\mp\alien\_music_and_dialog::playvoforsentry( self, "sentry" );
}

canceluse_dpad_sentry( var_0, var_1 )
{
    if ( isdefined( self.carriedsentry ) )
        self.carriedsentry [[ level.sentry_setcancelled_func ]]();

    self enableweapons();

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );
}

get_valid_sentry_count()
{
    var_0 = get_all_my_sentry( "sentry" );
    return get_valid_equipment_count( var_0 );
}

canpurchase_dpad_glsentry( var_0, var_1 )
{
    var_2 = get_valid_grenade_turret_count();
    var_3 = 1;

    if ( var_2 >= var_3 )
    {
        self iprintlnbold( &"ALIEN_COLLECTIBLES_MAX_TURRETS" );
        return 0;
    }

    return default_canpurchase( var_0, var_1 );
}

tryuse_dpad_glsentry( var_0, var_1 )
{
    self.last_weapon = self getcurrentweapon();

    if ( var_1 == 0 )
    {
        self.last_sentry = "gl_turret";
        var_2 = [[ level.createsentryforplayer_func ]]( "gl_turret", self );
        self.carriedsentry = var_2;
        var_2 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 1 )
    {
        self.last_sentry = "gl_turret_1";
        var_3 = [[ level.createsentryforplayer_func ]]( "gl_turret_1", self );
        self.carriedsentry = var_3;
        var_3 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 2 )
    {
        self.last_sentry = "gl_turret_2";
        var_4 = [[ level.createsentryforplayer_func ]]( "gl_turret_2", self );
        self.carriedsentry = var_4;
        var_4 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 3 )
    {
        self.last_sentry = "gl_turret_3";
        var_5 = [[ level.createsentryforplayer_func ]]( "gl_turret_3", self );
        self.carriedsentry = var_5;
        var_5 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 4 )
    {
        self.last_sentry = "gl_turret_4";
        var_6 = [[ level.createsentryforplayer_func ]]( "gl_turret_4", self );
        self.carriedsentry = var_6;
        var_6 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }
}

glsentry_placed_listener( var_0 )
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self disableweaponswitch();
    self waittill( "new_sentry", var_1 );
    self enableweaponswitch();
    thread manage_sentry_count( var_0, "grenade" );

    if ( issentient( var_1 ) )
        var_1.threatbias = -1000;

    var_1.maxhealth = 150;
    var_2 = 10;

    switch ( var_0 )
    {
        case 1:
            var_2 = 15;
            break;
        case 2:
            var_2 = 15;
            break;
        case 3:
            var_2 = 30;
            break;
        case 4:
            var_2 = 30;
            break;
        default:
            var_2 = 10;
    }

    var_1 thread glsentry_watch_ammo( var_2, self );
}

glsentry_watch_ammo( var_0, var_1 )
{
    self endon( "death" );
    self.turret_ammo = var_0;
    thread watch_players_onoff_turret();

    while ( var_0 > 0 )
    {
        self waittill( "turret_fire" );
        var_0--;
    }

    self.forcedisable = 1;
    self maketurretinoperable();

    if ( isdefined( self.owner ) && isalive( self.owner ) )
        thread watch_player_disengage( var_1 );
}

use_dpad_glsentry( var_0, var_1 )
{
    thread glsentry_placed_listener( var_1 );
    self.carriedsentry [[ level.sentry_setplaced_func ]]();
    self enableweapons();
    self.carriedsentry = undefined;
    self.iscarrying = 0;

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );

    level thread maps\mp\alien\_music_and_dialog::playvoforsentry( self, "grenade" );
}

canceluse_dpad_glsentry( var_0, var_1 )
{
    if ( isdefined( self.carriedsentry ) )
        self.carriedsentry [[ level.sentry_setcancelled_func ]]();

    self enableweapons();

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );
}

get_valid_grenade_turret_count()
{
    var_0 = get_all_my_sentry( "grenade" );
    return get_valid_equipment_count( var_0 );
}

canpurchase_dpad_minigun_turret( var_0, var_1 )
{
    var_2 = get_valid_minigun_turret_count();
    var_3 = 1;

    if ( var_2 >= var_3 )
    {
        self iprintlnbold( &"ALIEN_COLLECTIBLES_MAX_TURRETS" );
        return 0;
    }

    return default_canpurchase( var_0, var_1 );
}

tryuse_dpad_minigun_turret( var_0, var_1 )
{
    self.last_weapon = self getcurrentweapon();

    if ( var_1 == 0 )
    {
        self.last_weapon = self getcurrentweapon();
        self.last_sentry = "minigun_turret";
        var_2 = [[ level.createsentryforplayer_func ]]( "minigun_turret", self );
        self.carriedsentry = var_2;
        var_2 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 1 )
    {
        self.last_weapon = self getcurrentweapon();
        self.last_sentry = "minigun_turret_1";
        var_3 = [[ level.createsentryforplayer_func ]]( "minigun_turret_1", self );
        self.carriedsentry = var_3;
        var_3 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 2 )
    {
        self.last_weapon = self getcurrentweapon();
        self.last_sentry = "minigun_turret";
        var_4 = [[ level.createsentryforplayer_func ]]( "minigun_turret_2", self );
        self.carriedsentry = var_4;
        var_4 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 3 )
    {
        self.last_weapon = self getcurrentweapon();
        self.last_sentry = "minigun_turret";
        var_5 = [[ level.createsentryforplayer_func ]]( "minigun_turret_3", self );
        self.carriedsentry = var_5;
        var_5 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }

    if ( var_1 == 4 )
    {
        self.last_weapon = self getcurrentweapon();
        self.last_sentry = "minigun_turret";
        var_6 = [[ level.createsentryforplayer_func ]]( "minigun_turret_4", self );
        self.carriedsentry = var_6;
        var_6 [[ level.sentry_setcarried_func ]]( self );
        self disableweapons();
    }
}

minigun_turret_placed_listener( var_0 )
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self disableweaponswitch();
    self waittill( "new_sentry", var_1 );
    self enableweaponswitch();
    var_1.owner = self;
    thread manage_sentry_count( var_0, "minigun" );

    if ( issentient( var_1 ) )
        var_1.threatbias = -1000;

    var_1.maxhealth = 150;
    var_2 = 100;

    switch ( var_0 )
    {
        case 1:
            var_2 = 125;
            break;
        case 2:
            var_2 = 150;
            break;
        case 3:
            var_2 = 175;
            break;
        case 4:
            var_2 = 200;
            break;
        default:
            var_2 = 100;
    }

    var_1 thread minigun_turret_watch_ammo( var_2, self );
}

minigun_turret_watch_ammo( var_0, var_1 )
{
    self endon( "death" );
    self.turret_ammo = var_0;
    thread watch_players_onoff_turret();

    while ( var_0 > 0 )
    {
        self waittill( "turret_fire" );
        var_0--;
    }

    self.forcedisable = 1;
    self turretfiredisable();

    if ( isdefined( self.owner ) && isalive( self.owner ) )
        thread watch_player_disengage( var_1 );
}

turret_update_ammocounter( var_0 )
{
    self endon( "death" );
    self notify( "turretupdateammocount" );
    self endon( "turretupdateammocount" );

    while ( self.turret_ammo > 0 )
    {
        self waittill( "turret_fire" );
        self.turret_ammo--;

        if ( isdefined( var_0 ) && isalive( var_0 ) )
        {
            var_0 notify( "turret_fire" );
            var_0 maps\mp\alien\_utility::set_turret_ammocount( self.turret_ammo );
        }
    }
}

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

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

        if ( !isplayer( var_0 ) )
            continue;

        if ( isdefined( self.turret_ammo ) )
        {
            var_0 maps\mp\alien\_utility::show_turret_icon( 1 );
            var_0 maps\mp\alien\_utility::set_turret_ammocount( self.turret_ammo );

            if ( !maps\mp\alien\_utility::is_chaos_mode() )
                var_0 maps\mp\alien\_utility::disable_special_ammo();
        }

        thread turret_update_ammocounter( var_0 );
        thread clear_turret_ammo_counter_on_death( var_0 );
        self waittill( "turret_deactivate" );

        if ( isdefined( var_0 ) && isalive( var_0 ) )
        {
            var_0 notify( "weapon_change", var_0 getcurrentprimaryweapon() );
            var_0 maps\mp\alien\_utility::hide_turret_icon();
        }
    }
}

watch_player_disengage( var_0 )
{
    var_0 thread maps\mp\alien\_utility::wait_for_player_to_dismount_turret();
    self waittill( "player_dismount" );
    self.deleting = 1;
    wait 1;
    self notify( "death" );

    if ( isdefined( var_0 ) && isalive( var_0 ) )
    {
        var_0 maps\mp\alien\_utility::hide_turret_icon();

        if ( !maps\mp\alien\_utility::is_chaos_mode() )
            var_0 maps\mp\alien\_utility::enable_special_ammo();

        var_1 = var_0 getcurrentweapon();
        var_0 notify( "weapon_change", var_1 );
    }
}

clear_turret_ammo_counter_on_death( var_0 )
{
    self notify( "clearammocounterondeath" );
    self endon( "clearammocounterondeath" );
    self endon( "turret_deactivate" );
    var_0 endon( "disconnect" );
    self waittill( "death" );
    var_0 maps\mp\alien\_utility::hide_turret_icon();
    var_0 maps\mp\alien\_utility::enable_special_ammo();
}

use_dpad_minigun_turret( var_0, var_1 )
{
    thread minigun_turret_placed_listener( var_1 );
    self.carriedsentry [[ level.sentry_setplaced_func ]]();
    self enableweapons();
    self.carriedsentry = undefined;
    self.iscarrying = 0;

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );

    level thread maps\mp\alien\_music_and_dialog::playvoforsentry( self, "generic" );
}

canceluse_dpad_minigun_turret( var_0, var_1 )
{
    if ( isdefined( self.carriedsentry ) )
        self.carriedsentry [[ level.sentry_setcancelled_func ]]();

    self enableweapons();

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );
}

get_valid_minigun_turret_count()
{
    var_0 = get_all_my_sentry( "minigun" );
    return get_valid_equipment_count( var_0 );
}

canpurchase_dpad_ims( var_0, var_1 )
{
    if ( isdefined( self.imslist ) )
        var_2 = get_valid_equipment_count( self.imslist );
    else
        var_2 = 0;

    if ( var_2 > 0 )
    {
        self iprintlnbold( &"ALIEN_COLLECTIBLES_MAX_IMS" );
        return 0;
    }

    return default_canpurchase( var_0, var_1 );
}

tryuse_dpad_ims( var_0, var_1 )
{
    self.last_weapon = self getcurrentweapon();
    var_2 = undefined;

    switch ( var_1 )
    {
        case 0:
            var_2 = "alien_ims";
            break;
        case 1:
            var_2 = "alien_ims_1";
            break;
        case 2:
            var_2 = "alien_ims_2";
            break;
        case 3:
            var_2 = "alien_ims_3";
            break;
        case 4:
            var_2 = "alien_ims_4";
            break;
    }

    var_3 = maps\mp\killstreaks\_ims::createimsforplayer( var_2, self );
    self.carriedims = var_3;
    var_3.firstplacement = 1;
    thread maps\mp\killstreaks\_ims::setcarryingims( var_3, 1 );

    if ( issentient( self.carriedims ) )
        self.carriedims.threatbias = -3000;
}

use_dpad_ims( var_0, var_1 )
{
    self enableweapons();
    self.carriedims = undefined;
    self.iscarrying = 0;

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );

    self enableweaponswitch();
    level thread maps\mp\alien\_music_and_dialog::playvoforims( self );
}

canceluse_dpad_ims( var_0, var_1 )
{
    self enableweapons();

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );
}

ims_fire_cloud( var_0, var_1 )
{
    self endon( "death" );
    var_1 endon( "disconnect" );
    level endon( "game_ended" );
    var_2 = 9;

    if ( var_1 maps\mp\alien\_persistence::is_upgrade_enabled( "ims_fire_upgrade" ) )
    {
        level thread maps\mp\alien\_collectibles::firecloudmonitor( var_1, var_2, var_0 );
        level thread maps\mp\alien\_collectibles::firecloudsfx( var_2, var_0 );
    }
}

ims_grace_period_scalar( var_0, var_1 )
{
    if ( var_1 maps\mp\alien\_persistence::is_upgrade_enabled( "ims_gracetime_upgrade" ) )
        var_0 = var_0 / 2;

    return var_0;
}

canpurchase_dpad_backup_buddy( var_0, var_1 )
{
    if ( has_backup_uav() )
    {
        self iprintlnbold( &"ALIEN_COLLECTIBLES_MAX_DRONE" );
        return 0;
    }

    return default_canpurchase( var_0, var_1 );
}

tryuse_dpad_backup_buddy( var_0, var_1 )
{
    self.picking_up_item = 1;
    self.last_weapon = self getcurrentweapon();
    maps\mp\_utility::_giveweapon( "mortar_detonator_mp" );
    self switchtoweaponimmediate( "mortar_detonator_mp" );
    thread maps\mp\alien\_collectibles::clear_item_pickup();
}

use_dpad_backup_buddy( var_0, var_1 )
{
    if ( var_1 == 0 )
        maps\mp\killstreaks\_ball_drone::useballdrone( "alien_ball_drone" );

    if ( var_1 == 1 )
        maps\mp\killstreaks\_ball_drone::useballdrone( "alien_ball_drone_1" );

    if ( var_1 == 2 )
        maps\mp\killstreaks\_ball_drone::useballdrone( "alien_ball_drone_2" );

    if ( var_1 == 3 )
        maps\mp\killstreaks\_ball_drone::useballdrone( "alien_ball_drone_3" );

    if ( var_1 == 4 )
        maps\mp\killstreaks\_ball_drone::useballdrone( "alien_ball_drone_4" );

    wait 0.1;
    self notify( "action_use" );

    if ( maps\mp\alien\_utility::is_true( self.drone_failed ) )
    {
        self.drone_failed = undefined;
        self iprintlnbold( &"ALIEN_COLLECTIBLES_REMOTE_TANK_CANNOT_PLACE" );
        maps\mp\alien\_persistence::give_player_currency( ceil( var_0.upgrades[var_1].cost ) );
    }
    else
    {
        level notify( "dlc_vo_notify", "online_vulture", self );

        if ( !isdefined( level.use_dlc_vo ) )
            level thread maps\mp\alien\_music_and_dialog::playvofordrone( self );
    }

    self takeweapon( "mortar_detonator_mp" );

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );
}

canceluse_dpad_backup_buddy( var_0, var_1 )
{
    self takeweapon( "mortar_detonator_mp" );
    self.deployable = 0;

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );

    return 1;
}

ball_drone_timeout_scalar( var_0, var_1 )
{
    if ( var_1 maps\mp\alien\_persistence::is_upgrade_enabled( "vulture_duration_upgrade" ) )
        var_0 = var_0 * 1.5;

    return var_0;
}

ball_drone_fire_rocket_scalar( var_0, var_1 )
{
    if ( var_1 maps\mp\alien\_persistence::is_upgrade_enabled( "vulture_duration_upgrade" ) )
        var_0 = var_0 * 0.6;

    return var_0;
}

tryuse_dpad_airstrike( var_0, var_1 )
{
    self.last_weapon = self getcurrentweapon();
    maps\mp\_utility::_giveweapon( "mortar_detonator_mp" );
    self switchtoweaponimmediate( "mortar_detonator_mp" );
}

use_dpad_airstrike( var_0, var_1 )
{
    level thread maps\mp\alien\_music_and_dialog::playvoformortarstrike( self );
    self takeweapon( "mortar_detonator_mp" );

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );

    domortar( var_1 );
}

canceluse_dpad_airstrike( var_0, var_1 )
{
    self takeweapon( "mortar_detonator_mp" );

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );

    return 1;
}

domortar( var_0 )
{
    var_1 = 2;
    var_2 = 300;
    var_3 = 1000;
    var_4 = 4000;

    if ( var_0 == 0 )
    {
        var_1 = 3;
        var_2 = 200;
        var_3 = 500;
        var_4 = 1000;
    }

    if ( var_0 == 1 )
    {
        var_1 = 4;
        var_2 = 200;
        var_3 = 500;
        var_4 = 1000;
    }

    if ( var_0 == 2 )
    {
        var_1 = 4;
        var_2 = 256;
        var_3 = 500;
        var_4 = 1500;
    }

    if ( var_0 == 3 )
    {
        var_1 = 5;
        var_2 = 350;
        var_3 = 500;
        var_4 = 1500;
    }

    if ( var_0 == 4 )
    {
        var_1 = 6;
        var_2 = 350;
        var_3 = 1000;
        var_4 = 2000;
    }

    var_5 = 1;
    var_6 = self.origin;

    for ( var_7 = 0; var_7 < var_1; var_7++ )
    {
        var_8 = bullettrace( var_6 + ( 0, 0, 500 ), var_6 - ( 0, 0, 500 ), 0 );

        if ( isdefined( var_8["position"] ) )
        {
            playfx( level.mortar_fx["tracer"], var_6 );
            thread maps\mp\_utility::playsoundinspace( "fast_artillery_round", var_6 );
            wait( randomfloatrange( 0.5, 1.5 ) );
            playfx( level.mortar_fx["explosion"], var_6 );
            radiusdamage( self.origin, var_2, var_4, var_3, self, "MOD_EXPLOSIVE", "alienmortar_strike_mp" );
            playrumbleonposition( "grenade_rumble", var_6 );
            earthquake( 1.0, 0.6, var_6, 2000 );
            thread maps\mp\_utility::playsoundinspace( "exp_suitcase_bomb_main", var_6 );
            physicsexplosionsphere( var_6 + ( 0, 0, 30 ), 250, 125, 2 );
            var_5 = var_5 * -1;
        }

        var_6 = self.origin + ( randomintrange( 100, 600 ) * var_5, randomintrange( 100, 600 ) * var_5, 0 );
    }
}

tryuse_dpad_team_specialammo( var_0, var_1 )
{
    default_tryuse_dpad_team_specialammo( var_1, "deployable_specialammo" );
}

deployable_specialammo_placed_listener()
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self waittill( "new_deployable_box", var_0 );
    track_deployables( var_0 );
    var_0 setcandamage( 0 );
    var_0 setcanradiusdamage( 0 );
}

use_dpad_team_specialammo( var_0, var_1 )
{
    thread deployable_specialammo_placed_listener();
    self.deployable = 0;
    level thread maps\mp\alien\_music_and_dialog::playvoforspecialammo( self );
}

tryuse_dpad_team_specialammo_explo( var_0, var_1 )
{
    default_tryuse_dpad_team_specialammo( var_1, "deployable_specialammo_explo" );
}

use_dpad_team_specialammo_explo( var_0, var_1 )
{
    thread deployable_specialammo_placed_listener();
    self.deployable = 0;
    level notify( "dlc_vo_notify", "ready_explosiverounds", self );

    if ( !isdefined( level.use_dlc_vo ) )
        level thread maps\mp\alien\_music_and_dialog::playvoforspecialammo( self );
}

tryuse_dpad_team_specialammo_ap( var_0, var_1 )
{
    default_tryuse_dpad_team_specialammo( var_1, "deployable_specialammo_ap" );
}

tryuse_dpad_team_specialammo_in( var_0, var_1 )
{
    default_tryuse_dpad_team_specialammo( var_1, "deployable_specialammo_in" );
}

use_dpad_team_specialammo_in( var_0, var_1 )
{
    thread deployable_specialammo_placed_listener();
    self.deployable = 0;
    level notify( "dlc_vo_notify", "ready_incendiaryrounds", self );

    if ( !isdefined( level.use_dlc_vo ) )
        level thread maps\mp\alien\_music_and_dialog::playvoforspecialammo( self );
}

tryuse_dpad_team_specialammo_comb( var_0, var_1 )
{
    default_tryuse_dpad_team_specialammo( var_1, "deployable_specialammo_comb" );
}

use_dpad_team_specialammo_comb( var_0, var_1 )
{
    thread deployable_combinedammo_placed_listener();
    self.deployable = 0;
    level notify( "dlc_vo_notify", "ready_explosiverounds", self );

    if ( !isdefined( level.use_dlc_vo ) )
        level thread maps\mp\alien\_music_and_dialog::playvoforspecialammo( self );
}

deployable_combinedammo_placed_listener()
{
    self endon( "death" );
    self endon( "disconnect" );
    level endon( "game_ended" );
    self waittill( "new_deployable_box", var_0 );
    track_deployables( var_0 );
    var_0 setcandamage( 0 );
    var_0 setcanradiusdamage( 0 );

    if ( var_0.upgrade_rank == 4 )
        var_0 thread team_combined_ammo_regen();
}

team_combined_ammo_regen()
{
    self endon( "death" );
    self endon( "ammo_regen_timeout" );
    var_0 = 65536.0;
    var_1 = 0.1;

    for (;;)
    {
        foreach ( var_3 in level.players )
        {
            if ( isalive( var_3 ) && distancesquared( self.origin, var_3.origin ) < var_0 )
                var_3 maps\mp\alien\_deployablebox_functions::addratiomaxstockcombinedtoallweapons( var_1 );

            wait 5.0;
        }
    }
}

tryuse_dpad_war_machine( var_0, var_1 )
{
    thread tryuse_dpad_war_machine_internal( var_0, var_1 );
}

tryuse_dpad_war_machine_internal( var_0, var_1 )
{
    waittillframeend;
    maps\mp\alien\_utility::store_weapons_status();
    self.last_weapon = self getcurrentweapon();
    var_2 = "iw6_alienmk32_mp";

    switch ( var_1 )
    {
        case 0:
            var_2 = "iw6_alienmk32_mp";
            break;
        case 1:
            var_2 = "iw6_alienmk321_mp";
            break;
        case 2:
            var_2 = "iw6_alienmk322_mp";
            break;
        case 3:
            var_2 = "iw6_alienmk323_mp";
            break;
        case 4:
            var_2 = "iw6_alienmk324_mp";
            break;
    }

    maps\mp\_utility::_giveweapon( var_2 );
    wait 0.05;
    self switchtoweapon( var_2 );
    self disableweaponswitch();
}

use_dpad_war_machine( var_0, var_1 )
{
    var_2 = "iw6_alienmk32_mp";

    switch ( var_1 )
    {
        case 0:
            var_2 = "iw6_alienmk32_mp";
            break;
        case 1:
            var_2 = "iw6_alienmk321_mp";
            break;
        case 2:
            var_2 = "iw6_alienmk322_mp";
            break;
        case 3:
            var_2 = "iw6_alienmk323_mp";
            break;
        case 4:
            var_2 = "iw6_alienmk324_mp";
            break;
    }

    self notify( "dlc_vo_notify", "online_mk32", self );
    thread watch_ammo( var_2 );

    if ( !isdefined( level.use_dlc_vo ) )
        level thread maps\mp\alien\_music_and_dialog::playvoforwarmachine( self );
}

canceluse_dpad_war_machine( var_0, var_1 )
{
    self endon( "disconnect" );
    wait_to_cancel_dpad_weapon();
    var_2 = "iw6_alienmk32_mp";

    switch ( var_1 )
    {
        case 0:
            var_2 = "iw6_alienmk32_mp";
            break;
        case 1:
            var_2 = "iw6_alienmk321_mp";
            break;
        case 2:
            var_2 = "iw6_alienmk322_mp";
            break;
        case 3:
            var_2 = "iw6_alienmk323_mp";
            break;
        case 4:
            var_2 = "iw6_alienmk324_mp";
            break;
    }

    self takeweapon( var_2 );

    if ( !isdefined( level.drill_carrier ) || isdefined( level.drill_carrier ) && self != level.drill_carrier )
    {
        self switchtoweapon( self.last_weapon );
        self enableweaponswitch();
    }
}

tryuse_dpad_death_machine( var_0, var_1 )
{
    thread tryuse_dpad_death_machine_internal( var_0, var_1 );
}

tryuse_dpad_death_machine_internal( var_0, var_1 )
{
    waittillframeend;
    maps\mp\alien\_utility::store_weapons_status();
    self.last_weapon = self getcurrentweapon();
    var_2 = "iw6_alienminigun_mp";

    switch ( var_1 )
    {
        case 0:
            var_2 = "iw6_alienminigun_mp";
            break;
        case 1:
            var_2 = "iw6_alienminigun1_mp";
            break;
        case 2:
            var_2 = "iw6_alienminigun2_mp";
            break;
        case 3:
            var_2 = "iw6_alienminigun3_mp";
            break;
        case 4:
            var_2 = "iw6_alienminigun4_mp";
            break;
    }

    maps\mp\_utility::_giveweapon( var_2 );
    wait 0.05;
    self switchtoweapon( var_2 );
    self disableweaponswitch();
}

use_dpad_death_machine( var_0, var_1 )
{
    var_2 = "iw6_alienminigun_mp";

    switch ( var_1 )
    {
        case 0:
            var_2 = "iw6_alienminigun_mp";
            break;
        case 1:
            var_2 = "iw6_alienminigun1_mp";
            break;
        case 2:
            var_2 = "iw6_alienminigun2_mp";
            break;
        case 3:
            var_2 = "iw6_alienminigun3_mp";
            break;
        case 4:
            var_2 = "iw6_alienminigun4_mp";
            break;
    }

    thread watch_ammo( var_2 );
    level thread maps\mp\alien\_music_and_dialog::playvofordeathmachine( self );
}

canceluse_dpad_death_machine( var_0, var_1 )
{
    self endon( "disconnect" );
    wait_to_cancel_dpad_weapon();
    var_2 = "iw6_alienminigun_mp";

    switch ( var_1 )
    {
        case 0:
            var_2 = "iw6_alienminigun_mp";
            break;
        case 1:
            var_2 = "iw6_alienminigun1_mp";
            break;
        case 2:
            var_2 = "iw6_alienminigun2_mp";
            break;
        case 3:
            var_2 = "iw6_alienminigun3_mp";
            break;
        case 4:
            var_2 = "iw6_alienminigun4_mp";
            break;
    }

    self takeweapon( var_2 );

    if ( !isdefined( level.drill_carrier ) || isdefined( level.drill_carrier ) && self != level.drill_carrier )
    {
        self switchtoweapon( self.last_weapon );
        self enableweaponswitch();
    }
}

wait_to_cancel_dpad_weapon()
{
    self endon( "disconnect" );
    var_0 = gettime() + 1000;

    while ( !maps\mp\alien\_utility::has_special_weapon() || var_0 < gettime() )
        wait 0.05;
}

watch_ammo( var_0 )
{
    self notify( "watchammo" );
    self endon( "watchammo" );
    level endon( "game_ended" );
    self endon( "disconnect" );
    var_1 = self getammocount( var_0 );

    for (;;)
    {
        var_2 = self getammocount( var_0 );

        if ( var_2 == var_1 - 1 )
            self notify( "fired_ability_gun" );

        if ( var_2 == 0 )
        {
            self takeweapon( var_0 );
            self switchtoweapon( self.last_weapon );
            self enableweaponswitch();
            break;
        }

        wait 0.05;
    }
}

tryuse_dpad_predator( var_0, var_1 )
{
    if ( isdefined( level.alternate_trinity_weapon_try_use ) )
    {
        [[ level.alternate_trinity_weapon_try_use ]]( var_0, var_1 );
        return 1;
    }

    self.last_weapon = self getcurrentweapon();
    maps\mp\_utility::_giveweapon( "switchblade_laptop_mp" );
    self switchtoweaponimmediate( "switchblade_laptop_mp" );
}

use_dpad_predator( var_0, var_1 )
{
    if ( isdefined( level.alternate_trinity_weapon_use ) )
    {
        [[ level.alternate_trinity_weapon_use ]]( var_0, var_1 );
        return 1;
    }

    if ( maps\mp\alien\_utility::is_in_laststand() )
        return;

    self.turn_off_class_skill_activation = 1;
    var_2 = 0;
    var_3 = "switchblade_rocket_mp";
    var_4 = "switchblade_baby_mp";
    var_5 = 14000;

    if ( var_1 == 0 )
        var_2 = 0;

    if ( var_1 == 1 )
        var_2 = 0;

    if ( var_1 == 2 )
        var_2 = 1;

    if ( var_1 == 3 )
    {
        var_2 = 2;
        var_5 = 16000;
        var_4 = "switchblade_babyfast_mp";
    }

    if ( var_1 == 4 )
    {
        var_2 = 4;
        var_5 = 18000;
        var_4 = "switchblade_babyfast_mp";
    }

    if ( isdefined( level.tryusedronehive ) )
        self [[ level.tryusedronehive ]]( var_1, var_2, var_3, var_5, var_4 );

    wait 0.1;
}

canceluse_dpad_predator( var_0, var_1 )
{
    if ( isdefined( level.alternate_trinity_weapon_cancel_use ) )
    {
        [[ level.alternate_trinity_weapon_cancel_use ]]( var_0, var_1 );
        return 1;
    }

    self.turn_off_class_skill_activation = undefined;
    self takeweapon( "switchblade_laptop_mp" );

    if ( isdefined( self.last_weapon ) )
        self switchtoweapon( self.last_weapon );

    return 1;
}

alien_begindeployableviamarker( var_0, var_1 )
{
    self endon( "death" );
    self endon( "disconnect" );
    self endon( "cancel_deployable_via_marker" );
    level endon( "game_ended" );
    self waittill( "grenade_fire", var_2, var_3 );

    if ( var_3 != "aliendeployable_crate_marker_mp" )
        return 0;

    self.marker = var_2;
    takedeployableonstuck( var_2, var_3, var_1 );
    var_2.owner = self;
    var_2.weaponname = var_3;
    var_2 thread maps\mp\alien\_deployablebox::markeractivate( var_0, var_1, maps\mp\alien\_deployablebox::box_setactive );
    return 1;
}

takedeployableonstuck( var_0, var_1, var_2 )
{
    var_0 playsoundtoplayer( level.boxsettings[var_2].deployedsfx, self );

    if ( self hasweapon( var_1 ) )
    {
        self takeweapon( var_1 );
        self switchtoweapon( common_scripts\utility::getlastweapon() );
    }
}

common_tryuse_actions()
{
    self.last_weapon = self getcurrentweapon();
    self giveweapon( "aliendeployable_crate_marker_mp" );
    self switchtoweapon( "aliendeployable_crate_marker_mp" );
    self.deployable = 1;
}

get_valid_equipment_count( var_0 )
{
    var_1 = 0;

    foreach ( var_3 in var_0 )
    {
        if ( var_3 is_equipment_valid( self ) )
            var_1++;
    }

    return var_1;
}

get_all_my_sentry( var_0 )
{
    var_1 = [];

    foreach ( var_3 in level.turrets )
    {
        if ( isalive( var_3 ) && level.sentrysettings[var_3.sentrytype].streakname == var_0 && ( isdefined( var_3.originalowner ) && var_3.originalowner == self || var_3.owner == self ) )
            var_1[var_1.size] = var_3;
    }

    return var_1;
}

is_equipment_valid( var_0 )
{
    var_1 = 360000;

    if ( !isdefined( self ) || !isalive( self ) || isdefined( self.deleting ) )
        return 0;

    if ( distancesquared( self.origin, var_0.origin ) < var_1 )
        return 1;

    var_2 = var_0 maps\mp\alien\_utility::get_in_world_area();

    if ( isdefined( self.in_world_area ) )
        var_3 = self.in_world_area;
    else
        var_3 = maps\mp\alien\_utility::get_in_world_area();

    if ( var_3 == var_2 )
        return 1;

    return 0;
}

manage_sentry_count( var_0, var_1 )
{
    wait 2.0;
    var_2 = get_max_sentry_count( var_0, var_1 );
    var_3 = [];

    switch ( var_1 )
    {
        case "sentry":
            var_3 = get_all_my_sentry( "sentry" );
            break;
        case "grenade":
            var_3 = get_all_my_sentry( "grenade" );
            break;
        case "minigun":
            var_3 = get_all_my_sentry( "minigun" );
            break;
        default:
            var_3 = get_all_my_sentry( "sentry" );
    }

    var_4 = var_3.size - var_2;

    if ( var_4 > 0 )
        remove_extra_equipment( var_3, var_4 );
}

remove_extra_equipment( var_0, var_1 )
{
    for ( var_2 = 0; var_2 < var_1; var_2++ )
    {
        var_3 = common_scripts\utility::getfarthest( self.origin, var_0 );
        var_0 = common_scripts\utility::array_remove( var_0, var_3 );
        var_3 notify( "death" );
    }
}

get_max_sentry_count( var_0, var_1 )
{
    if ( var_1 == "sentry" )
    {
        switch ( var_0 )
        {
            case 4:
                return 2;
            default:
                return 1;
        }
    }
    else
        return 1;
}

default_canuse( var_0 )
{
    if ( self attackbuttonpressed() )
        return 0;

    return alt_canuse( var_0 );
}

alt_canuse( var_0 )
{
    if ( isdefined( self.laststand ) && self.laststand )
        return 0;

    return 1;
}

default_canpurchase( var_0, var_1 )
{
    if ( maps\mp\alien\_utility::is_holding_deployable() )
        return 0;

    if ( maps\mp\alien\_utility::has_special_weapon() )
        return 0;

    if ( isdefined( self.laststand ) && self.laststand )
        return 0;

    return 1;
}

alt_canpurchase( var_0, var_1 )
{
    if ( self attackbuttonpressed() )
        return 0;

    return default_canpurchase( var_0, var_1 );
}

default_tryuse_dpad_team_specialammo( var_0, var_1 )
{
    self.team_specialammo_rank = var_0;
    common_tryuse_actions();
    thread maps\mp\alien\_deployablebox::default_tryusedeployable( var_0, var_1 );
}
