diff --git a/Moose Development/Moose/Functional/Range.lua b/Moose Development/Moose/Functional/Range.lua index 10400df85..e3e3590cb 100644 --- a/Moose Development/Moose/Functional/Range.lua +++ b/Moose Development/Moose/Functional/Range.lua @@ -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.