From a6de09a0cad2a98f0b7ad4d5751bd63e52343907 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 11 Jun 2024 09:03:57 +0200 Subject: [PATCH 1/5] Fixes --- Moose Development/Moose/Core/Set.lua | 2 +- .../Moose/Functional/Designate.lua | 36 ++++++++++--------- .../Moose/Functional/Detection.lua | 14 ++++---- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index a401b6f3f..43812c1e1 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -3478,7 +3478,7 @@ do -- SET_STATIC --- Add STATIC(s) to SET_STATIC. -- @param #SET_STATIC self - -- @param #string AddStatic A single STATIC. + -- @param Wrapper.Static#STATIC AddStatic A single STATIC. -- @return #SET_STATIC self function SET_STATIC:AddStatic( AddStatic ) self:F2( AddStatic:GetName() ) diff --git a/Moose Development/Moose/Functional/Designate.lua b/Moose Development/Moose/Functional/Designate.lua index 811a865ae..b6156d256 100644 --- a/Moose Development/Moose/Functional/Designate.lua +++ b/Moose Development/Moose/Functional/Designate.lua @@ -184,7 +184,7 @@ do -- DESIGNATE - --- @type DESIGNATE + -- @type DESIGNATE -- @extends Core.Fsm#FSM_PROCESS --- Manage the designation of detected targets. @@ -525,7 +525,7 @@ do -- DESIGNATE self.AttackSet:ForEachGroupAlive( - --- @param Wrapper.Group#GROUP AttackGroup + -- @param Wrapper.Group#GROUP AttackGroup function( AttackGroup ) self.FlashStatusMenu[AttackGroup] = FlashMenu end @@ -554,7 +554,7 @@ do -- DESIGNATE self.AttackSet:ForEachGroupAlive( - --- @param Wrapper.Group#GROUP AttackGroup + -- @param Wrapper.Group#GROUP AttackGroup function( AttackGroup ) self.FlashDetectionMessage[AttackGroup] = FlashDetectionMessage end @@ -826,7 +826,7 @@ do -- DESIGNATE -- This Detection is obsolete, remove from the designate scope self.Designating[DesignateIndex] = nil self.AttackSet:ForEachGroupAlive( - --- @param Wrapper.Group#GROUP AttackGroup + -- @param Wrapper.Group#GROUP AttackGroup function( AttackGroup ) if AttackGroup:IsAlive() == true then local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " ) @@ -903,7 +903,7 @@ do -- DESIGNATE self.AttackSet:ForEachGroupAlive( - --- @param Wrapper.Group#GROUP GroupReport + -- @param Wrapper.Group#GROUP GroupReport function( AttackGroup ) if self.FlashStatusMenu[AttackGroup] or ( MenuAttackGroup and ( AttackGroup:GetName() == MenuAttackGroup:GetName() ) ) then @@ -1060,7 +1060,7 @@ do -- DESIGNATE self.AttackSet:ForEachGroupAlive( - --- @param Wrapper.Group#GROUP GroupReport + -- @param Wrapper.Group#GROUP GroupReport function( AttackGroup ) self:ScheduleOnce( Delay, self.SetMenu, self, AttackGroup ) @@ -1198,7 +1198,7 @@ do -- DESIGNATE --local ReportTypes = REPORT:New() --local ReportLaserCodes = REPORT:New() - TargetSetUnit:Flush( self ) + --TargetSetUnit:Flush( self ) --self:F( { Recces = self.Recces } ) for TargetUnit, RecceData in pairs( self.Recces ) do @@ -1229,10 +1229,12 @@ do -- DESIGNATE end end + if TargetSetUnit == nil then return end + if self.AutoLase or ( not self.AutoLase and ( self.LaseStart + Duration >= timer.getTime() ) ) then TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0, - --- @param Wrapper.Unit#UNIT SmokeUnit + -- @param Wrapper.Unit#UNIT SmokeUnit function( TargetUnit ) self:F( { TargetUnit = TargetUnit:GetName() } ) @@ -1253,7 +1255,7 @@ do -- DESIGNATE local RecceUnit = UnitData -- Wrapper.Unit#UNIT local RecceUnitDesc = RecceUnit:GetDesc() - --self:F( { RecceUnit = RecceUnit:GetName(), RecceDescription = RecceUnitDesc } ) + --self:F( { RecceUnit = RecceUnit:GetName(), RecceDescription = RecceUnitDesc } )x if RecceUnit:IsLasing() == false then --self:F( { IsDetected = RecceUnit:IsDetected( TargetUnit ), IsLOS = RecceUnit:IsLOS( TargetUnit ) } ) @@ -1275,9 +1277,10 @@ do -- DESIGNATE local Spot = RecceUnit:LaseUnit( TargetUnit, LaserCode, Duration ) local AttackSet = self.AttackSet local DesignateName = self.DesignateName + local typename = TargetUnit:GetTypeName() function Spot:OnAfterDestroyed( From, Event, To ) - self.Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() .. " destroyed. " .. TargetSetUnit:Count() .. " targets left.", + self.Recce:MessageToSetGroup( "Target " ..typename .. " destroyed. " .. TargetSetUnit:CountAlive() .. " targets left.", 5, AttackSet, self.DesignateName ) end @@ -1285,7 +1288,7 @@ do -- DESIGNATE -- OK. We have assigned for the Recce a TargetUnit. We can exit the function. MarkingCount = MarkingCount + 1 local TargetUnitType = TargetUnit:GetTypeName() - RecceUnit:MessageToSetGroup( "Marking " .. TargetUnit:GetTypeName() .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.", + RecceUnit:MessageToSetGroup( "Marking " .. TargetUnitType .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.", 10, self.AttackSet, DesignateName ) if not MarkedTypes[TargetUnitType] then MarkedTypes[TargetUnitType] = true @@ -1392,7 +1395,7 @@ do -- DESIGNATE local MarkedCount = 0 TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0, - --- @param Wrapper.Unit#UNIT SmokeUnit + -- @param Wrapper.Unit#UNIT SmokeUnit function( SmokeUnit ) if MarkedCount < self.MaximumMarkings then @@ -1457,9 +1460,10 @@ do -- DESIGNATE -- @param #DESIGNATE self -- @return #DESIGNATE function DESIGNATE:onafterDoneSmoking( From, Event, To, Index ) - - self.Designating[Index] = string.gsub( self.Designating[Index], "S", "" ) - self:SetDesignateMenu() + if self.Designating[Index] ~= nil then + self.Designating[Index] = string.gsub( self.Designating[Index], "S", "" ) + self:SetDesignateMenu() + end end --- DoneIlluminating @@ -1472,5 +1476,3 @@ do -- DESIGNATE end end - - diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua index bc65c4d4f..a6196f861 100644 --- a/Moose Development/Moose/Functional/Detection.lua +++ b/Moose Development/Moose/Functional/Detection.lua @@ -545,7 +545,7 @@ do -- DETECTION_BASE -- @param #string To The To State string. function DETECTION_BASE:onafterDetect( From, Event, To ) - local DetectDelay = 0.1 + local DetectDelay = 0.15 self.DetectionCount = 0 self.DetectionRun = 0 self:UnIdentifyAllDetectedObjects() -- Resets the DetectedObjectsIdentified table @@ -604,7 +604,7 @@ do -- DETECTION_BASE -- @param #number DetectionTimeStamp Time stamp of detection event. function DETECTION_BASE:onafterDetection( From, Event, To, Detection, DetectionTimeStamp ) - -- self:F( { DetectedObjects = self.DetectedObjects } ) + self:I( { DetectedObjects = self.DetectedObjects } ) self.DetectionRun = self.DetectionRun + 1 @@ -612,14 +612,14 @@ do -- DETECTION_BASE if Detection and Detection:IsAlive() then - -- self:T( { "DetectionGroup is Alive", DetectionGroup:GetName() } ) + self:I( { "DetectionGroup is Alive", Detection:GetName() } ) local DetectionGroupName = Detection:GetName() local DetectionUnit = Detection:GetUnit( 1 ) local DetectedUnits = {} - local DetectedTargets = Detection:GetDetectedTargets( + local DetectedTargets = DetectionUnit:GetDetectedTargets( self.DetectVisual, self.DetectOptical, self.DetectRadar, @@ -628,8 +628,10 @@ do -- DETECTION_BASE self.DetectDLINK ) - self:F( { DetectedTargets = DetectedTargets } ) - + --self:I( { DetectedTargets = DetectedTargets } ) + --self:I(UTILS.PrintTableToLog(DetectedTargets)) + + for DetectionObjectID, Detection in pairs( DetectedTargets ) do local DetectedObject = Detection.object -- DCS#Object From 5fcd394dddfb2341443887ab8bed7983e40deb9c Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 15 Jun 2024 08:11:14 +0200 Subject: [PATCH 2/5] Update CSAR.lua Kiowa type name --- Moose Development/Moose/Ops/CSAR.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/CSAR.lua b/Moose Development/Moose/Ops/CSAR.lua index 9867523e5..7b716ed5c 100644 --- a/Moose Development/Moose/Ops/CSAR.lua +++ b/Moose Development/Moose/Ops/CSAR.lua @@ -292,7 +292,7 @@ CSAR.AircraftType["AH-64D_BLK_II"] = 2 CSAR.AircraftType["Bronco-OV-10A"] = 2 CSAR.AircraftType["MH-60R"] = 10 CSAR.AircraftType["OH-6A"] = 2 -CSAR.AircraftType["OH-58D"] = 2 +CSAR.AircraftType["OH58D"] = 2 --- CSAR class version. -- @field #string version From 2d1fcb9be8bc73ebe983c56f7c4d628ac90f97b9 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 15 Jun 2024 08:12:54 +0200 Subject: [PATCH 3/5] Update CTLD.lua --- Moose Development/Moose/Ops/CTLD.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index da51b1e5a..037446ea4 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -1250,7 +1250,7 @@ CTLD.UnitTypeCapabilities = { ["AH-64D_BLK_II"] = {type="AH-64D_BLK_II", crates=false, troops=true, cratelimit = 0, trooplimit = 2, length = 17, cargoweightlimit = 200}, -- 2 ppl **outside** the helo ["Bronco-OV-10A"] = {type="Bronco-OV-10A", crates= false, troops=true, cratelimit = 0, trooplimit = 5, length = 13, cargoweightlimit = 1450}, ["OH-6A"] = {type="OH-6A", crates=false, troops=true, cratelimit = 0, trooplimit = 4, length = 7, cargoweightlimit = 550}, - ["OH-58D"] = {type="OH-58D", crates=false, troops=false, cratelimit = 0, trooplimit = 0, length = 14, cargoweightlimit = 400}, + ["OH58D"] = {type="OH58D", crates=false, troops=false, cratelimit = 0, trooplimit = 0, length = 14, cargoweightlimit = 400}, } --- CTLD class version. From 5f9d4405b1944551eeb3984b0741ec3f9a8b55ad Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 18 Jun 2024 09:20:59 +0200 Subject: [PATCH 4/5] AIRBOSS - Added case that group template cannot be found in MOOSE db --- Moose Development/Moose/Core/Database.lua | 11 +++-- Moose Development/Moose/Ops/Airboss.lua | 59 ++++++++++++++++------- Moose Development/Moose/Wrapper/Group.lua | 8 ++- 3 files changed, 54 insertions(+), 24 deletions(-) diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua index 8f031fdd0..db54e8dc2 100644 --- a/Moose Development/Moose/Core/Database.lua +++ b/Moose Development/Moose/Core/Database.lua @@ -1147,10 +1147,13 @@ end -- @param #string GroupName Group name. -- @return #table Group template table. function DATABASE:GetGroupTemplate( GroupName ) - local GroupTemplate = self.Templates.Groups[GroupName].Template - GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID - GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID - GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID + local GroupTemplate=nil + if self.Templates.Groups[GroupName] then + GroupTemplate = self.Templates.Groups[GroupName].Template + GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID + GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID + GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID + end return GroupTemplate end diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 13ec474c9..6d67eb0a3 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -14365,32 +14365,55 @@ function AIRBOSS:_GetOnboardNumbers( group, playeronly ) -- Debug text. local text = string.format( "Onboard numbers of group %s:", groupname ) - -- Units of template group. - local units = group:GetTemplate().units + local template=group:GetTemplate() - -- Get numbers. local numbers = {} - for _, unit in pairs( units ) do + if template then - -- Onboard number and unit name. - local n = tostring( unit.onboard_num ) - local name = unit.name - local skill = unit.skill or "Unknown" + -- Units of template group. + local units = template.units - -- Debug text. - text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) ) + -- Get numbers. + for _, unit in pairs( units ) do - if playeronly and skill == "Client" or skill == "Player" then - -- There can be only one player in the group, so we skip everything else. - return n + -- Onboard number and unit name. + local n = tostring( unit.onboard_num ) + local name = unit.name + local skill = unit.skill or "Unknown" + + -- Debug text. + text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) ) + + if playeronly and skill == "Client" or skill == "Player" then + -- There can be only one player in the group, so we skip everything else. + return n + end + + -- Table entry. + numbers[name] = n end - -- Table entry. - numbers[name] = n - end + -- Debug info. + self:T2( self.lid .. text ) - -- Debug info. - self:T2( self.lid .. text ) + else + + if playeronly then + return 101 + else + + local units=group:GetUnits() + + for i,_unit in pairs(units) do + local name=_unit:GetName() + + numbers[name]=100+i + + end + + end + + end return numbers end diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 4f214c7bf..5122d2b9c 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -1775,10 +1775,14 @@ end --- Returns the group template from the global _DATABASE object (an instance of @{Core.Database#DATABASE}). -- @param #GROUP self --- @return #table +-- @return #table Template table. function GROUP:GetTemplate() local GroupName = self:GetName() - return UTILS.DeepCopy( _DATABASE:GetGroupTemplate( GroupName ) ) + local template=_DATABASE:GetGroupTemplate( GroupName ) + if template then + return UTILS.DeepCopy( template ) + end + return nil end --- Returns the group template route.points[] (the waypoints) from the global _DATABASE object (an instance of @{Core.Database#DATABASE}). From f9f0a8e86605fb30fd1595642a04bc1d6b4ae2af Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 20 Jun 2024 08:51:54 +0200 Subject: [PATCH 5/5] #COORDINATE - Fix is day/night for Kola locations when the sun either never rises or never sets. --- Moose Development/Moose/Core/Point.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 6db800ac8..929e368a5 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -2747,7 +2747,10 @@ do -- COORDINATE local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, true, Tdiff) local sunset=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, false, Tdiff) - + + if sunrise == "N/R" then return false end + if sunrise == "N/S" then return true end + local time=UTILS.ClockToSeconds(clock) -- Check if time is between sunrise and sunset.