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

init()
{
    var_0 = spawnstruct();
    var_0.weaponinfo = "deployable_vest_marker_mp";
    var_0.modelbase = "afr_mortar_ammo_01";
    var_0.hintstring = &"KILLSTREAKS_HINTS_DEPLOYABLE_GRENADES_PICKUP";
    var_0.capturingstring = &"KILLSTREAKS_DEPLOYABLE_GRENADES_TAKING";
    var_0.event = "deployable_grenades_taken";
    var_0.streakname = "deployable_grenades";
    var_0.splashname = "used_deployable_grenades";
    var_0.shadername = "compass_objpoint_deploy_grenades_friendly";
    var_0.headiconoffset = 25;
    var_0.lifespan = 90.0;
    var_0.usexp = 50;
    var_0.xppopup = "destroyed_vest";
    var_0.vodestroyed = "ballistic_vest_destroyed";
    var_0.deployedsfx = "mp_vest_deployed_ui";
    var_0.onusesfx = "ammo_crate_use";
    var_0.onusecallback = ::onusedeployable;
    var_0.canusecallback = ::canusedeployable;
    var_0.usetime = 500;
    var_0.maxhealth = 150;
    var_0.damagefeedback = "deployable_bag";
    var_0.deathweaponinfo = "deployable_grenades_mp";
    var_0.deathvfx = loadfx( "fx/explosions/grenadeexp_default" );
    var_0.deathdamageradius = 256;
    var_0.deathdamagemax = 150;
    var_0.deathdamagemin = 50;
    var_0.allowmeleedamage = 1;
    var_0.allowgrenadedamage = 1;
    var_0.maxuses = 3;
    level.boxsettings["deployable_grenades"] = var_0;
    level.killstreakfuncs["deployable_grenades"] = ::tryusedeployablegrenades;
    level.deployable_box["deployable_grenades"] = [];
}

tryusedeployablegrenades( var_0, var_1 )
{
    var_2 = maps\mp\killstreaks\_deployablebox::begindeployableviamarker( var_0, "deployable_grenades" );

    if ( !isdefined( var_2 ) || !var_2 )
        return 0;

    maps\mp\_matchdata::logkillstreakevent( "deployable_grenades", self.origin );
    return 1;
}

onusedeployable( var_0 )
{
    refillexplosiveweapons();
}

refillexplosiveweapons()
{
    var_0 = self getweaponslistall();

    if ( isdefined( var_0 ) )
    {
        foreach ( var_2 in var_0 )
        {
            if ( maps\mp\gametypes\_weapons::isgrenade( var_2 ) || maps\mp\gametypes\_weapons::isoffhandweapon( var_2 ) )
                self givestartammo( var_2 );
        }
    }

    if ( maps\mp\_utility::_hasperk( "specialty_tacticalinsertion" ) && self getammocount( "flare_mp" ) < 1 )
        maps\mp\_utility::giveperkoffhand( "specialty_tacticalinsertion", 0 );
}

canusedeployable( var_0 )
{
    if ( maps\mp\_utility::is_aliens() && isdefined( var_0 ) && var_0.owner == self && !isdefined( var_0.air_dropped ) )
        return 0;

    return !maps\mp\_utility::isjuggernaut();
}
