require "Insurgent/InsurgentTraitDefinitions"

LoadoutReconTrait = CreateInsurgentTrait()
LoadoutReconTrait.name = "LoadoutRecon"
LoadoutReconTrait.insurgentExclusive = true
LoadoutReconTrait.mutualExclusions = {"LoadoutRifleman", "LoadoutMarksman", "LoadoutAssault", "LoadoutMachinegunner"}
LoadoutReconTrait.description  = getText("UI_trait_LoadoutReconDesc_FIREARMSB41_VERSION")

function LoadoutReconTrait.Create()
    local lRecon = TraitFactory.addTrait("LoadoutRecon", getText("UI_trait_LoadoutRecon"), 4, LoadoutReconTrait.description, false, false);
    lRecon:addXPBoost(Perks.Sprinting, 1);
    return lRecon;
end

function LoadoutReconTrait.OnNewGame(player)
    if not player:HasTrait("LoadoutRecon") then
        return
    end

    local weapon = InsurgentWeaponUtil.addWeapon(player, "Base.MP5", {"Base.RedDot", "Base.Sling"})
    InsurgentWeaponUtil.addMags(player, "Base.MP5Mag", 6)
    InsurgentWeaponUtil.equipAndFullyLoadWeapon(player, weapon, "Base.MP5Mag")
end

function LoadoutReconTrait.RegisterEvents()
    Events.OnNewGame.Add(LoadoutReconTrait.OnNewGame)
end