From e77d61c4cb526cabc67ee3d788a8781234bdb87a Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 20 Aug 2024 10:55:41 +0200 Subject: [PATCH 1/6] small correction --- Moose Development/Moose/Ops/CTLD.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index ef4d348eb..adfb6436a 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -773,8 +773,8 @@ do -- my_ctld.RadioSound = "beacon.ogg" -- -- this sound will be hearable if you tune in the beacon frequency. Add the sound file to your miz. -- my_ctld.RadioSoundFC3 = "beacon.ogg" -- this sound will be hearable by FC3 users (actually all UHF radios); change to something like "beaconsilent.ogg" and add the sound file to your miz if you don't want to annoy FC3 pilots. -- my_ctld.enableChinookGCLoading = true -- this will effectively suppress the crate load and drop for CTLD_CARGO.Enum.STATIc types for CTLD for the Chinook --- my_ctld.TroopUnloadDistGround = 1.5 -- If hovering, spawn dropped troops this far away from the helo --- my_ctld.TroopUnloadDistHover = 5 -- If grounded, spawn dropped troops this far away from the helo +-- my_ctld.TroopUnloadDistGround = 5 -- If hovering, spawn dropped troops this far away in meters from the helo +-- my_ctld.TroopUnloadDistHover = 1.5 -- If grounded, spawn dropped troops this far away in meters from the helo -- -- ## 2.1 CH-47 Chinook support -- @@ -1210,8 +1210,8 @@ CTLD = { pickupZones = {}, DynamicCargo = {}, ChinookTroopCircleRadius = 5, - TroopUnloadDistGround = 1.5, - TroopUnloadDistHover = 5, + TroopUnloadDistGround = 5, + TroopUnloadDistHover = 1.5, } ------------------------------ @@ -1316,7 +1316,7 @@ CTLD.UnitTypeCapabilities = { --- CTLD class version. -- @field #string version -CTLD.version="1.1.12" +CTLD.version="1.1.13" --- Instantiate a new CTLD. -- @param #CTLD self @@ -3436,7 +3436,7 @@ function CTLD:_UnloadTroops(Group, Unit) randomcoord = Group:GetCoordinate() -- slightly left from us local Angle = (heading+270)%360 - local offset = hoverunload and self.TroopUnloadDistGround or self.TroopUnloadDistHover + local offset = hoverunload and self.TroopUnloadDistHover or self.TroopUnloadDistGround randomcoord:Translate(offset,Angle,nil,true) end local tempcount = 0 From 5df0d60135551c5747bda0c0415b5fd31a65a4ba Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 20 Aug 2024 18:03:18 +0200 Subject: [PATCH 2/6] Smaller Fixes --- Moose Development/Moose/Ops/Airboss.lua | 4 +-- Moose Development/Moose/Utilities/Enums.lua | 35 +++++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 6d67eb0a3..d2adf8aa7 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -18085,7 +18085,7 @@ function AIRBOSS:_MarkCaseZones( _unitName, flare ) self:_GetZoneArcIn( case ):FlareZone( FLARECOLOR.White, 45 ) text = text .. "\n* arc turn in with WHITE flares" self:_GetZoneArcOut( case ):FlareZone( FLARECOLOR.White, 45 ) - text = text .. "\n* arc trun out with WHITE flares" + text = text .. "\n* arc turn out with WHITE flares" end end @@ -18137,7 +18137,7 @@ function AIRBOSS:_MarkCaseZones( _unitName, flare ) self:_GetZoneArcIn( case ):SmokeZone( SMOKECOLOR.Blue, 45 ) text = text .. "\n* arc turn in with BLUE smoke" self:_GetZoneArcOut( case ):SmokeZone( SMOKECOLOR.Blue, 45 ) - text = text .. "\n* arc trun out with BLUE smoke" + text = text .. "\n* arc turn out with BLUE smoke" end end diff --git a/Moose Development/Moose/Utilities/Enums.lua b/Moose Development/Moose/Utilities/Enums.lua index d3b63882f..f47972f7a 100644 --- a/Moose Development/Moose/Utilities/Enums.lua +++ b/Moose Development/Moose/Utilities/Enums.lua @@ -580,12 +580,22 @@ ENUMS.Link16Power = { --- Enums for the STORAGE class for stores - which need to be in "" -- @type ENUMS.Storage -- @type ENUMS.Storage.weapons +-- @type ENUMS.Storage.weapons.missiles +-- @type ENUMS.Storage.weapons.bombs +-- @type ENUMS.Storage.weapons.nurs +-- @type ENUMS.Storage.weapons.containers +-- @type ENUMS.Storage.weapons.droptanks +-- @type ENUMS.Storage.weapons.adapters +-- @type ENUMS.Storage.weapons.torpedoes ENUMS.Storage = { weapons = { missiles = {}, -- Missiles bombs = {}, -- Bombs nurs = {}, -- Rockets and unguided - containers = {}, -- Containers + containers = { + Gazelle = {}, -- Gazelle specifics + CH47 = {}, -- Chinook specifics + }, -- Containers droptanks = {}, -- Droptanks adapters = {}, -- Adapter torpedoes = {}, -- Torpedoes @@ -1148,4 +1158,25 @@ ENUMS.Storage.weapons.bombs.BDU_50LD = "weapons.bombs.BDU_50LD" ENUMS.Storage.weapons.bombs.AGM_62 = "weapons.bombs.AGM_62" ENUMS.Storage.weapons.containers.US_M10_SMOKE_TANK_WHITE = "weapons.containers.{US_M10_SMOKE_TANK_WHITE}" ENUMS.Storage.weapons.missiles.MICA_T = "weapons.missiles.MICA_T" -ENUMS.Storage.weapons.containers.HVAR_rocket = "weapons.containers.HVAR_rocket" +ENUMS.Storage.weapons.containers.HVAR_rocket = "weapons.containers.HVAR_rocket" +-- Gazelle +ENUMS.Storage.weapons.containers.Gazelle.HMP400_100RDS = {4,15,46,1771} +ENUMS.Storage.weapons.containers.Gazelle.HMP400_200RDS = {4,15,46,1770} +ENUMS.Storage.weapons.containers.Gazelle.HMP400_400RDS = {4,15,46,1769} +ENUMS.Storage.weapons.containers.Gazelle.GIAT_M261_AP = {4,15,46,1768} +ENUMS.Storage.weapons.containers.Gazelle.GIAT_M261_SAPHEI = {4,15,46,1767} +ENUMS.Storage.weapons.containers.Gazelle.GIAT_M261_HE = {4,15,46,1766} +ENUMS.Storage.weapons.containers.Gazelle.GIAT_M261_HEAP = {4,15,46,1765} +ENUMS.Storage.weapons.containers.Gazelle.GIAT_M261_APHE = {4,15,46,1764} +ENUMS.Storage.weapons.containers.Gazelle.GAZELLE_IR_DEFLECTOR = {4,15,47,680} +ENUMS.Storage.weapons.containers.Gazelle.GAZELLE_FAS_SANDFILTER = {4,15,47,679} +-- Chinook +ENUMS.Storage.weapons.containers.CH47.CH47_PORT_M60D = {4,15,46,2476} +ENUMS.Storage.weapons.containers.CH47.CH47_STBD_M60D = {4,15,46,2477} +ENUMS.Storage.weapons.containers.CH47.CH47_AFT_M60D = {4,15,46,2478} +ENUMS.Storage.weapons.containers.CH47.CH47_PORT_M134D = {4,15,46,2482} +ENUMS.Storage.weapons.containers.CH47.CH47_STBD_M134D = {4,15,46,2483} +ENUMS.Storage.weapons.containers.CH47.CH47_AFT_M3M = {4,15,46,2484} +ENUMS.Storage.weapons.containers.CH47.CH47_PORT_M240H = {4,15,46,2479} +ENUMS.Storage.weapons.containers.CH47.CH47_STBD_M240H = {4,15,46,2480} +ENUMS.Storage.weapons.containers.CH47.CH47_AFT_M240H = {4,15,46,2481} From 016875d724a86d4338da3038d115c453127b9efe Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 22 Aug 2024 17:14:44 +0200 Subject: [PATCH 3/6] #ENUMS - added a couple of items to ENUMS.Storage.weapons for the Gazelle and CH-47 which do not have a name representation in the object warehouse #UTILS Added function `UTILS.SpawnFARPAndFunctionalStatics()` to spawn a functional FARP with static items (and some options) #UTILS Added VHF Beacon Frequencies for newer maps to avoid overlaps in `UTILS.GenerateVHFrequencies()` --- Moose Development/Moose/Utilities/Enums.lua | 73 +++++++---- Moose Development/Moose/Utilities/Utils.lua | 127 ++++++++++++++++++-- 2 files changed, 168 insertions(+), 32 deletions(-) diff --git a/Moose Development/Moose/Utilities/Enums.lua b/Moose Development/Moose/Utilities/Enums.lua index f47972f7a..28baff3b6 100644 --- a/Moose Development/Moose/Utilities/Enums.lua +++ b/Moose Development/Moose/Utilities/Enums.lua @@ -592,13 +592,12 @@ ENUMS.Storage = { missiles = {}, -- Missiles bombs = {}, -- Bombs nurs = {}, -- Rockets and unguided - containers = { - Gazelle = {}, -- Gazelle specifics - CH47 = {}, -- Chinook specifics - }, -- Containers + containers = {}, -- Containers droptanks = {}, -- Droptanks adapters = {}, -- Adapter torpedoes = {}, -- Torpedoes + Gazelle = {}, -- Gazelle specifics + CH47 = {}, -- Chinook specifics } } @@ -1160,23 +1159,51 @@ ENUMS.Storage.weapons.containers.US_M10_SMOKE_TANK_WHITE = "weapons.containers.{ ENUMS.Storage.weapons.missiles.MICA_T = "weapons.missiles.MICA_T" ENUMS.Storage.weapons.containers.HVAR_rocket = "weapons.containers.HVAR_rocket" -- Gazelle -ENUMS.Storage.weapons.containers.Gazelle.HMP400_100RDS = {4,15,46,1771} -ENUMS.Storage.weapons.containers.Gazelle.HMP400_200RDS = {4,15,46,1770} -ENUMS.Storage.weapons.containers.Gazelle.HMP400_400RDS = {4,15,46,1769} -ENUMS.Storage.weapons.containers.Gazelle.GIAT_M261_AP = {4,15,46,1768} -ENUMS.Storage.weapons.containers.Gazelle.GIAT_M261_SAPHEI = {4,15,46,1767} -ENUMS.Storage.weapons.containers.Gazelle.GIAT_M261_HE = {4,15,46,1766} -ENUMS.Storage.weapons.containers.Gazelle.GIAT_M261_HEAP = {4,15,46,1765} -ENUMS.Storage.weapons.containers.Gazelle.GIAT_M261_APHE = {4,15,46,1764} -ENUMS.Storage.weapons.containers.Gazelle.GAZELLE_IR_DEFLECTOR = {4,15,47,680} -ENUMS.Storage.weapons.containers.Gazelle.GAZELLE_FAS_SANDFILTER = {4,15,47,679} +ENUMS.Storage.weapons.Gazelle.HMP400_100RDS = {4,15,46,1771} +ENUMS.Storage.weapons.Gazelle.HMP400_200RDS = {4,15,46,1770} +ENUMS.Storage.weapons.Gazelle.HMP400_400RDS = {4,15,46,1769} +ENUMS.Storage.weapons.Gazelle.GIAT_M261_AP = {4,15,46,1768} +ENUMS.Storage.weapons.Gazelle.GIAT_M261_SAPHEI = {4,15,46,1767} +ENUMS.Storage.weapons.Gazelle.GIAT_M261_HE = {4,15,46,1766} +ENUMS.Storage.weapons.Gazelle.GIAT_M261_HEAP = {4,15,46,1765} +ENUMS.Storage.weapons.Gazelle.GIAT_M261_APHE = {4,15,46,1764} +ENUMS.Storage.weapons.Gazelle.GAZELLE_IR_DEFLECTOR = {4,15,47,680} +ENUMS.Storage.weapons.Gazelle.GAZELLE_FAS_SANDFILTER = {4,15,47,679} -- Chinook -ENUMS.Storage.weapons.containers.CH47.CH47_PORT_M60D = {4,15,46,2476} -ENUMS.Storage.weapons.containers.CH47.CH47_STBD_M60D = {4,15,46,2477} -ENUMS.Storage.weapons.containers.CH47.CH47_AFT_M60D = {4,15,46,2478} -ENUMS.Storage.weapons.containers.CH47.CH47_PORT_M134D = {4,15,46,2482} -ENUMS.Storage.weapons.containers.CH47.CH47_STBD_M134D = {4,15,46,2483} -ENUMS.Storage.weapons.containers.CH47.CH47_AFT_M3M = {4,15,46,2484} -ENUMS.Storage.weapons.containers.CH47.CH47_PORT_M240H = {4,15,46,2479} -ENUMS.Storage.weapons.containers.CH47.CH47_STBD_M240H = {4,15,46,2480} -ENUMS.Storage.weapons.containers.CH47.CH47_AFT_M240H = {4,15,46,2481} +ENUMS.Storage.weapons.CH47.CH47_PORT_M60D = {4,15,46,2476} +ENUMS.Storage.weapons.CH47.CH47_STBD_M60D = {4,15,46,2477} +ENUMS.Storage.weapons.CH47.CH47_AFT_M60D = {4,15,46,2478} +ENUMS.Storage.weapons.CH47.CH47_PORT_M134D = {4,15,46,2482} +ENUMS.Storage.weapons.CH47.CH47_STBD_M134D = {4,15,46,2483} +ENUMS.Storage.weapons.CH47.CH47_AFT_M3M = {4,15,46,2484} +ENUMS.Storage.weapons.CH47.CH47_PORT_M240H = {4,15,46,2479} +ENUMS.Storage.weapons.CH47.CH47_STBD_M240H = {4,15,46,2480} +ENUMS.Storage.weapons.CH47.CH47_AFT_M240H = {4,15,46,2481} + + +--- +-- @type ENUMS.FARPType +-- @field #string FARP +-- @field #string INVISIBLE +-- @field #string HELIPADSINGLE +-- @field #string PADSINGLE +ENUMS.FARPType = { + FARP = "FARP", + INVISIBLE = "INVISIBLE", + HELIPADSINGLE = "HELIPADSINGLE", + PADSINGLE = "PADSINGLE", +} + + +--- +-- @type ENUMS.FARPObjectTypeNamesAndShape +-- @field #string FARP +-- @field #string INVISIBLE +-- @field #string HELIPADSINGLE +-- @field #string PADSINGLE +ENUMS.FARPObjectTypeNamesAndShape ={ + [ENUMS.FARPType.FARP] = { TypeName="FARP", ShapeName="FARPS"}, + [ENUMS.FARPType.INVISIBLE] = { TypeName="Invisible FARP", ShapeName="invisiblefarp"}, + [ENUMS.FARPType.HELIPADSINGLE] = { TypeName="SINGLE_HELIPAD", ShapeName="FARP"}, + [ENUMS.FARPType.PADSINGLE] = { TypeName="FARP_SINGLE_01", ShapeName="FARP_SINGLE_01"}, +} diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index ef92696e6..dc8064569 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -2350,17 +2350,19 @@ end --- Function to generate valid VHF frequencies in kHz for radio beacons (FM). -- @return #table VHFrequencies function UTILS.GenerateVHFrequencies() - + -- known and sorted map-wise NDBs in kHz local _skipFrequencies = { - 214,274,291.5,295,297.5, - 300.5,304,305,307,309.5,311,312,312.5,316, - 320,324,328,329,330,332,336,337, - 342,343,348,351,352,353,358, - 363,365,368,372.5,374, - 380,381,384,385,389,395,396, - 414,420,430,432,435,440,450,455,462,470,485, - 507,515,520,525,528,540,550,560,570,577,580, + 214,243,264,273,274,288,291.5,295,297.5, + 300.5,304,305,307,309.5,310,311,312,312.5,316,317, + 320,323,324,325,326,328,329,330,332,335,336,337, + 340,342,343,346,348,351,352,353,358, + 360,363,364,365,368,372.5,373,374, + 380,381,384,385,387,389,391,395,396,399, + 403,404,410,412,414,418,420,423, + 430,432,435,440,445, + 450,455,462,470,485,490, + 507,515,520,525,528,540,550,560,563,570,577,580,595, 602,625,641,662,670,680,682,690, 705,720,722,730,735,740,745,750,770,795, 822,830,862,866, @@ -4090,3 +4092,110 @@ function UTILS.LCGRandom() UTILS.lcg.seed = (UTILS.lcg.a * UTILS.lcg.seed + UTILS.lcg.c) % UTILS.lcg.m return UTILS.lcg.seed / UTILS.lcg.m end + +--- Spawns a new FARP of a defined type and coalition and functional statics (fuel depot, ammo storage, tent, windsock) around that FARP to make it operational. +-- Adds vehicles from template if given. Fills the FARP warehouse with liquids and known materiels. +-- References: [DCS Forum Topic](https://forum.dcs.world/topic/282989-farp-equipment-to-run-it) +-- @param #string Name Name of this FARP installation. Must be unique. +-- @param Core.Point#COORDINATE Coordinate Where to spawn the FARP. +-- @param #string FARPType Type of FARP, can be one of the known types ENUMS.FARPType.FARP, ENUMS.FARPType.INVISIBLE, ENUMS.FARPType.HELIPADSINGLE, ENUMS.FARPType.PADSINGLE. Defaults to ENUMS.FARPType.FARP. +-- @param #number Coalition Coalition of this FARP, i.e. coalition.side.BLUE or coalition.side.RED, defaults to coalition.side.BLUE. +-- @param #number Country Country of this FARP, defaults to country.id.USA (blue) or country.id.RUSSIA (red). +-- @param #number CallSign Callsign of the FARP ATC, defaults to CALLSIGN.FARP.Berlin. +-- @param #number Frequency Frequency of the FARP ATC Radio, defaults to 127.5 (MHz). +-- @param #number Modulation Modulation of the FARP ATC Radio, defaults to radio.modulation.AM. +-- @param #number ADF ADF Beacon (FM) Frequency in KHz, e.g. 428. If not nil, creates an VHF/FM ADF Beacon for this FARP. Requires a sound called "beacon.ogg" to be in the mission (trigger "sound to" ...) +-- @param #number SpawnRadius Radius of the FARP, i.e. where the FARP objects will be placed in meters, not more than 150m away. Defaults to 100. +-- @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. +-- @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) + + -- Set Defaults + local farplocation = Coordinate + local farptype = FARPType or ENUMS.FARPType.FARP + local Coalition = Coalition or coalition.side.BLUE + local callsign = CallSign or CALLSIGN.FARP.Berlin + local freq = Frequency or 127.5 + local mod = Modulation or radio.modulation.AM + local radius = SpawnRadius or 100 + if radius < 0 or radius > 150 then radius = 100 end + local liquids = Liquids or 10 + liquids = liquids * 1000 -- tons to kg + local equip = Equipment or 10 + local statictypes = ENUMS.FARPObjectTypeNamesAndShape[farptype] or {TypeName="FARP", ShapeName="FARPS"} + local STypeName = statictypes.TypeName + local SShapeName = statictypes.ShapeName + local Country = Country or (Coalition == coalition.side.BLUE and country.id.USA or country.id.RUSSIA) + local ReturnObjects = {} + + -- Spawn FARP + local newfarp = SPAWNSTATIC:NewFromType(STypeName,"Heliports",Country) -- "Invisible FARP" "FARP" + newfarp:InitShape(SShapeName) -- "invisiblefarp" "FARPS" + newfarp:InitFARP(callsign,freq,freq) + local spawnedfarp = newfarp:SpawnFromCoordinate(farplocation,0,Name) + table.insert(ReturnObjects,spawnedfarp) + -- Spawn Objects + local FARPStaticObjectsNato = { + ["FUEL"] = { TypeName = "FARP Fuel Depot", ShapeName = "GSM Rus", Category = "Fortifications"}, + ["AMMO"] = { TypeName = "FARP Ammo Dump Coating", ShapeName = "SetkaKP", Category = "Fortifications"}, + ["TENT"] = { TypeName = "FARP Tent", ShapeName = "PalatkaB", Category = "Fortifications"}, + ["WINDSOCK"] = { TypeName = "Windsock", ShapeName = "H-Windsock_RW", Category = "Fortifications"}, + } + + local farpobcount = 0 + for _name,_object in pairs(FARPStaticObjectsNato) do + local objloc = farplocation:Translate(100,farpobcount*30) + local heading = objloc:HeadingTo(farplocation) + local newobject = SPAWNSTATIC:NewFromType(_object.TypeName,_object.Category,Country) + newobject:InitShape(_object.ShapeName) + newobject:InitHeading(heading) + newobject:SpawnFromCoordinate(objloc,farpobcount*30,_name.." - "..Name) + table.insert(ReturnObjects,newobject) + farpobcount = farpobcount + 1 + end + + -- Vehicle if any + if VehicleTemplate and type(VehicleTemplate) == "string" then + local vcoordinate = farplocation:Translate(100,farpobcount*30) + local heading = vcoordinate:HeadingTo(farplocation) + local vehicles = SPAWN:NewWithAlias(VehicleTemplate,"FARP Vehicles - "..Name) + vehicles:InitGroupHeading(heading) + vehicles:InitCountry(Country) + vehicles:InitCoalition(Coalition) + vehicles:InitDelayOff() + local spawnedvehicle = vehicles:SpawnFromCoordinate(vcoordinate) + table.insert(ReturnObjects,spawnedvehicle) + end + + local newWH = STORAGE:New(Name) + if liquids and liquids > 0 then + -- Storage fill-up + newWH:SetLiquid(STORAGE.Liquid.DIESEL,liquids) -- kgs to tons + newWH:SetLiquid(STORAGE.Liquid.GASOLINE,liquids) + newWH:SetLiquid(STORAGE.Liquid.JETFUEL,liquids) + newWH:SetLiquid(STORAGE.Liquid.MW50,liquids) + end + + if equip and equip > 0 then + for cat,nitem in pairs(ENUMS.Storage.weapons) do + for name,item in pairs(nitem) do + newWH:SetItem(item,equip) + end + end + end + + local ADFName + if ADF and type(ADF) == "number" then + local ADFFreq = ADF*1000 -- KHz to Hz + local Sound = "l10n/DEFAULT/beacon.ogg" + local vec3 = farplocation:GetVec3() + ADFName = Name .. " ADF "..tostring(ADF).."KHz" + --BASE:I(string.format("Adding FARP Beacon %d KHz Name %s",ADF,ADFName)) + trigger.action.radioTransmission(Sound, vec3, 0, true, ADFFreq, 250, ADFName) + end + + return ReturnObjects, ADFName +end From 0d481afa16d612c5612ee0307f1d897d46b54d39 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 22 Aug 2024 18:26:34 +0200 Subject: [PATCH 4/6] #SET_GROUP - small fix for FilterPrefixes compute --- Moose Development/Moose/Core/Set.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index 918399108..2fc1e19a3 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -2027,7 +2027,7 @@ do local MGroupPrefix = false for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do --self:I( { "Prefix:", MGroup:GetName(), GroupPrefix } ) - if string.find( string.lower(MGroup:GetName()), string.lower(GroupPrefix), 1 ) or string.find( string.lower(MGroup:GetName()), string.lower(GroupPrefix), 1, true ) then + if string.find(MGroup:GetName(), string.gsub(GroupPrefix,"-","%%-"),1) then MGroupPrefix = true end end From c58a954d18cb7857cda666b719f08fa5c81ea41f Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 23 Aug 2024 12:44:17 +0200 Subject: [PATCH 5/6] #CTLD * Fix for spawning the correct number of crates on inject * Simplified example docu section 7 on how to build a FARP * Some prep work for additional stuff --- Moose Development/Moose/Ops/CTLD.lua | 249 ++++++++++++++------------- 1 file changed, 130 insertions(+), 119 deletions(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index adfb6436a..720f3d854 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -26,6 +26,11 @@ -- Last Update Aug 2024 + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +-- TODO CTLD_CARGO +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + do ------------------------------------------------------ @@ -47,6 +52,9 @@ do -- @field #boolean DontShowInMenu Show this item in menu or not. -- @field Core.Zone#ZONE Location Location (if set) where to get this cargo item. -- @field #table ResourceMap Resource Map information table if it has been set for static cargo items. +-- @field #string StaticShape Individual shape if set. +-- @field #string StaticType Individual type if set. +-- @field #list<#string> TypeNames Table of unit types able to pick this cargo up. -- @extends Core.Base#BASE --- @@ -126,6 +134,9 @@ CTLD_CARGO = { self.Subcategory = Subcategory or "Other" self.DontShowInMenu = DontShowInMenu or false self.ResourceMap = nil + self.StaticType = nil -- "container_cargo" + self.StaticShape = nil + self.TypeNames = nil if type(Location) == "string" then Location = ZONE:New(Location) end @@ -133,6 +144,30 @@ CTLD_CARGO = { return self end + --- Add specific static type and shape to this CARGO. + -- @param #CTLD_CARGO self + -- @param #string TypeName + -- @param #string ShapeName + -- @return #CTLD_CARGO self + function CTLD_CARGO:SetStaticTypeAndShape(TypeName,ShapeName) + self.StaticType = TypeName or "container_cargo" + self.StaticShape = ShapeName + return self + end + + --- Add specific unit types to this CARGO (restrict what types can pick this up). + -- @param #CTLD_CARGO self + -- @param #string UnitTypes Unit type name, can also be a #list<#string> table of unit type names. + -- @return #CTLD_CARGO self + function CTLD_CARGO:AddUnitTypeName(UnitTypes) + if not self.TypeNames then self.TypeNames = {} end + if type(UnitTypes) ~= "table" then UnitTypes = {UnitTypes} end + for _,_singletype in pairs(UnitTypes or {}) do + self.TypeNames[_singletype]=_singletype + end + return self + end + --- Add Resource Map information table -- @param #CTLD_CARGO self -- @param #table ResourceMap @@ -1087,101 +1122,55 @@ do -- -- my_ctld:AddCratesCargo("FARP",{"FOB"},CTLD_CARGO.Enum.FOB,2) -- --- Also, you need to have **all statics with the fitting names** as per the script in your mission already, as we're going to copy them, and a template --- for FARP vehicles, so -- services are goin to work (e.g. for the blue side: an unarmed humvee, two trucks and a fuel truck. Optionally add a fire fighter). --- --- The following code will build a FARP at the coordinate the FOB was dropped and built: +-- The following code will build a FARP at the coordinate the FOB was dropped and built (the UTILS function used below **does not** need a template for the statics): -- --- -- FARP Radio. First one has 130AM, next 131 and for forth --- local FARPFreq = 130 --- local FARPName = 1 -- numbers 1..10 --- --- local FARPClearnames = { --- [1]="London", --- [2]="Dallas", --- [3]="Paris", --- [4]="Moscow", --- [5]="Berlin", --- [6]="Rome", --- [7]="Madrid", --- [8]="Warsaw", --- [9]="Dublin", --- [10]="Perth", --- } --- --- function BuildAFARP(Coordinate) --- local coord = Coordinate -- Core.Point#COORDINATE --- --- local FarpName = ((FARPName-1)%10)+1 --- local FName = FARPClearnames[FarpName] --- --- FARPFreq = FARPFreq + 1 --- FARPName = FARPName + 1 +-- -- FARP Radio. First one has 130AM name London, next 131 name Dallas, and so forth. +-- local FARPFreq = 129 +-- local FARPName = 1 --numbers 1..10 +-- +-- local FARPClearnames = { +-- [1]="London", +-- [2]="Dallas", +-- [3]="Paris", +-- [4]="Moscow", +-- [5]="Berlin", +-- [6]="Rome", +-- [7]="Madrid", +-- [8]="Warsaw", +-- [9]="Dublin", +-- [10]="Perth", +-- } +-- +-- function BuildAFARP(Coordinate) +-- local coord = Coordinate --Core.Point#COORDINATE -- --- -- Create a SPAWNSTATIC object from a template static FARP object. --- local SpawnStaticFarp=SPAWNSTATIC:NewFromStatic("Static Invisible FARP-1", country.id.USA) --- --- -- Spawning FARPs is special in DCS. Therefore, we need to specify that this is a FARP. We also set the callsign and the frequency. --- SpawnStaticFarp:InitFARP(FARPName, FARPFreq, 0) --- SpawnStaticFarp:InitDead(false) --- --- -- Spawn FARP --- local ZoneSpawn = ZONE_RADIUS:New("FARP "..FName,Coordinate:GetVec2(),160,false) --- local Heading = 0 --- local FarpBerlin=SpawnStaticFarp:SpawnFromZone(ZoneSpawn, Heading, "FARP "..FName) --- --- -- ATC and services - put them 125m from the center of the zone towards North --- local FarpVehicles = SPAWN:NewWithAlias("FARP Vehicles Template","FARP "..FName.." Technicals") --- FarpVehicles:InitHeading(180) --- local FarpVCoord = coord:Translate(125,0) --- FarpVehicles:SpawnFromCoordinate(FarpVCoord) --- --- -- We will put the rest of the statics in a nice circle around the center --- local base = 330 --- local delta = 30 --- --- local windsock = SPAWNSTATIC:NewFromStatic("Static Windsock-1",country.id.USA) --- local sockcoord = coord:Translate(125,base) --- windsock:SpawnFromCoordinate(sockcoord,Heading,"Windsock "..FName) --- base=base-delta --- --- local fueldepot = SPAWNSTATIC:NewFromStatic("Static FARP Fuel Depot-1",country.id.USA) --- local fuelcoord = coord:Translate(125,base) --- fueldepot:SpawnFromCoordinate(fuelcoord,Heading,"Fueldepot "..FName) --- base=base-delta --- --- local ammodepot = SPAWNSTATIC:NewFromStatic("Static FARP Ammo Storage-2-1",country.id.USA) --- local ammocoord = coord:Translate(125,base) --- ammodepot:SpawnFromCoordinate(ammocoord,Heading,"Ammodepot "..FName) --- base=base-delta --- --- local CommandPost = SPAWNSTATIC:NewFromStatic("Static FARP Command Post-1",country.id.USA) --- local CommandCoord = coord:Translate(125,base) --- CommandPost:SpawnFromCoordinate(CommandCoord,Heading,"Command Post "..FName) --- base=base-delta --- --- local Tent1 = SPAWNSTATIC:NewFromStatic("Static FARP Tent-11",country.id.USA) --- local Tent1Coord = coord:Translate(125,base) --- Tent1:SpawnFromCoordinate(Tent1Coord,Heading,"Command Tent "..FName) --- base=base-delta --- --- local Tent2 = SPAWNSTATIC:NewFromStatic("Static FARP Tent-11",country.id.USA) --- local Tent2Coord = coord:Translate(125,base) --- Tent2:SpawnFromCoordinate(Tent2Coord,Heading,"Command Tent2 "..FName) --- --- -- add a loadzone to CTLD --- my_ctld:AddCTLDZone("FARP "..FName,CTLD.CargoZoneType.LOAD,SMOKECOLOR.Blue,true,true) --- local m = MESSAGE:New(string.format("FARP %s in operation!",FName),15,"CTLD"):ToBlue() --- end +-- local FarpNameNumber = ((FARPName-1)%10)+1 -- make sure 11 becomes 1 etc +-- local FName = FARPClearnames[FarpNameNumber] -- get clear namee -- --- function my_ctld:OnAfterCratesBuild(From,Event,To,Group,Unit,Vehicle) --- local name = Vehicle:GetName() --- if string.match(name,"FOB",1,true) then --- local Coord = Vehicle:GetCoordinate() --- Vehicle:Destroy(false) --- BuildAFARP(Coord) --- end --- end +-- FARPFreq = FARPFreq + 1 +-- FARPName = FARPName + 1 +-- +-- FName = FName .. " FAT COW "..tostring(FARPFreq).."AM" -- make name unique +-- +-- -- Get a Zone for loading +-- local ZoneSpawn = ZONE_RADIUS:New("FARP "..FName,Coordinate:GetVec2(),150,false) +-- +-- -- Spawn a FARP with our little helper and fill it up with resources (10t fuel each type, 10 pieces of each known equipment) +-- UTILS.SpawnFARPAndFunctionalStatics(FName,Coordinate,ENUMS.FARPType.INVISIBLE,my_ctld.coalition,country.id.USA,FarpNameNumber,FARPFreq,radio.modulation.AM,nil,nil,nil,10,10) +-- +-- -- add a loadzone to CTLD +-- my_ctld:AddCTLDZone("FARP "..FName,CTLD.CargoZoneType.LOAD,SMOKECOLOR.Blue,true,true) +-- local m = MESSAGE:New(string.format("FARP %s in operation!",FName),15,"CTLD"):ToBlue() +-- end +-- +-- function my_ctld:OnAfterCratesBuild(From,Event,To,Group,Unit,Vehicle) +-- local name = Vehicle:GetName() +-- if string.find(name,"FOB",1,true) then +-- local Coord = Vehicle:GetCoordinate() +-- Vehicle:Destroy(false) +-- BuildAFARP(Coord) +-- end +-- end -- -- -- @field #CTLD @@ -1311,7 +1300,7 @@ CTLD.UnitTypeCapabilities = { ["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="OH58D", crates=false, troops=false, cratelimit = 0, trooplimit = 0, length = 14, cargoweightlimit = 400}, - ["CH-47Fbl1"] = {type="CH-47Fbl1", crates=true, troops=true, cratelimit = 4, trooplimit = 31, length = 20, cargoweightlimit = 8000}, + ["CH-47Fbl1"] = {type="CH-47Fbl1", crates=true, troops=true, cratelimit = 4, trooplimit = 31, length = 20, cargoweightlimit = 10800}, } --- CTLD class version. @@ -2724,31 +2713,33 @@ function CTLD:InjectStatics(Zone, Cargo, RandomCoord) local cratename = cargotype:GetName() local cgotype = cargotype:GetType() local cgomass = cargotype:GetMass() - local cratealias = string.format("%s-%s-%d", cratename, cratetemplate, math.random(1,100000)) - local isstatic = false - if cgotype == CTLD_CARGO.Enum.STATIC then - cratetemplate = cargotype:GetTemplates() - isstatic = true + local cratenumber = cargotype:GetCratesNeeded() or 1 + for i=1,cratenumber do + local cratealias = string.format("%s-%s-%d", cratename, cratetemplate, math.random(1,100000)) + local isstatic = false + if cgotype == CTLD_CARGO.Enum.STATIC then + cratetemplate = cargotype:GetTemplates() + isstatic = true + end + local basetype = self.basetype or "container_cargo" + if isstatic then + basetype = cratetemplate + end + self.CrateCounter = self.CrateCounter + 1 + local spawnstatic = SPAWNSTATIC:NewFromType(basetype,"Cargos",self.cratecountry) + :InitCargoMass(cgomass) + :InitCargo(self.enableslingload) + :InitCoordinate(cratecoord) + if isstatic then + local map = cargotype:GetStaticResourceMap() + spawnstatic.TemplateStaticUnit.resourcePayload = map + end + self.Spawned_Crates[self.CrateCounter] = spawnstatic:Spawn(270,cratealias) + local templ = cargotype:GetTemplates() + local sorte = cargotype:GetType() + cargotype.Positionable = self.Spawned_Crates[self.CrateCounter] + table.insert(self.Spawned_Cargo, cargotype) end - local basetype = self.basetype or "container_cargo" - if isstatic then - basetype = cratetemplate - end - self.CrateCounter = self.CrateCounter + 1 - local spawnstatic = SPAWNSTATIC:NewFromType(basetype,"Cargos",self.cratecountry) - :InitCargoMass(cgomass) - :InitCargo(self.enableslingload) - :InitCoordinate(cratecoord) - if isstatic then - local map = cargotype:GetStaticResourceMap() - spawnstatic.TemplateStaticUnit.resourcePayload = map - end - self.Spawned_Crates[self.CrateCounter] = spawnstatic:Spawn(270,cratealias) - local templ = cargotype:GetTemplates() - local sorte = cargotype:GetType() - --self.CargoCounter = self.CargoCounter + 1 - cargotype.Positionable = self.Spawned_Crates[self.CrateCounter] - table.insert(self.Spawned_Cargo, cargotype) return self end @@ -4221,7 +4212,11 @@ end -- @param #string SubCategory Name of sub-category (optional). -- @param #boolean DontShowInMenu (optional) If set to "true" this won't show up in the menu. -- @param Core.Zone#ZONE Location (optional) If set, the cargo item is **only** available here. Can be a #ZONE object or the name of a zone as #string. -function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location) +-- @param #string UnitTypes Unit type names (optional). If set, only these unit types can pick up the cargo, e.g. "UH-1H" or {"UH-1H","OH-58D"} +-- @param #string TypeName Static type name (optional). If set, spawn cargo crate with an alternate type shape. +-- @param #string ShapeName Static shape name (optional). If set, spawn cargo crate with an alternate type sub-shape. +-- @return #CTLD self +function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location,UnitTypes,TypeName,ShapeName) self:T(self.lid .. " AddCratesCargo") if not self:_CheckTemplates(Templates) then self:E(self.lid .. "Crates Cargo for " .. Name .. " has missing template(s)!" ) @@ -4230,6 +4225,12 @@ function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,Sub self.CargoCounter = self.CargoCounter + 1 -- Crates are not directly loadable local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Templates,Type,false,false,NoCrates,nil,nil,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location) + if UnitTypes then + cargo:AddUnitTypeName(UnitTypes) + end + if TypeName then + cargo:SetStaticTypeAndShape(TypeName,ShapeName) + end table.insert(self.Cargo_Crates,cargo) return self end @@ -4293,7 +4294,11 @@ end -- @param #string SubCategory Name of the sub-category (optional). -- @param #boolean DontShowInMenu (optional) If set to "true" this won't show up in the menu. -- @param Core.Zone#ZONE Location (optional) If set, the cargo item is **only** available here. Can be a #ZONE object or the name of a zone as #string. -function CTLD:AddCratesRepair(Name,Template,Type,NoCrates, PerCrateMass,Stock,SubCategory,DontShowInMenu,Location) +-- @param #string UnitTypes Unit type names (optional). If set, only these unit types can pick up the cargo, e.g. "UH-1H" or {"UH-1H","OH-58D"} +-- @param #string TypeName Static type name (optional). If set, spawn cargo crate with an alternate type shape. +-- @param #string ShapeName Static shape name (optional). If set, spawn cargo crate with an alternate type sub-shape. +-- @return #CTLD self +function CTLD:AddCratesRepair(Name,Template,Type,NoCrates, PerCrateMass,Stock,SubCategory,DontShowInMenu,Location,UnitTypes,TypeName,ShapeName) self:T(self.lid .. " AddCratesRepair") if not self:_CheckTemplates(Template) then self:E(self.lid .. "Repair Cargo for " .. Name .. " has a missing template!" ) @@ -4302,6 +4307,12 @@ function CTLD:AddCratesRepair(Name,Template,Type,NoCrates, PerCrateMass,Stock,Su self.CargoCounter = self.CargoCounter + 1 -- Crates are not directly loadable local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Template,Type,false,false,NoCrates,nil,nil,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location) + if UnitTypes then + cargo:AddUnitTypeName(UnitTypes) + end + if TypeName then + cargo:SetStaticTypeAndShape(TypeName,ShapeName) + end table.insert(self.Cargo_Crates,cargo) return self end From 37d5b6a0fc97886b70945e62599085bde9ac96a7 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 23 Aug 2024 13:55:18 +0200 Subject: [PATCH 6/6] #Add'l storage items --- Moose Development/Moose/Utilities/Enums.lua | 27 ++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Utilities/Enums.lua b/Moose Development/Moose/Utilities/Enums.lua index 28baff3b6..c8cb5f0b6 100644 --- a/Moose Development/Moose/Utilities/Enums.lua +++ b/Moose Development/Moose/Utilities/Enums.lua @@ -587,6 +587,10 @@ ENUMS.Link16Power = { -- @type ENUMS.Storage.weapons.droptanks -- @type ENUMS.Storage.weapons.adapters -- @type ENUMS.Storage.weapons.torpedoes +-- @type ENUMS.Storage.weapons.Gazelle +-- @type ENUMS.Storage.weapons.CH47 +-- @type ENUMS.Storage.weapons.OH58 +-- @type ENUMS.Storage.weapons.UH1H ENUMS.Storage = { weapons = { missiles = {}, -- Missiles @@ -598,6 +602,8 @@ ENUMS.Storage = { torpedoes = {}, -- Torpedoes Gazelle = {}, -- Gazelle specifics CH47 = {}, -- Chinook specifics + OH58 = {}, -- Kiowa specifics + UH1H = {}, -- Huey specifics } } @@ -1179,7 +1185,26 @@ ENUMS.Storage.weapons.CH47.CH47_AFT_M3M = {4,15,46,2484} ENUMS.Storage.weapons.CH47.CH47_PORT_M240H = {4,15,46,2479} ENUMS.Storage.weapons.CH47.CH47_STBD_M240H = {4,15,46,2480} ENUMS.Storage.weapons.CH47.CH47_AFT_M240H = {4,15,46,2481} - +-- Huey +ENUMS.Storage.weapons.UH1H.M134_MiniGun_Right = {4,15,46,161} +ENUMS.Storage.weapons.UH1H.M134_MiniGun_Left = {4,15,46,160} +ENUMS.Storage.weapons.UH1H.M134_MiniGun_Right_Door = {4,15,46,175} +ENUMS.Storage.weapons.UH1H.M60_MG_Right_Door = {4,15,46,177} +ENUMS.Storage.weapons.UH1H.M134_MiniGun_Left_Door = {4,15,46,174} +ENUMS.Storage.weapons.UH1H.M60_MG_Left_Door = {4,15,46,176} +-- Kiowa +ENUMS.Storage.weapons.OH58.FIM92 = {4,4,7,446} +ENUMS.Storage.weapons.OH58.MG_M3P100 = {4,15,46,2578} +ENUMS.Storage.weapons.OH58.MG_M3P200 = {4,15,46,2577} +ENUMS.Storage.weapons.OH58.MG_M3P300 = {4,15,46,2576} +ENUMS.Storage.weapons.OH58.MG_M3P400 = {4,15,46,2575} +ENUMS.Storage.weapons.OH58.MG_M3P500 = {4,15,46,2574} +ENUMS.Storage.weapons.OH58.Smk_Grenade_Blue = {4,5,9,484} +ENUMS.Storage.weapons.OH58.Smk_Grenade_Green = {4,5,9,485} +ENUMS.Storage.weapons.OH58.Smk_Grenade_Red = {4,5,9,483} +ENUMS.Storage.weapons.OH58.Smk_Grenade_Violet = {4,5,9,486} +ENUMS.Storage.weapons.OH58.Smk_Grenade_White = {4,5,9,488} +ENUMS.Storage.weapons.OH58.Smk_Grenade_Yellow = {4,5,9,487} --- -- @type ENUMS.FARPType