From da70f4ce6c76e3dd40e2bd66c74a84e2c75ff816 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sat, 5 Jul 2025 18:56:59 +0200 Subject: [PATCH 1/4] #DynamicSlots for dynamic FARPs --- Moose Development/Moose/Core/SpawnStatic.lua | 16 ++++++++-- Moose Development/Moose/Utilities/Utils.lua | 31 ++++++++++++++++++-- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Core/SpawnStatic.lua b/Moose Development/Moose/Core/SpawnStatic.lua index 38f3b0f87..b41ac1b0c 100644 --- a/Moose Development/Moose/Core/SpawnStatic.lua +++ b/Moose Development/Moose/Core/SpawnStatic.lua @@ -302,12 +302,16 @@ end -- @param #number CallsignID Callsign ID. Default 1 (="London"). -- @param #number Frequency Frequency in MHz. Default 127.5 MHz. -- @param #number Modulation Modulation 0=AM, 1=FM. +-- @param #boolean DynamicSpawns If true, allow Dynamic Spawns +-- @param #boolean DynamicHotStarts If true, and DynamicSpawns is true, then allow Dynamic Spawns with hot starts. -- @return #SPAWNSTATIC self -function SPAWNSTATIC:InitFARP(CallsignID, Frequency, Modulation) +function SPAWNSTATIC:InitFARP(CallsignID, Frequency, Modulation, DynamicSpawns,DynamicHotStarts) self.InitFarp=true self.InitFarpCallsignID=CallsignID or 1 self.InitFarpFreq=Frequency or 127.5 self.InitFarpModu=Modulation or 0 + self.InitFarpDynamicSpawns = DynamicSpawns + self.InitFarpDynamicHotStarts = (DynamicSpawns == true and DynamicHotStarts == true) and true or nil return self end @@ -550,6 +554,13 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID) TemplateGroup.x=Template.x TemplateGroup.y=Template.y TemplateGroup.name=Template.name + + if self.InitFarpDynamicSpawns == true then + TemplateGroup.units[1].dynamicSpawn = true + if self.InitFarpDynamicHotStarts == true then + TemplateGroup.units[1].allowHotStart = true + end + end self:T("Spawning FARP") self:T({Template=Template}) @@ -557,7 +568,8 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID) -- ED's dirty way to spawn FARPS. Static=coalition.addGroup(CountryID, -1, TemplateGroup) - + --Static=coalition.addStaticObject(CountryID, Template) + -- Currently DCS 2.8 does not trigger birth events if FARPS are spawned! -- We create such an event. The airbase is registered in Core.Event local Event = { diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index 6429e01ed..17f6bc039 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -4143,9 +4143,14 @@ end -- @param #string VehicleTemplate, template name for additional vehicles. Can be nil for no additional vehicles. -- @param #number Liquids Tons of fuel to be added initially to the FARP. Defaults to 10 (tons). Set to 0 for no fill. -- @param #number Equipment Number of equipment items per known item to be added initially to the FARP. Defaults to 10 (items). Set to 0 for no fill. +-- @param #number Airframes Number of helicopter airframes per known type in Ops.CSAR#CSAR.AircraftType to be added initially to the FARP. Set to 0 for no airframes. +-- @param #string F10Text Text to display on F10 map if given. Handy to post things like the ADF beacon Frequency, Callsign and ATC Frequency. +-- @param #boolean DynamicSpawns If true, allow Dynamic Spawns from this FARP. +-- @param #boolean HotStart If true and DynamicSpawns is true, allow hot starts for Dynamic Spawns from this FARP. -- @return #list Table of spawned objects and vehicle object (if given). -- @return #string ADFBeaconName Name of the ADF beacon, to be able to remove/stop it later. -function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition,Country,CallSign,Frequency,Modulation,ADF,SpawnRadius,VehicleTemplate,Liquids,Equipment) +-- @return #number MarkerID ID of the F10 Text, to be able to remove it later. +function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition,Country,CallSign,Frequency,Modulation,ADF,SpawnRadius,VehicleTemplate,Liquids,Equipment,Airframes,F10Text,DynamicSpawns,HotStart) -- Set Defaults local farplocation = Coordinate @@ -4159,6 +4164,7 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition, local liquids = Liquids or 10 liquids = liquids * 1000 -- tons to kg local equip = Equipment or 10 + local airframes = Airframes or 10 local statictypes = ENUMS.FARPObjectTypeNamesAndShape[farptype] or {TypeName="FARP", ShapeName="FARPS"} local STypeName = statictypes.TypeName local SShapeName = statictypes.ShapeName @@ -4168,7 +4174,7 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition, -- Spawn FARP local newfarp = SPAWNSTATIC:NewFromType(STypeName,"Heliports",Country) -- "Invisible FARP" "FARP" newfarp:InitShape(SShapeName) -- "invisiblefarp" "FARPS" - newfarp:InitFARP(callsign,freq,mod) + newfarp:InitFARP(callsign,freq,mod,DynamicSpawns,HotStart) local spawnedfarp = newfarp:SpawnFromCoordinate(farplocation,0,Name) table.insert(ReturnObjects,spawnedfarp) -- Spawn Objects @@ -4221,6 +4227,12 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition, end end + if airframes and airframes > 0 then + for typename in pairs (CSAR.AircraftType) do + newWH:SetItem(typename,airframes) + end + end + local ADFName if ADF and type(ADF) == "number" then local ADFFreq = ADF*1000 -- KHz to Hz @@ -4231,7 +4243,20 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition, trigger.action.radioTransmission(Sound, vec3, 0, true, ADFFreq, 250, ADFName) end - return ReturnObjects, ADFName + local MarkerID = nil + if F10Text then + local Color = {0,0,1} + if Coalition == coalition.side.RED then + Color = {1,0,0} + elseif Coalition == coalition.side.NEUTRAL then + Color = {0,1,0} + end + local Alpha = 0.75 + local coordinate = Coordinate:Translate(600,0) + MarkerID = coordinate:TextToAll(F10Text,Coalition,Color,1,{1,1,1},Alpha,14,true) + end + + return ReturnObjects, ADFName, MarkerID end --- Converts a Vec2 to a Vec3. From 926a0733e4b5fd9b01a35e589f762d259446b2a4 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 9 Jul 2025 12:14:41 +0200 Subject: [PATCH 2/4] Controllable - add option prefer vertical landing Addrd --- .../Moose/Wrapper/Controllable.lua | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index b9f5a0d86..689d841a5 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -3629,6 +3629,26 @@ function CONTROLLABLE:OptionROTPassiveDefense() return nil end +--- Helicopter - prefer vertical landing. +-- @param #CONTROLLABLE self +-- @return #CONTROLLABLE self +function CONTROLLABLE:OptionPreferVerticalLanding() + self:F2( { self.ControllableName } ) + + local DCSControllable = self:GetDCSObject() + if DCSControllable then + local Controller = self:_GetController() + + if self:IsAir() then + Controller:setOption( AI.Option.Air.id.PREFER_VERTICAL, true ) + end + + return self + end + + return nil +end + --- Can the CONTROLLABLE evade on enemy fire? -- @param #CONTROLLABLE self -- @return #boolean From 1b6412821b71a38c3c3cab0a1adc0e83ddfda6b6 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 9 Jul 2025 12:15:34 +0200 Subject: [PATCH 3/4] Update Controllable.lua --- .../Moose/Wrapper/Controllable.lua | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index b9f5a0d86..689d841a5 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -3629,6 +3629,26 @@ function CONTROLLABLE:OptionROTPassiveDefense() return nil end +--- Helicopter - prefer vertical landing. +-- @param #CONTROLLABLE self +-- @return #CONTROLLABLE self +function CONTROLLABLE:OptionPreferVerticalLanding() + self:F2( { self.ControllableName } ) + + local DCSControllable = self:GetDCSObject() + if DCSControllable then + local Controller = self:_GetController() + + if self:IsAir() then + Controller:setOption( AI.Option.Air.id.PREFER_VERTICAL, true ) + end + + return self + end + + return nil +end + --- Can the CONTROLLABLE evade on enemy fire? -- @param #CONTROLLABLE self -- @return #boolean From 7d7488db6f37680c0e707a12acd2f99748bbb48e Mon Sep 17 00:00:00 2001 From: smiki Date: Tue, 15 Jul 2025 11:05:03 +0200 Subject: [PATCH 4/4] [ADDED] GROUP.Attribute.GROUND_SHORAD --- Moose Development/Moose/Wrapper/Group.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 44f313f27..89ff5f7c3 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -230,6 +230,7 @@ GROUP.Attribute = { GROUND_EWR="Ground_EWR", GROUND_AAA="Ground_AAA", GROUND_SAM="Ground_SAM", + GROUND_SHORAD="Ground_SHORAD", GROUND_OTHER="Ground_OtherGround", NAVAL_AIRCRAFTCARRIER="Naval_AircraftCarrier", NAVAL_WARSHIP="Naval_WarShip",