From bb1caa6642bce39c2ec0a109cdae83b68cad3d39 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Fri, 30 May 2025 18:37:38 +0200 Subject: [PATCH 1/3] Update CSAR.lua --- Moose Development/Moose/Ops/CSAR.lua | 71 +++++++++++++++++++++------- 1 file changed, 53 insertions(+), 18 deletions(-) diff --git a/Moose Development/Moose/Ops/CSAR.lua b/Moose Development/Moose/Ops/CSAR.lua index 98b8a2128..09af31eb5 100644 --- a/Moose Development/Moose/Ops/CSAR.lua +++ b/Moose Development/Moose/Ops/CSAR.lua @@ -263,6 +263,7 @@ CSAR = { rescuedpilots = 0, limitmaxdownedpilots = true, maxdownedpilots = 10, + useFIFOLimitReplacement = false, -- If true, it will remove the oldest downed pilot when a new one is added, if the limit is reached. allheligroupset = nil, topmenuname = "CSAR", ADFRadioPwr = 1000, @@ -1144,19 +1145,8 @@ function CSAR:_EventHandler(EventData) self:T("Double Ejection!") return self end - - -- limit no of pilots in the field. - if self.limitmaxdownedpilots and self:_ReachedPilotLimit() then - self:T("Maxed Downed Pilot!") - return self - end - - - -- TODO: Over water check --- EVENTS.LandingAfterEjection NOT triggered by DCS, so handle csarUsePara = true case - -- might create dual pilots in edge cases - - local wetfeet = false - + + local initdcscoord = nil local initcoord = nil if _event.id == EVENTS.Ejection then @@ -1168,6 +1158,36 @@ function CSAR:_EventHandler(EventData) initcoord = COORDINATE:NewFromVec3(initdcscoord) self:T({initdcscoord}) end + + -- Remove downed pilot if already exists to replace with new one. + if _event.IniPlayerName then + local PilotTable = self.downedPilots --#CSAR.DownedPilot + local _foundPilot = nil + for _,_pilot in pairs(PilotTable) do + if _pilot.player == _event.IniPlayerName and _pilot.alive == true then + _foundPilot = _pilot + break + end + end + if _foundPilot then + self:T("Downed pilot already exists!") + _foundPilot.group:Destroy(false) + self:_RemoveNameFromDownedPilots(_foundPilot.name) + self:_CheckDownedPilotTable() + end + end + + -- limit no of pilots in the field. + if self.limitmaxdownedpilots and self:_ReachedPilotLimit() then + self:T("Maxed Downed Pilot!") + return self + end + + + -- TODO: Over water check --- EVENTS.LandingAfterEjection NOT triggered by DCS, so handle csarUsePara = true case + -- might create dual pilots in edge cases + + local wetfeet = false --local surface = _unit:GetCoordinate():GetSurfaceType() local surface = initcoord:GetSurfaceType() @@ -2401,11 +2421,26 @@ function CSAR:_ReachedPilotLimit() local limit = self.maxdownedpilots local islimited = self.limitmaxdownedpilots local count = self:_CountActiveDownedPilots() - if islimited and (count >= limit) then - return true - else - return false - end + if islimited and (count >= limit) then + if self.useFIFOLimitReplacement then + local oldIndex = -1 + local oldDownedPilot = nil + for _index, _downedpilot in pairs(self.downedPilots) do + oldIndex = _index + oldDownedPilot = _downedpilot + break + end + if oldDownedPilot then + oldDownedPilot.group:Destroy(false) + oldDownedPilot.alive = false + self:_CheckDownedPilotTable() + return false + end + end + return true + else + return false + end end --- User - Function to add onw SET_GROUP Set-up for pilot filtering and assignment. From f5881eda533a97bae379e3b5d5b81cd6895fa0d1 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 1 Jun 2025 12:19:42 +0200 Subject: [PATCH 2/3] AIRBOSS - Remove useless E Messages for non-debug --- Moose Development/Moose/Ops/Airboss.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 5e6f70443..d6d7b03a7 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -8741,13 +8741,13 @@ function AIRBOSS:OnEventRemoveUnit( EventData ) -- Nil checks. if EventData == nil then - self:E( self.lid .. "ERROR: EventData=nil in event REMOVEUNIT!" ) - self:E( EventData ) + self:T( self.lid .. "ERROR: EventData=nil in event REMOVEUNIT!" ) + self:T( EventData ) return end if EventData.IniUnit == nil then - self:E( self.lid .. "ERROR: EventData.IniUnit=nil in event REMOVEUNIT!" ) - self:E( EventData ) + self:T( self.lid .. "ERROR: EventData.IniUnit=nil in event REMOVEUNIT!" ) + self:T( EventData ) return end From eeeeda4e5e1550bf2c1b2aaaebe347b93b4eb48f Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 8 Jun 2025 18:43:01 +0200 Subject: [PATCH 3/3] #POINT - Offset options for smoke --- Moose Development/Moose/Core/Point.lua | 89 ++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 35ad76b4c..a74356985 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -59,6 +59,10 @@ do -- COORDINATE -- * @{#COORDINATE.SmokeOrange}(): To smoke the point in orange. -- * @{#COORDINATE.SmokeWhite}(): To smoke the point in white. -- * @{#COORDINATE.SmokeGreen}(): To smoke the point in green. + -- * @{#COORDINATE.SetSmokeOffsetDirection}(): To set an offset point direction for smoke. + -- * @{#COORDINATE.SetSmokeOffsetDistance}(): To set an offset point distance for smoke. + -- * @{#COORDINATE.SwitchSmokeOffsetOn}(): To set an offset point for smoke to on. + -- * @{#COORDINATE.SwitchSmokeOffsetOff}(): To set an offset point for smoke to off. -- -- ## 2.2) Flare -- @@ -2124,21 +2128,32 @@ do -- COORDINATE -- @param #number Duration (Optional) Duration of the smoke in seconds. DCS stopps the smoke automatically after 5 min. -- @param #number Delay (Optional) Delay before the smoke is started in seconds. -- @param #string Name (Optional) Name if you want to stop the smoke early (normal duration: 5mins) + -- @param #boolean Offset (Optional) If true, offset the smokle a bit. + -- @param #number Direction (Optional) If Offset is true this is the direction of the offset, 1-359 (degrees). Default random. + -- @param #number Distance (Optional) If Offset is true this is the distance of the offset in meters. Default random 10-20. -- @return #COORDINATE self - function COORDINATE:Smoke( SmokeColor, Duration, Delay, Name) - self:F2( { SmokeColor, Name, Duration, Delay } ) + function COORDINATE:Smoke( SmokeColor, Duration, Delay, Name, Offset,Direction,Distance) + self:F2( { SmokeColor, Name, Duration, Delay, Offset } ) SmokeColor=SmokeColor or SMOKECOLOR.Green if Delay and Delay>0 then - self:ScheduleOnce(Delay, COORDINATE.Smoke, self, SmokeColor, Duration, 0, Name) + self:ScheduleOnce(Delay, COORDINATE.Smoke, self, SmokeColor, Duration, 0, Name, Direction,Distance) else -- Create a name which is used to stop the smoke manually self.firename = Name or "Smoke-"..math.random(1,100000) -- Create smoke - trigger.action.smoke( self:GetVec3(), SmokeColor, self.firename ) + if Offset or self.SmokeOffset then + local Angle = Direction or self:GetSmokeOffsetDirection() + local Distance = Distance or self:GetSmokeOffsetDistance() + local newpos = self:Translate(Distance,Angle,true,false) + local newvec3 = newpos:GetVec3() + trigger.action.smoke( newvec3, SmokeColor, self.firename ) + else + trigger.action.smoke( self:GetVec3(), SmokeColor, self.firename ) + end -- Stop smoke if Duration and Duration>0 then @@ -2148,6 +2163,72 @@ do -- COORDINATE return self end + + --- Get the offset direction when using `COORDINATE:Smoke()`. + -- @param #COORDINATE self + -- @return #number Direction in degrees. + function COORDINATE:GetSmokeOffsetDirection() + local direction = self.SmokeOffsetDirection or math.random(1,359) + return direction + end + + --- Set the offset direction when using `COORDINATE:Smoke()`. + -- @param #COORDINATE self + -- @param #number Direction (Optional) This is the direction of the offset, 1-359 (degrees). Default random. + -- @return #COORDINATE self + function COORDINATE:SetSmokeOffsetDirection(Direction) + if self then + self.SmokeOffsetDirection = Direction or math.random(1,359) + return self + else + COORDINATE.SmokeOffsetDirection = Direction or math.random(1,359) + end + end + + --- Get the offset distance when using `COORDINATE:Smoke()`. + -- @param #COORDINATE self + -- @return #number Distance Distance in meters. + function COORDINATE:GetSmokeOffsetDistance() + local distance = self.SmokeOffsetDistance or math.random(10,20) + return distance + end + + --- Set the offset distance when using `COORDINATE:Smoke()`. + -- @param #COORDINATE self + -- @param #number Distance (Optional) This is the distance of the offset in meters. Default random 10-20. + -- @return #COORDINATE self + function COORDINATE:SetSmokeOffsetDistance(Distance) + if self then + self.SmokeOffsetDistance = Distance or math.random(10,20) + return self + else + COORDINATE.SmokeOffsetDistance = Distance or math.random(10,20) + end + end + + --- Set the offset on when using `COORDINATE:Smoke()`. + -- @param #COORDINATE self + -- @return #COORDINATE self + function COORDINATE:SwitchSmokeOffsetOn() + if self then + self.SmokeOffset = true + return self + else + COORDINATE.SmokeOffset = true + end + end + + --- Set the offset off when using `COORDINATE:Smoke()`. + -- @param #COORDINATE self + -- @return #COORDINATE self + function COORDINATE:SwitchSmokeOffsetOff() + if self then + self.SmokeOffset = false + return self + else + COORDINATE.SmokeOffset = false + end + end --- Stops smoking the point in a color. -- @param #COORDINATE self