- Add function 'setATC' for 'BAirboss.lua'.
- Move BAirboss:getWindBearingandVel to Utils.getWindBearingandVel. - Add some "Draw" message on MIZ file. - TODO "AARTanker.lua" for manage all AARTankers.
This commit is contained in:
+35
-21
@@ -3,6 +3,8 @@ BAirboss = {
|
||||
|
||||
Morse = nil,
|
||||
|
||||
ATC = nil,
|
||||
|
||||
TACAN = nil,
|
||||
TACAN_Mode = nil,
|
||||
TACAN_ON = false,
|
||||
@@ -56,6 +58,8 @@ do
|
||||
[BAirboss.CarrierType.FORRESTAL] = {
|
||||
Morse = 'FRS',
|
||||
|
||||
ATC = 269000000,
|
||||
|
||||
MarshalRadio = nil,
|
||||
LSORadio = nil,
|
||||
|
||||
@@ -75,6 +79,8 @@ do
|
||||
[BAirboss.CarrierType.ROOSEVELT] = {
|
||||
Morse = 'RSV',
|
||||
|
||||
ATC = 261000000,
|
||||
|
||||
MarshalRadio = nil,
|
||||
LSORadio = nil,
|
||||
|
||||
@@ -94,6 +100,8 @@ do
|
||||
[BAirboss.CarrierType.STENNIS] = {
|
||||
Morse = 'STN',
|
||||
|
||||
ATC = 264000000,
|
||||
|
||||
MarshalRadio = nil,
|
||||
LSORadio = nil,
|
||||
|
||||
@@ -137,23 +145,11 @@ do
|
||||
self:setICLS()
|
||||
self:setLink4()
|
||||
self:setACLS(true)
|
||||
self:setATC()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function BAirboss:getWindBearingAndVel(point)
|
||||
local tPoint = Utils.makeVec3(point)
|
||||
local gLevel = land.getHeight({x = tPoint.x, y = tPoint.z})
|
||||
if tPoint.y <= gLevel then
|
||||
tPoint.y = gLevel + 10
|
||||
end
|
||||
local t = atmosphere.getWind(tPoint)
|
||||
local bearing = math.atan2(t.z, t.x)
|
||||
local vel = math.sqrt(t.x^2 + t.z^2)
|
||||
|
||||
return bearing, vel
|
||||
end
|
||||
|
||||
function BAirboss.findClearPath(from,heading,range)
|
||||
local dest = Utils.vecTranslate(from,heading,range)
|
||||
|
||||
@@ -196,10 +192,10 @@ do
|
||||
return onBoard_num_hundred + onBoard_num_tens + onBoard_num_ones
|
||||
end
|
||||
|
||||
function BAirboss:turnIntoWind()
|
||||
function BAirboss:turnIntoWind(Delay)
|
||||
--Get weather data.
|
||||
local CarrierPoint = self.carrierUnit:getPoint()
|
||||
local windBearing, windSpeed = self:getWindBearingAndVel(CarrierPoint) -- radians & m/s
|
||||
local windBearing, windSpeed = Utils.getWindBearingAndVel(CarrierPoint) -- radians & m/s
|
||||
|
||||
local magnetic = 7
|
||||
|
||||
@@ -295,9 +291,10 @@ do
|
||||
local Controller = self.carrierUnit:getGroup():getController()
|
||||
if not Controller then return self end
|
||||
|
||||
Delay = Delay or 1
|
||||
timer.scheduleFunction(function (Mission)
|
||||
Controller:setTask(Mission)
|
||||
end,Mission,timer.getTime()+1)
|
||||
end,Mission,timer.getTime()+Delay)
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -307,13 +304,25 @@ do
|
||||
return self
|
||||
end
|
||||
|
||||
function BAirboss:setATCChannel(frequency,modulation,power)
|
||||
function BAirboss:setATC(frequency,modulation,power)
|
||||
frequency = frequency or BAirboss.DefaultSettings[self.carrierUnit:getTypeName()].ATC
|
||||
if frequency < 1000000 then
|
||||
frequency = frequency * 1000000
|
||||
|
||||
if frequency < 200000000 then
|
||||
frequency = BAirboss.DefaultSettings[self.carrierUnit:getTypeName()].ATC
|
||||
end
|
||||
end
|
||||
|
||||
power = power or 1
|
||||
modulation = modulation or radio.modulation.AM
|
||||
|
||||
local SetFrequency = {
|
||||
id = 'SetFrequencyForUnit',
|
||||
params = {
|
||||
frequency = frequency,
|
||||
modulation = radio.modulation,
|
||||
power = number,
|
||||
modulation = modulation,
|
||||
power = power,
|
||||
unitId = self.carrierUnit:getID(),
|
||||
}
|
||||
}
|
||||
@@ -323,7 +332,9 @@ do
|
||||
return self
|
||||
end
|
||||
|
||||
Controller:setCommand(ActivateBeacon)
|
||||
Controller:setCommand(SetFrequency)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function BAirboss:setTACAN(Channel,Mode,MorseCode)
|
||||
@@ -435,6 +446,9 @@ end
|
||||
|
||||
|
||||
local Airboss_Roosevelt = BAirboss:New('USS Theodore Roosevelt')
|
||||
|
||||
Airboss_Roosevelt:turnIntoWind()
|
||||
|
||||
local Airboss_Sten = BAirboss:New('John C. Stennis')
|
||||
Airboss_Sten:turnIntoWind()
|
||||
|
||||
trigger.action.outText('Start',20)
|
||||
Reference in New Issue
Block a user