mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -1812,7 +1812,7 @@ function OPSGROUP:GetVec3(UnitName)
|
|||||||
local carrier=self:_GetMyCarrierElement()
|
local carrier=self:_GetMyCarrierElement()
|
||||||
if carrier and carrier.status~=OPSGROUP.ElementStatus.DEAD and self:IsLoaded() then
|
if carrier and carrier.status~=OPSGROUP.ElementStatus.DEAD and self:IsLoaded() then
|
||||||
local unit=carrier.unit
|
local unit=carrier.unit
|
||||||
if unit and unit:IsAlive()~=nil then
|
if unit and unit:IsExist() then
|
||||||
vec3=unit:GetVec3()
|
vec3=unit:GetVec3()
|
||||||
return vec3
|
return vec3
|
||||||
end
|
end
|
||||||
@@ -12813,7 +12813,7 @@ function OPSGROUP:GetAmmoTot()
|
|||||||
for _,_unit in pairs(units or {}) do
|
for _,_unit in pairs(units or {}) do
|
||||||
local unit=_unit --Wrapper.Unit#UNIT
|
local unit=_unit --Wrapper.Unit#UNIT
|
||||||
|
|
||||||
if unit and unit:IsAlive()~=nil then
|
if unit and unit:IsExist() then
|
||||||
|
|
||||||
-- Get ammo of the unit.
|
-- Get ammo of the unit.
|
||||||
local ammo=self:GetAmmoUnit(unit)
|
local ammo=self:GetAmmoUnit(unit)
|
||||||
@@ -12849,8 +12849,6 @@ function OPSGROUP:GetAmmoUnit(unit, display)
|
|||||||
if display==nil then
|
if display==nil then
|
||||||
display=false
|
display=false
|
||||||
end
|
end
|
||||||
|
|
||||||
unit=unit or self.group:GetUnit(1)
|
|
||||||
|
|
||||||
-- Init counter.
|
-- Init counter.
|
||||||
local nammo=0
|
local nammo=0
|
||||||
@@ -12866,117 +12864,123 @@ function OPSGROUP:GetAmmoUnit(unit, display)
|
|||||||
local ntorps=0
|
local ntorps=0
|
||||||
local nbombs=0
|
local nbombs=0
|
||||||
|
|
||||||
-- Output.
|
unit=unit or self.group:GetUnit(1)
|
||||||
local text=string.format("OPSGROUP group %s - unit %s:\n", self.groupname, unit:GetName())
|
|
||||||
|
|
||||||
-- Get ammo table.
|
if unit and unit:IsExist() then
|
||||||
local ammotable=unit:GetAmmo()
|
|
||||||
|
|
||||||
if ammotable then
|
-- Output.
|
||||||
|
local text=string.format("OPSGROUP group %s - unit %s:\n", self.groupname, unit:GetName())
|
||||||
|
|
||||||
local weapons=#ammotable
|
-- Get ammo table.
|
||||||
|
local ammotable=unit:GetAmmo()
|
||||||
--self:I(ammotable)
|
|
||||||
|
|
||||||
-- Loop over all weapons.
|
if ammotable then
|
||||||
for w=1,weapons do
|
|
||||||
|
|
||||||
-- Number of current weapon.
|
local weapons=#ammotable
|
||||||
local Nammo=ammotable[w]["count"]
|
|
||||||
|
|
||||||
-- Range in meters. Seems only to exist for missiles (not shells).
|
--self:I(ammotable)
|
||||||
local rmin=ammotable[w]["desc"]["rangeMin"] or 0
|
|
||||||
local rmax=ammotable[w]["desc"]["rangeMaxAltMin"] or 0
|
|
||||||
|
|
||||||
-- Type name of current weapon.
|
-- Loop over all weapons.
|
||||||
local Tammo=ammotable[w]["desc"]["typeName"]
|
for w=1,weapons do
|
||||||
|
|
||||||
local _weaponString = UTILS.Split(Tammo,"%.")
|
-- Number of current weapon.
|
||||||
local _weaponName = _weaponString[#_weaponString]
|
local Nammo=ammotable[w]["count"]
|
||||||
|
|
||||||
|
-- Range in meters. Seems only to exist for missiles (not shells).
|
||||||
|
local rmin=ammotable[w]["desc"]["rangeMin"] or 0
|
||||||
|
local rmax=ammotable[w]["desc"]["rangeMaxAltMin"] or 0
|
||||||
|
|
||||||
-- Get the weapon category: shell=0, missile=1, rocket=2, bomb=3, torpedo=4
|
-- Type name of current weapon.
|
||||||
local Category=ammotable[w].desc.category
|
local Tammo=ammotable[w]["desc"]["typeName"]
|
||||||
|
|
||||||
-- Get missile category: Weapon.MissileCategory AAM=1, SAM=2, BM=3, ANTI_SHIP=4, CRUISE=5, OTHER=6
|
local _weaponString = UTILS.Split(Tammo,"%.")
|
||||||
local MissileCategory=nil
|
local _weaponName = _weaponString[#_weaponString]
|
||||||
if Category==Weapon.Category.MISSILE then
|
|
||||||
MissileCategory=ammotable[w].desc.missileCategory
|
|
||||||
end
|
|
||||||
|
|
||||||
-- We are specifically looking for shells or rockets here.
|
-- Get the weapon category: shell=0, missile=1, rocket=2, bomb=3, torpedo=4
|
||||||
if Category==Weapon.Category.SHELL then
|
local Category=ammotable[w].desc.category
|
||||||
|
|
||||||
-- Add up all shells.
|
-- Get missile category: Weapon.MissileCategory AAM=1, SAM=2, BM=3, ANTI_SHIP=4, CRUISE=5, OTHER=6
|
||||||
nshells=nshells+Nammo
|
local MissileCategory=nil
|
||||||
|
if Category==Weapon.Category.MISSILE then
|
||||||
-- Debug info.
|
MissileCategory=ammotable[w].desc.missileCategory
|
||||||
text=text..string.format("- %d shells of type %s, range=%d - %d meters\n", Nammo, _weaponName, rmin, rmax)
|
|
||||||
|
|
||||||
elseif Category==Weapon.Category.ROCKET then
|
|
||||||
|
|
||||||
-- Add up all rockets.
|
|
||||||
nrockets=nrockets+Nammo
|
|
||||||
|
|
||||||
-- Debug info.
|
|
||||||
text=text..string.format("- %d rockets of type %s, \n", Nammo, _weaponName, rmin, rmax)
|
|
||||||
|
|
||||||
elseif Category==Weapon.Category.BOMB then
|
|
||||||
|
|
||||||
-- Add up all rockets.
|
|
||||||
nbombs=nbombs+Nammo
|
|
||||||
|
|
||||||
-- Debug info.
|
|
||||||
text=text..string.format("- %d bombs of type %s\n", Nammo, _weaponName)
|
|
||||||
|
|
||||||
elseif Category==Weapon.Category.MISSILE then
|
|
||||||
|
|
||||||
-- Add up all cruise missiles (category 5)
|
|
||||||
if MissileCategory==Weapon.MissileCategory.AAM then
|
|
||||||
nmissiles=nmissiles+Nammo
|
|
||||||
nmissilesAA=nmissilesAA+Nammo
|
|
||||||
elseif MissileCategory==Weapon.MissileCategory.SAM then
|
|
||||||
nmissiles=nmissiles+Nammo
|
|
||||||
nmissilesSA=nmissilesSA+Nammo
|
|
||||||
elseif MissileCategory==Weapon.MissileCategory.ANTI_SHIP then
|
|
||||||
nmissiles=nmissiles+Nammo
|
|
||||||
nmissilesAS=nmissilesAS+Nammo
|
|
||||||
elseif MissileCategory==Weapon.MissileCategory.BM then
|
|
||||||
nmissiles=nmissiles+Nammo
|
|
||||||
nmissilesBM=nmissilesBM+Nammo
|
|
||||||
elseif MissileCategory==Weapon.MissileCategory.CRUISE then
|
|
||||||
nmissiles=nmissiles+Nammo
|
|
||||||
nmissilesCR=nmissilesCR+Nammo
|
|
||||||
elseif MissileCategory==Weapon.MissileCategory.OTHER then
|
|
||||||
nmissiles=nmissiles+Nammo
|
|
||||||
nmissilesAG=nmissilesAG+Nammo
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Debug info.
|
-- We are specifically looking for shells or rockets here.
|
||||||
text=text..string.format("- %d %s missiles of type %s, range=%d - %d meters\n", Nammo, self:_MissileCategoryName(MissileCategory), _weaponName, rmin, rmax)
|
if Category==Weapon.Category.SHELL then
|
||||||
|
|
||||||
elseif Category==Weapon.Category.TORPEDO then
|
-- Add up all shells.
|
||||||
|
nshells=nshells+Nammo
|
||||||
|
|
||||||
-- Add up all rockets.
|
-- Debug info.
|
||||||
ntorps=ntorps+Nammo
|
text=text..string.format("- %d shells of type %s, range=%d - %d meters\n", Nammo, _weaponName, rmin, rmax)
|
||||||
|
|
||||||
-- Debug info.
|
elseif Category==Weapon.Category.ROCKET then
|
||||||
text=text..string.format("- %d torpedos of type %s\n", Nammo, _weaponName)
|
|
||||||
|
|
||||||
else
|
-- Add up all rockets.
|
||||||
|
nrockets=nrockets+Nammo
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
text=text..string.format("- %d unknown ammo of type %s (category=%d, missile category=%s)\n", Nammo, Tammo, Category, tostring(MissileCategory))
|
text=text..string.format("- %d rockets of type %s, \n", Nammo, _weaponName, rmin, rmax)
|
||||||
|
|
||||||
|
elseif Category==Weapon.Category.BOMB then
|
||||||
|
|
||||||
|
-- Add up all rockets.
|
||||||
|
nbombs=nbombs+Nammo
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
|
text=text..string.format("- %d bombs of type %s\n", Nammo, _weaponName)
|
||||||
|
|
||||||
|
elseif Category==Weapon.Category.MISSILE then
|
||||||
|
|
||||||
|
-- Add up all cruise missiles (category 5)
|
||||||
|
if MissileCategory==Weapon.MissileCategory.AAM then
|
||||||
|
nmissiles=nmissiles+Nammo
|
||||||
|
nmissilesAA=nmissilesAA+Nammo
|
||||||
|
elseif MissileCategory==Weapon.MissileCategory.SAM then
|
||||||
|
nmissiles=nmissiles+Nammo
|
||||||
|
nmissilesSA=nmissilesSA+Nammo
|
||||||
|
elseif MissileCategory==Weapon.MissileCategory.ANTI_SHIP then
|
||||||
|
nmissiles=nmissiles+Nammo
|
||||||
|
nmissilesAS=nmissilesAS+Nammo
|
||||||
|
elseif MissileCategory==Weapon.MissileCategory.BM then
|
||||||
|
nmissiles=nmissiles+Nammo
|
||||||
|
nmissilesBM=nmissilesBM+Nammo
|
||||||
|
elseif MissileCategory==Weapon.MissileCategory.CRUISE then
|
||||||
|
nmissiles=nmissiles+Nammo
|
||||||
|
nmissilesCR=nmissilesCR+Nammo
|
||||||
|
elseif MissileCategory==Weapon.MissileCategory.OTHER then
|
||||||
|
nmissiles=nmissiles+Nammo
|
||||||
|
nmissilesAG=nmissilesAG+Nammo
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
|
text=text..string.format("- %d %s missiles of type %s, range=%d - %d meters\n", Nammo, self:_MissileCategoryName(MissileCategory), _weaponName, rmin, rmax)
|
||||||
|
|
||||||
|
elseif Category==Weapon.Category.TORPEDO then
|
||||||
|
|
||||||
|
-- Add up all rockets.
|
||||||
|
ntorps=ntorps+Nammo
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
|
text=text..string.format("- %d torpedos of type %s\n", Nammo, _weaponName)
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
|
text=text..string.format("- %d unknown ammo of type %s (category=%d, missile category=%s)\n", Nammo, Tammo, Category, tostring(MissileCategory))
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
-- Debug text and send message.
|
-- Debug text and send message.
|
||||||
if display then
|
if display then
|
||||||
self:I(self.lid..text)
|
self:I(self.lid..text)
|
||||||
else
|
else
|
||||||
self:T3(self.lid..text)
|
self:T3(self.lid..text)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Total amount of ammunition.
|
-- Total amount of ammunition.
|
||||||
|
|||||||
@@ -646,7 +646,7 @@ AIRBASE.SouthAtlantic={
|
|||||||
-- * AIRBASE.Sinai.Tel_Nof
|
-- * AIRBASE.Sinai.Tel_Nof
|
||||||
-- * AIRBASE.Sinai.Abu_Rudeis
|
-- * AIRBASE.Sinai.Abu_Rudeis
|
||||||
-- * AIRBASE.Sinai.Inshas_Airbase
|
-- * AIRBASE.Sinai.Inshas_Airbase
|
||||||
-- * AIRBASE.Sinai.Ben-Gurion
|
-- * AIRBASE.Sinai.Ben_Gurion
|
||||||
-- * AIRBASE.Sinai.Bir_Hasanah
|
-- * AIRBASE.Sinai.Bir_Hasanah
|
||||||
-- * AIRBASE.Sinai.Cairo_West
|
-- * AIRBASE.Sinai.Cairo_West
|
||||||
--
|
--
|
||||||
|
|||||||
Reference in New Issue
Block a user