This commit is contained in:
funkyfranky
2019-06-12 16:30:37 +02:00
parent 6ac1194746
commit 731517dcf2
2 changed files with 81 additions and 15 deletions
+23 -10
View File
@@ -1685,7 +1685,7 @@ AIRBOSS.MenuF10Root=nil
--- Airboss class version. --- Airboss class version.
-- @field #string version -- @field #string version
AIRBOSS.version="1.0.2" AIRBOSS.version="1.0.3"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@@ -3617,15 +3617,27 @@ function AIRBOSS:_CheckRecoveryTimes()
if self:IsRecovering() and not recovery.OVER then if self:IsRecovering() and not recovery.OVER then
-- Set carrier to idle. if #self.Qpattern>0 then
self:RecoveryStop()
state="closing now"
-- Closed. local extmin=5*#self.Qpattern
recovery.OPEN=false recovery.STOP=recovery.STOP+extmin*60
-- Window just closed. local text=string.format("We still got flights in the pattern.\nRecovery time prolonged by %d minutes.\nNow get your act together and no more bolters!", extmin)
recovery.OVER=true self:MessageToPattern(text, "AIRBOSS", "99", 10, false, nil)
else
-- Set carrier to idle.
self:RecoveryStop()
state="closing now"
-- Closed.
recovery.OPEN=false
-- Window just closed.
recovery.OVER=true
end
else else
-- Carrier is already idle. -- Carrier is already idle.
@@ -3690,9 +3702,10 @@ function AIRBOSS:_CheckRecoveryTimes()
--Debug info --Debug info
self:T(self.lid..string.format("Heading=%03d°, Wind=%03d° %.1f kts, Delta=%03d° ==> U-turn=%s", hdg, wind,UTILS.MpsToKnots(vwind), delta, tostring(uturn))) self:T(self.lid..string.format("Heading=%03d°, Wind=%03d° %.1f kts, Delta=%03d° ==> U-turn=%s", hdg, wind,UTILS.MpsToKnots(vwind), delta, tostring(uturn)))
-- Time into the wind 1 day or if longer recovery time + the 5 min early.
local t=math.max(nextwindow.STOP-nextwindow.START+300, 60*60*24)
-- Time into the wind + the 5 min early. -- Recovery wind on deck in knots.
local t=nextwindow.STOP-nextwindow.START+300
local v=UTILS.KnotsToMps(nextwindow.SPEED) local v=UTILS.KnotsToMps(nextwindow.SPEED)
-- Check that we do not go above max possible speed. -- Check that we do not go above max possible speed.
+56 -3
View File
@@ -73,7 +73,7 @@ SKIPPER = {
--- FlightControl class version. --- FlightControl class version.
-- @field #string version -- @field #string version
SKIPPER.version="0.0.1" SKIPPER.version="0.0.2"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@@ -135,6 +135,57 @@ function SKIPPER:New(carriername)
-- From State --> Event --> To State -- From State --> Event --> To State
self:AddTransition("Stopped", "Start", "Running") -- Start FSM. self:AddTransition("Stopped", "Start", "Running") -- Start FSM.
self:AddTransition("*", "Status", "*") -- Update status. self:AddTransition("*", "Status", "*") -- Update status.
self:AddTransition("*", "IntruderAlert", "*") -- New intruder detected.
------------------------
--- Pseudo Functions ---
------------------------
--- Triggers the FSM event "Start". Starts the SKIPPER. Initializes parameters and starts event handlers.
-- @function [parent=#SKIPPER] Start
-- @param #SKIPPER self
--- Triggers the FSM event "Start" after a delay. Starts the SKIPPER. Initializes parameters and starts event handlers.
-- @function [parent=#SKIPPER] __Start
-- @param #SKIPPER self
-- @param #number delay Delay in seconds.
--- Triggers the FSM event "Stop". Stops the SKIPPER and all its event handlers.
-- @param #SKIPPER self
--- Triggers the FSM event "Stop" after a delay. Stops the SKIPPER and all its event handlers.
-- @function [parent=#SKIPPER] __Stop
-- @param #SKIPPER self
-- @param #number delay Delay in seconds.
--- Triggers the FSM event "Status".
-- @function [parent=#SKIPPER] Status
-- @param #SKIPPER self
--- Triggers the FSM event "Status" after a delay.
-- @function [parent=#SKIPPER] __Status
-- @param #SKIPPER self
-- @param #number delay Delay in seconds.
--- Triggers the FSM event "IntruderAlert".
-- @function [parent=#SKIPPER] IntruderAlert
-- @param #SKIPPER self
-- @param #SKIPPER.Intruder Intruder data table.
--- Triggers the FSM delayed event "IntruderAlert".
-- @function [parent=#SKIPPER] __IntruderAlert
-- @param #SKIPPER self
-- @param #number delay Delay in seconds before the function is called.
-- @param #SKIPPER.Intruder Intruder data table
--- On after "IntruderAlert" event user function. Called when a missile was launched.
-- @function [parent=#SKIPPER] OnAfterIntruderAlert
-- @param #SKIPPER self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param #SKIPPER.Intruder Intruder data table.
-- Debug trace. -- Debug trace.
if true then if true then
@@ -142,10 +193,9 @@ function SKIPPER:New(carriername)
BASE:TraceOnOff(true) BASE:TraceOnOff(true)
BASE:TraceClass(self.ClassName) BASE:TraceClass(self.ClassName)
BASE:TraceLevel(3) BASE:TraceLevel(3)
self.arty:GetAmmo(true)
end end
self.arty:GetAmmo(true)
return self return self
end end
@@ -348,6 +398,9 @@ function SKIPPER:_CheckIntruder()
-- Add intruder to list. -- Add intruder to list.
table.insert(self.intruders, intruder) table.insert(self.intruders, intruder)
-- Trigger alert!
self:IntruderAlert(intruder)
end end
end end