mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
RANGE 1.0.3
Improved ammo counting.
This commit is contained in:
parent
b3facc6e88
commit
9de6993a4c
@ -227,7 +227,7 @@ RANGE.id="RANGE | "
|
||||
|
||||
--- Range script version.
|
||||
-- @field #number version
|
||||
RANGE.version="1.0.2"
|
||||
RANGE.version="1.0.3"
|
||||
|
||||
--TODO list
|
||||
--TODO: Add statics for strafe pits.
|
||||
@ -1573,6 +1573,9 @@ end
|
||||
function RANGE:_GetAmmo(unitname)
|
||||
self:F(unitname)
|
||||
|
||||
-- Init counter.
|
||||
local ammo=0
|
||||
|
||||
local unit, playername = self:_GetPlayerUnitAndName(unitname)
|
||||
|
||||
if unit and playername then
|
||||
@ -1580,7 +1583,7 @@ function RANGE:_GetAmmo(unitname)
|
||||
local has_ammo=false
|
||||
|
||||
local ammotable=unit:GetAmmo()
|
||||
self:E({ammotable=ammotable})
|
||||
self:T2({ammotable=ammotable})
|
||||
|
||||
if ammotable ~= nil then
|
||||
|
||||
@ -1594,16 +1597,19 @@ function RANGE:_GetAmmo(unitname)
|
||||
|
||||
-- We are specifically looking for shells here.
|
||||
if string.match(Tammo, "shell") then
|
||||
|
||||
-- Add up all shells
|
||||
ammo=ammo+Nammo
|
||||
|
||||
local text=string.format("Player %s has %d rounds ammo of type %s", playername, Nammo, Tammo)
|
||||
self:T(RANGE.id..text)
|
||||
MESSAGE:New(text, 10):ToAllIf(self.Debug)
|
||||
return Nammo
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return 0
|
||||
return ammo
|
||||
end
|
||||
|
||||
--- Mark targets on F10 map.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user