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
+24 -11
View File
@@ -1685,7 +1685,7 @@ AIRBOSS.MenuF10Root=nil
--- Airboss class version.
-- @field #string version
AIRBOSS.version="1.0.2"
AIRBOSS.version="1.0.3"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@@ -3617,15 +3617,27 @@ function AIRBOSS:_CheckRecoveryTimes()
if self:IsRecovering() and not recovery.OVER then
-- Set carrier to idle.
self:RecoveryStop()
state="closing now"
if #self.Qpattern>0 then
local extmin=5*#self.Qpattern
recovery.STOP=recovery.STOP+extmin*60
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)
self:MessageToPattern(text, "AIRBOSS", "99", 10, false, nil)
-- Closed.
recovery.OPEN=false
else
-- Set carrier to idle.
self:RecoveryStop()
state="closing now"
-- Closed.
recovery.OPEN=false
-- Window just closed.
recovery.OVER=true
-- Window just closed.
recovery.OVER=true
end
else
-- Carrier is already idle.
@@ -3689,10 +3701,11 @@ function AIRBOSS:_CheckRecoveryTimes()
--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)))
-- 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.
local t=nextwindow.STOP-nextwindow.START+300
-- Recovery wind on deck in knots.
local v=UTILS.KnotsToMps(nextwindow.SPEED)
-- Check that we do not go above max possible speed.
+57 -4
View File
@@ -73,7 +73,7 @@ SKIPPER = {
--- FlightControl class version.
-- @field #string version
SKIPPER.version="0.0.1"
SKIPPER.version="0.0.2"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@@ -135,6 +135,57 @@ function SKIPPER:New(carriername)
-- From State --> Event --> To State
self:AddTransition("Stopped", "Start", "Running") -- Start FSM.
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.
if true then
@@ -142,10 +193,9 @@ function SKIPPER:New(carriername)
BASE:TraceOnOff(true)
BASE:TraceClass(self.ClassName)
BASE:TraceLevel(3)
self.arty:GetAmmo(true)
end
self.arty:GetAmmo(true)
return self
end
@@ -348,6 +398,9 @@ function SKIPPER:_CheckIntruder()
-- Add intruder to list.
table.insert(self.intruders, intruder)
-- Trigger alert!
self:IntruderAlert(intruder)
end
end