Compare commits
11
Commits
cb05bd0925
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3adf2faa4a | ||
|
|
47e947c80e | ||
|
|
c42a61c2df | ||
|
|
ca85b0116f | ||
|
|
7f3a1d00a7 | ||
|
|
06fb098b49 | ||
|
|
49eac0a7ed | ||
|
|
fb5ea45a4d | ||
|
|
7ec3006a7e | ||
|
|
9d55f7e017 | ||
|
|
20ef08e16c |
Binary file not shown.
@@ -15,7 +15,7 @@ AARTanker = {
|
|||||||
TACAN_Mode = 'X',
|
TACAN_Mode = 'X',
|
||||||
|
|
||||||
Alt = 10000/3.28,
|
Alt = 10000/3.28,
|
||||||
Speed = 250/1.944,
|
Speed = 270/1.944,
|
||||||
},
|
},
|
||||||
|
|
||||||
['KC135_High'] = {
|
['KC135_High'] = {
|
||||||
@@ -30,7 +30,7 @@ AARTanker = {
|
|||||||
TACAN_Mode = 'X',
|
TACAN_Mode = 'X',
|
||||||
|
|
||||||
Alt = 16000/3.28,
|
Alt = 16000/3.28,
|
||||||
Speed = 340/1.944,
|
Speed = 270/1.944,
|
||||||
},
|
},
|
||||||
|
|
||||||
['KC135MPRS'] = {
|
['KC135MPRS'] = {
|
||||||
@@ -45,7 +45,7 @@ AARTanker = {
|
|||||||
TACAN_Mode = 'X',
|
TACAN_Mode = 'X',
|
||||||
|
|
||||||
Alt = 14000/3.28,
|
Alt = 14000/3.28,
|
||||||
Speed = 340/1.944,
|
Speed = 270/1.944,
|
||||||
},
|
},
|
||||||
|
|
||||||
['KC130'] = {
|
['KC130'] = {
|
||||||
@@ -60,7 +60,7 @@ AARTanker = {
|
|||||||
TACAN_Mode = 'X',
|
TACAN_Mode = 'X',
|
||||||
|
|
||||||
Alt = 11000/3.28,
|
Alt = 11000/3.28,
|
||||||
Speed = 350/1.944,
|
Speed = 270/1.944,
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-13
@@ -149,21 +149,22 @@ do
|
|||||||
-- setmetatable(obj,self)
|
-- setmetatable(obj,self)
|
||||||
-- self.__index = self
|
-- self.__index = self
|
||||||
|
|
||||||
-- timer.scheduleFunction(function (vars)
|
timer.scheduleFunction(function (vars, time)
|
||||||
-- local carrier = vars.context
|
|
||||||
-- carrier:InitBeacons()
|
|
||||||
-- end,{context = obj},timer.getTime()+5)
|
|
||||||
|
|
||||||
timer.scheduleFunction(function (vars)
|
|
||||||
local carrier = vars.context
|
local carrier = vars.context
|
||||||
carrier:setTACAN()
|
carrier:InitBeacons()
|
||||||
|
|
||||||
|
return time+20
|
||||||
end,{context = obj},timer.getTime()+5)
|
end,{context = obj},timer.getTime()+5)
|
||||||
|
|
||||||
obj:setMorse()
|
-- timer.scheduleFunction(function (vars)
|
||||||
obj:setICLS()
|
-- local carrier = vars.context
|
||||||
obj:setLink4()
|
-- carrier:setTACAN()
|
||||||
obj:setACLS(true)
|
-- carrier:setICLS()
|
||||||
obj:setATC()
|
-- end,{context = obj},timer.getTime()+20)
|
||||||
|
|
||||||
|
-- obj:setMorse()
|
||||||
|
-- obj:setLink4()
|
||||||
|
-- obj:setATC()
|
||||||
-- obj:setTACAN()
|
-- obj:setTACAN()
|
||||||
|
|
||||||
env.info('BAirboss - New Carrier: '..carrierUnitName)
|
env.info('BAirboss - New Carrier: '..carrierUnitName)
|
||||||
@@ -233,7 +234,7 @@ do
|
|||||||
|
|
||||||
--Calculate wind speed on runway in knots. If wind speed < 25 knots, try to make it 25 knots on deck.
|
--Calculate wind speed on runway in knots. If wind speed < 25 knots, try to make it 25 knots on deck.
|
||||||
if windSpeed <= 20/1.944 then
|
if windSpeed <= 20/1.944 then
|
||||||
carrierSpeed = 25/1.944-windSpeed
|
carrierSpeed = 20/1.944-windSpeed
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Find available waypoint and path.
|
-- Find available waypoint and path.
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ Localizations = {
|
|||||||
['There is no range section of %s left.'] = 'There is no range section of %s left.',
|
['There is no range section of %s left.'] = 'There is no range section of %s left.',
|
||||||
['Spawn target at %s section area. targetType: %s state: %s'] = 'Spawn target at %s section area. targetType: %s state: %s',
|
['Spawn target at %s section area. targetType: %s state: %s'] = 'Spawn target at %s section area. targetType: %s state: %s',
|
||||||
['Spawn target at %s section area. targetType: %s AAType: %s state: %s'] = 'Spawn target at %s section area. targetType: %s AAType: %s state: %s',
|
['Spawn target at %s section area. targetType: %s AAType: %s state: %s'] = 'Spawn target at %s section area. targetType: %s AAType: %s state: %s',
|
||||||
|
['Your targets are spawned at: '] = 'Your targets are spawned at: ',
|
||||||
|
['and moving to: '] = 'and moving to: ',
|
||||||
['Stationary'] = 'Stationary',
|
['Stationary'] = 'Stationary',
|
||||||
['Moving'] = 'Moving',
|
['Moving'] = 'Moving',
|
||||||
},
|
},
|
||||||
@@ -99,6 +101,8 @@ Localizations = {
|
|||||||
['There is no range section of %s left.'] = '没有 %s 类型靶场空闲了.',
|
['There is no range section of %s left.'] = '没有 %s 类型靶场空闲了.',
|
||||||
['Spawn target at %s section area. targetType: %s state: %s'] = '在 %s 区域刷新目标. 目标类型: %s 状态: %s',
|
['Spawn target at %s section area. targetType: %s state: %s'] = '在 %s 区域刷新目标. 目标类型: %s 状态: %s',
|
||||||
['Spawn target at %s section area. targetType: %s AAType: %s state: %s'] = '在 %s 区域 刷新目标. 目标类型: %s 防空类型: %s 状态: %s',
|
['Spawn target at %s section area. targetType: %s AAType: %s state: %s'] = '在 %s 区域 刷新目标. 目标类型: %s 防空类型: %s 状态: %s',
|
||||||
|
['Your targets are spawned at: '] = '你的目标刷新在: ',
|
||||||
|
['and moving to: '] = '并且将要移动到: ',
|
||||||
['Stationary'] = '静止目标',
|
['Stationary'] = '静止目标',
|
||||||
['Moving'] = '运动目标',
|
['Moving'] = '运动目标',
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-8
@@ -124,6 +124,9 @@ do
|
|||||||
self.removePlayerProfile(playerName)
|
self.removePlayerProfile(playerName)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if not playerUnit then
|
||||||
|
self.removePlayerProfile(playerName)
|
||||||
|
end
|
||||||
|
|
||||||
if data.activeTarget then
|
if data.activeTarget then
|
||||||
if data.activeTarget:isExist() then
|
if data.activeTarget:isExist() then
|
||||||
@@ -350,8 +353,11 @@ do
|
|||||||
|
|
||||||
self.playerList[playerName] = nil
|
self.playerList[playerName] = nil
|
||||||
|
|
||||||
local leaveText = Localizations:translate('You have left rang area.','cn')
|
-- local leaveText = Localizations:translate('You have left rang area.','cn')
|
||||||
trigger.action.outTextForGroup(self.playerList[playerName].groupID,leaveText,10)
|
|
||||||
|
-- if self.playerList[playerName].group:isExist() then
|
||||||
|
-- trigger.action.outTextForGroup(self.playerList[playerName].groupID,leaveText,10)
|
||||||
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Range:activeTartgets(playerName,sectionType,targetType,AAType,Move)
|
function Range:activeTartgets(playerName,sectionType,targetType,AAType,Move)
|
||||||
@@ -466,9 +472,11 @@ do
|
|||||||
for k=2,#groupData.units,1 do
|
for k=2,#groupData.units,1 do
|
||||||
local tDir = math.random(0,359)
|
local tDir = math.random(0,359)
|
||||||
local spawnPoint = {}
|
local spawnPoint = {}
|
||||||
|
spawnPoint.x = centerPoint.x+200
|
||||||
|
spawnPoint.y = centerPoint.z or centerPoint.y
|
||||||
|
|
||||||
for i=1,100,1 do
|
for i=1,100,1 do
|
||||||
local tPoint = Utils.vecTranslate(centerPoint,tDir,math.random(100,2000)) --Spawn range
|
local tPoint = Utils.vecTranslate(centerPoint,tDir,math.random(100,1000)) --Spawn range
|
||||||
if Utils.pointInPolygon(tPoint,sectionZone.points) then
|
if Utils.pointInPolygon(tPoint,sectionZone.points) then
|
||||||
if land.getSurfaceType(tPoint) ~= land.SurfaceType.WATER or land.getSurfaceType(tPoint) ~= land.SurfaceType.SHALLOW_WATER then
|
if land.getSurfaceType(tPoint) ~= land.SurfaceType.WATER or land.getSurfaceType(tPoint) ~= land.SurfaceType.SHALLOW_WATER then
|
||||||
spawnPoint = tPoint
|
spawnPoint = tPoint
|
||||||
@@ -477,11 +485,6 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not spawnPoint then
|
|
||||||
spawnPoint.x = centerPoint.x+50
|
|
||||||
spawnPoint.y = centerPoint.z+50 or centerPoint.y+50
|
|
||||||
end
|
|
||||||
|
|
||||||
groupData.units[k].x = spawnPoint.x
|
groupData.units[k].x = spawnPoint.x
|
||||||
groupData.units[k].y = spawnPoint.z or spawnPoint.y
|
groupData.units[k].y = spawnPoint.z or spawnPoint.y
|
||||||
end
|
end
|
||||||
@@ -495,6 +498,7 @@ do
|
|||||||
local Controller = targetGroup:getController()
|
local Controller = targetGroup:getController()
|
||||||
if not Controller then return end
|
if not Controller then return end
|
||||||
|
|
||||||
|
local targetPointReport = Localizations:translate('Your targets are spawned at: ','cn')
|
||||||
--Set Moving
|
--Set Moving
|
||||||
if Move then
|
if Move then
|
||||||
local startPoint = {}
|
local startPoint = {}
|
||||||
@@ -547,11 +551,35 @@ do
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local lat, lon, alt = coord.LOtoLL({x=startPoint.x,y=land.getHeight(startPoint),z=startPoint.y})
|
||||||
|
local grid = coord.LLtoMGRS(lat,lon)
|
||||||
|
local LLText = Utils.tostringLL(lat,lon,3)
|
||||||
|
local MGRSText = grid.UTMZone .. ' ' .. grid.MGRSDigraph .. ' ' .. grid.Easting .. ' ' .. grid.Northing
|
||||||
|
targetPointReport = targetPointReport.. '\nLLDM: '..LLText..' \nMGRS: '..MGRSText
|
||||||
|
|
||||||
|
targetPointReport = targetPointReport ..'\n'.. Localizations:translate('and moving to: ','cn')
|
||||||
|
|
||||||
|
lat, lon, alt = coord.LOtoLL({x=finPoint.x,y=land.getHeight(finPoint),z=finPoint.y})
|
||||||
|
grid = coord.LLtoMGRS(lat,lon)
|
||||||
|
LLText = Utils.tostringLL(lat,lon,3,true)
|
||||||
|
MGRSText = grid.UTMZone .. ' ' .. grid.MGRSDigraph .. ' ' .. grid.Easting .. ' ' .. grid.Northing
|
||||||
|
targetPointReport = targetPointReport.. '\nLLDM: '..LLText..' \nMGRS: '..MGRSText
|
||||||
|
|
||||||
timer.scheduleFunction(function (Mission)
|
timer.scheduleFunction(function (Mission)
|
||||||
Controller:setTask(Mission)
|
Controller:setTask(Mission)
|
||||||
end,Mission,timer.getTime()+5)
|
end,Mission,timer.getTime()+5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not Move then
|
||||||
|
local lat, lon, alt = coord.LOtoLL({x=centerPoint.x,y=land.getHeight(centerPoint),z=centerPoint.y})
|
||||||
|
local grid = coord.LLtoMGRS(lat,lon)
|
||||||
|
local LLText = Utils.tostringLL(lat,lon,3)
|
||||||
|
local MGRSText = grid.UTMZone .. ' ' .. grid.MGRSDigraph .. ' ' .. grid.Easting .. ' ' .. grid.Northing
|
||||||
|
targetPointReport = targetPointReport.. '\nLLDM: '..LLText..' \nMGRS: '..MGRSText
|
||||||
|
end
|
||||||
|
|
||||||
|
trigger.action.outTextForGroup(self.playerList[playerName].groupID,targetPointReport,60)
|
||||||
|
|
||||||
--Set fight back
|
--Set fight back
|
||||||
if self.playerList[playerName].isTargerRedAlert then
|
if self.playerList[playerName].isTargerRedAlert then
|
||||||
timer.scheduleFunction(function (targetGroup)
|
timer.scheduleFunction(function (targetGroup)
|
||||||
|
|||||||
@@ -275,7 +275,104 @@ do
|
|||||||
return newCoord
|
return newCoord
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Simple rounding function.
|
||||||
|
-- From http://lua-users.org/wiki/SimpleRound
|
||||||
|
-- use negative idp for rounding ahead of decimal place, positive for rounding after decimal place
|
||||||
|
-- @tparam number num number to round
|
||||||
|
-- @param idp
|
||||||
|
function Utils.round(num, idp)
|
||||||
|
local mult = 10^(idp or 0)
|
||||||
|
return math.floor(num * mult + 0.5) / mult
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[acc:
|
||||||
|
in DM: decimal point of minutes.
|
||||||
|
In DMS: decimal point of seconds.
|
||||||
|
position after the decimal of the least significant digit:
|
||||||
|
So:
|
||||||
|
42.32 - acc of 2.
|
||||||
|
]]
|
||||||
|
function Utils.tostringLL(lat, lon, acc, DMS)
|
||||||
|
|
||||||
|
local latHemi, lonHemi
|
||||||
|
if lat > 0 then
|
||||||
|
latHemi = 'N'
|
||||||
|
else
|
||||||
|
latHemi = 'S'
|
||||||
|
end
|
||||||
|
|
||||||
|
if lon > 0 then
|
||||||
|
lonHemi = 'E'
|
||||||
|
else
|
||||||
|
lonHemi = 'W'
|
||||||
|
end
|
||||||
|
|
||||||
|
lat = math.abs(lat)
|
||||||
|
lon = math.abs(lon)
|
||||||
|
|
||||||
|
local latDeg = math.floor(lat)
|
||||||
|
local latMin = (lat - latDeg)*60
|
||||||
|
|
||||||
|
local lonDeg = math.floor(lon)
|
||||||
|
local lonMin = (lon - lonDeg)*60
|
||||||
|
|
||||||
|
if DMS then -- degrees, minutes, and seconds.
|
||||||
|
local oldLatMin = latMin
|
||||||
|
latMin = math.floor(latMin)
|
||||||
|
local latSec = Utils.round((oldLatMin - latMin)*60, acc)
|
||||||
|
|
||||||
|
local oldLonMin = lonMin
|
||||||
|
lonMin = math.floor(lonMin)
|
||||||
|
local lonSec = Utils.round((oldLonMin - lonMin)*60, acc)
|
||||||
|
|
||||||
|
if latSec == 60 then
|
||||||
|
latSec = 0
|
||||||
|
latMin = latMin + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if lonSec == 60 then
|
||||||
|
lonSec = 0
|
||||||
|
lonMin = lonMin + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local secFrmtStr -- create the formatting string for the seconds place
|
||||||
|
if acc <= 0 then -- no decimal place.
|
||||||
|
secFrmtStr = '%02d'
|
||||||
|
else
|
||||||
|
local width = 3 + acc -- 01.310 - that's a width of 6, for example.
|
||||||
|
secFrmtStr = '%0' .. width .. '.' .. acc .. 'f'
|
||||||
|
end
|
||||||
|
|
||||||
|
return string.format('%02d', latDeg) .. ' ' .. string.format('%02d', latMin) .. '\' ' .. string.format(secFrmtStr, latSec) .. '"' .. latHemi .. ' '
|
||||||
|
.. string.format('%02d', lonDeg) .. ' ' .. string.format('%02d', lonMin) .. '\' ' .. string.format(secFrmtStr, lonSec) .. '"' .. lonHemi
|
||||||
|
|
||||||
|
else -- degrees, decimal minutes.
|
||||||
|
latMin = Utils.round(latMin, acc)
|
||||||
|
lonMin = Utils.round(lonMin, acc)
|
||||||
|
|
||||||
|
if latMin == 60 then
|
||||||
|
latMin = 0
|
||||||
|
latDeg = latDeg + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if lonMin == 60 then
|
||||||
|
lonMin = 0
|
||||||
|
lonDeg = lonDeg + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local minFrmtStr -- create the formatting string for the minutes place
|
||||||
|
if acc <= 0 then -- no decimal place.
|
||||||
|
minFrmtStr = '%02d'
|
||||||
|
else
|
||||||
|
local width = 3 + acc -- 01.310 - that's a width of 6, for example.
|
||||||
|
minFrmtStr = '%0' .. width .. '.' .. acc .. 'f'
|
||||||
|
end
|
||||||
|
|
||||||
|
return string.format('%02d', latDeg) .. ' ' .. string.format(minFrmtStr, latMin) .. '\'' .. latHemi .. ' '
|
||||||
|
.. string.format('%02d', lonDeg) .. ' ' .. string.format(minFrmtStr, lonMin) .. '\'' .. lonHemi
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Converts a TACAN Channel/Mode couple into a frequency in Hz.
|
--- Converts a TACAN Channel/Mode couple into a frequency in Hz.
|
||||||
-- @param #number TACANChannel The TACAN channel, i.e. the 10 in "10X".
|
-- @param #number TACANChannel The TACAN channel, i.e. the 10 in "10X".
|
||||||
|
|||||||
Reference in New Issue
Block a user