From 5d802f0e16081f92dad6bd7b61013ae9fefffbe9 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 1 Jan 2023 12:34:02 +0100 Subject: [PATCH 1/2] #TIMER * Added `StartIf()` --- Moose Development/Moose/Core/Timer.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Timer.lua b/Moose Development/Moose/Core/Timer.lua index 88e1e77b3..02e4cee63 100644 --- a/Moose Development/Moose/Core/Timer.lua +++ b/Moose Development/Moose/Core/Timer.lua @@ -155,7 +155,7 @@ function TIMER:New(Function, ...) return self end ---- Create a new TIMER object. +--- Start TIMER object. -- @param #TIMER self -- @param #number Tstart Relative start time in seconds. -- @param #number dT Interval between function calls in seconds. If not specified `nil`, the function is called only once. @@ -192,6 +192,20 @@ function TIMER:Start(Tstart, dT, Duration) return self end +--- Start TIMER object if a condition is met. Useful for e.g. debugging. +-- @param #TIMER self +-- @param #boolean Condition Must be true for the TIMER to start +-- @param #number Tstart Relative start time in seconds. +-- @param #number dT Interval between function calls in seconds. If not specified `nil`, the function is called only once. +-- @param #number Duration Time in seconds for how long the timer is running. If not specified `nil`, the timer runs forever or until stopped manually by the `TIMER:Stop()` function. +-- @return #TIMER self +function TIMER:StartIf(Condition,Tstart, dT, Duration) + if Condition then + self:Start(Tstart, dT, Duration) + end + return self +end + --- Stop the timer by removing the timer function. -- @param #TIMER self -- @param #number Delay (Optional) Delay in seconds, before the timer is stopped. From bdd283956c95a3951f07988301839c06e6a17421 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 1 Jan 2023 20:07:14 +0100 Subject: [PATCH 2/2] AUFTRAG CAP - Fixed mission speed (unit conversion) --- Moose Development/Moose/Ops/Auftrag.lua | 2 +- Moose Development/Moose/Ops/FlightGroup.lua | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 74e27a915..9347b1997 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -1310,7 +1310,7 @@ function AUFTRAG:NewCAP(ZoneCAP, Altitude, Speed, Coordinate, Heading, Leg, Targ mission.missionTask=ENUMS.MissionTask.CAP mission.optionROE=ENUMS.ROE.OpenFire mission.optionROT=ENUMS.ROT.EvadeFire - mission.missionSpeed = UTILS.KnotsToAltKIAS(Speed or 350,Altitude) + mission.missionSpeed = UTILS.KnotsToKmph(UTILS.KnotsToAltKIAS(Speed or 350, Altitude)) mission.categories={AUFTRAG.Category.AIRCRAFT} diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index 88ca5ee7a..246f5312c 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -3777,10 +3777,13 @@ function FLIGHTGROUP:AddWaypoint(Coordinate, Speed, AfterWaypointWithID, Altitud -- Set waypoint index. local wpnumber=self:GetWaypointIndexAfterID(AfterWaypointWithID) - + -- Speed in knots. Speed=Speed or self:GetSpeedCruise() + -- Debug info. + self:T3(self.lid..string.format("Waypoint Speed=%.1f knots", Speed)) + -- Alt type default is barometric (ASL). For helos we use radar (AGL). local alttype=COORDINATE.WaypointAltType.BARO if self.isHelo then