mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-11 03:43:38 +00:00
Merge branch 'develop' into FF/Fox2
This commit is contained in:
@@ -1117,7 +1117,7 @@ do -- COORDINATE
|
||||
-- Airbase parameters for takeoff and landing points.
|
||||
if airbase then
|
||||
local AirbaseID = airbase:GetID()
|
||||
local AirbaseCategory = airbase:GetDesc().category
|
||||
local AirbaseCategory = airbase:GetAirbaseCategory()
|
||||
if AirbaseCategory == Airbase.Category.SHIP or AirbaseCategory == Airbase.Category.HELIPAD then
|
||||
RoutePoint.linkUnit = AirbaseID
|
||||
RoutePoint.helipadId = AirbaseID
|
||||
|
||||
@@ -1983,7 +1983,7 @@ function SPAWN:ParkAircraft( SpawnAirbase, TerminalType, Parkingdata, SpawnIndex
|
||||
|
||||
-- Get airbase ID and category.
|
||||
local AirbaseID = SpawnAirbase:GetID()
|
||||
local AirbaseCategory = SpawnAirbase:GetDesc().category
|
||||
local AirbaseCategory = SpawnAirbase:GetAirbaseCategory()
|
||||
self:F( { AirbaseCategory = AirbaseCategory } )
|
||||
|
||||
-- Set airdromeId.
|
||||
|
||||
@@ -3416,7 +3416,7 @@ function RAT:_GetAirportsOfCoalition()
|
||||
for _,coalition in pairs(self.ctable) do
|
||||
for _,_airport in pairs(self.airports_map) do
|
||||
local airport=_airport --Wrapper.Airbase#AIRBASE
|
||||
local category=airport:GetDesc().category
|
||||
local category=airport:GetAirbaseCategory()
|
||||
if airport:GetCoalition()==coalition then
|
||||
-- Planes cannot land on FARPs.
|
||||
--local condition1=self.category==RAT.cat.plane and airport:GetTypeName()=="FARP"
|
||||
@@ -3847,7 +3847,7 @@ function RAT:_OnBirth(EventData)
|
||||
|
||||
-- Check if any unit of the group was spawned on top of another unit in the MOOSE data base.
|
||||
local ontop=false
|
||||
if self.checkontop and (_airbase and _airbase:GetDesc().category==Airbase.Category.AIRDROME) then
|
||||
if self.checkontop and (_airbase and _airbase:GetAirbaseCategory()==Airbase.Category.AIRDROME) then
|
||||
ontop=self:_CheckOnTop(SpawnGroup, self.ontopradius)
|
||||
end
|
||||
|
||||
@@ -4457,7 +4457,7 @@ function RAT:_Waypoint(index, description, Type, Coord, Speed, Altitude, Airport
|
||||
|
||||
if (Airport~=nil) and (Type~=RAT.wp.air) then
|
||||
local AirbaseID = Airport:GetID()
|
||||
local AirbaseCategory = Airport:GetDesc().category
|
||||
local AirbaseCategory = Airport:GetAirbaseCategory()
|
||||
if AirbaseCategory == Airbase.Category.SHIP then
|
||||
RoutePoint.linkUnit = AirbaseID
|
||||
RoutePoint.helipadId = AirbaseID
|
||||
@@ -5141,7 +5141,7 @@ function RAT:_ModifySpawnTemplate(waypoints, livery, spawnplace, departure, take
|
||||
local spawnonrunway=false
|
||||
local spawnonairport=false
|
||||
if spawnonground then
|
||||
local AirbaseCategory = departure:GetDesc().category
|
||||
local AirbaseCategory = departure:GetAirbaseCategory()
|
||||
if AirbaseCategory == Airbase.Category.SHIP then
|
||||
spawnonship=true
|
||||
elseif AirbaseCategory == Airbase.Category.HELIPAD then
|
||||
|
||||
@@ -3045,7 +3045,7 @@ end
|
||||
function WAREHOUSE:GetAirbaseCategory()
|
||||
local category=-1
|
||||
if self.airbase then
|
||||
category=self.airbase:GetDesc().category
|
||||
category=self.airbase:GetAirbaseCategory()
|
||||
end
|
||||
return category
|
||||
end
|
||||
|
||||
@@ -471,15 +471,31 @@ end
|
||||
|
||||
-- acc- the accuracy of each easting/northing. 0, 1, 2, 3, 4, or 5.
|
||||
UTILS.tostringMGRS = function(MGRS, acc) --R2.1
|
||||
|
||||
if acc == 0 then
|
||||
return MGRS.UTMZone .. ' ' .. MGRS.MGRSDigraph
|
||||
else
|
||||
--return MGRS.UTMZone .. ' ' .. MGRS.MGRSDigraph .. ' ' .. string.format('%0' .. acc .. 'd', UTILS.Round(MGRS.Easting/(10^(5-acc)), 0))
|
||||
-- .. ' ' .. string.format('%0' .. acc .. 'd', UTILS.Round(MGRS.Northing/(10^(5-acc)), 0))
|
||||
|
||||
-- Test if Easting/Northing have less than 4 digits.
|
||||
--MGRS.Easting=123 -- should be 00123
|
||||
--MGRS.Northing=5432 -- should be 05432
|
||||
|
||||
-- Truncate rather than round MGRS grid!
|
||||
return string.format("%s %s %s %s", MGRS.UTMZone, MGRS.MGRSDigraph, string.sub(tostring(MGRS.Easting), 1, acc), string.sub(tostring(MGRS.Northing), 1, acc))
|
||||
-- Truncate rather than round MGRS grid!
|
||||
local Easting=tostring(MGRS.Easting)
|
||||
local Northing=tostring(MGRS.Northing)
|
||||
|
||||
-- Count number of missing digits. Easting/Northing should have 5 digits. However, it is passed as a number. Therefore, any leading zeros would not be displayed by lua.
|
||||
local nE=5-string.len(Easting)
|
||||
local nN=5-string.len(Northing)
|
||||
|
||||
-- Get leading zeros (if any).
|
||||
for i=1,nE do Easting="0"..Easting end
|
||||
for i=1,nN do Northing="0"..Northing end
|
||||
|
||||
-- Return MGRS string.
|
||||
return string.format("%s %s %s %s", MGRS.UTMZone, MGRS.MGRSDigraph, string.sub(Easting, 1, acc), string.sub(Northing, 1, acc))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -1003,7 +1003,7 @@ function AIRBASE:CheckOnRunWay(group, radius, despawn)
|
||||
radius=radius or 50
|
||||
|
||||
-- We only check at real airbases (not FARPS or ships).
|
||||
if self:GetDesc().category~=Airbase.Category.AIRDROME then
|
||||
if self:GetAirbaseCategory()~=Airbase.Category.AIRDROME then
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
@@ -1922,7 +1922,7 @@ function GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled) --
|
||||
|
||||
-- Aibase id and category.
|
||||
local AirbaseID = airbase:GetID()
|
||||
local AirbaseCategory = airbase:GetDesc().category
|
||||
local AirbaseCategory = airbase:GetAirbaseCategory()
|
||||
|
||||
if AirbaseCategory == Airbase.Category.SHIP or AirbaseCategory == Airbase.Category.HELIPAD then
|
||||
SpawnPoint.linkUnit = AirbaseID
|
||||
|
||||
Reference in New Issue
Block a user