share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua
changeset 14230 8edbdd3a1fe7
parent 13720 8e3d2f7d8737
equal deleted inserted replaced
14229:e590fb0f2567 14230:8edbdd3a1fe7
    28     if processed == nil or not processed then
    28     if processed == nil or not processed then
    29         -- Get the ammo for this hog's team
    29         -- Get the ammo for this hog's team
    30         local ammo = getTeamValue(name, "ammo")
    30         local ammo = getTeamValue(name, "ammo")
    31         -- If there is no ammo, get a random one from the list and store it
    31         -- If there is no ammo, get a random one from the list and store it
    32         if ammo == nil then
    32         if ammo == nil then
    33             ammo = weapons[GetRandom(table.maxn(weapons)) + 1]
    33             ammo = weapons[GetRandom(#weapons) + 1]
    34             setTeamValue(name, "ammo", ammo)
    34             setTeamValue(name, "ammo", ammo)
    35         end
    35         end
    36         -- Add the ammo for the hog
    36         -- Add the ammo for the hog
    37         AddAmmo(hog, ammo)
    37         AddAmmo(hog, ammo)
    38         -- Mark as processed
    38         -- Mark as processed