AmmoLevelLow

Check if ammunition level is low

Usage: Used in 7 task(s)

Lua Implementation

-- Ammo Level Low
function evaluate(params)
    local weaponSystem = this:getSystem(params.weapon_system or "Gun")

    if weaponSystem then
        local ammo = weaponSystem:getAmmunitionCount()
        local maxAmmo = weaponSystem:getMaxAmmunition()
        local lowThreshold = params.low_threshold or 0.25

        return (ammo / maxAmmo) <= lowThreshold
    end

    return false
end