diff --git a/Moose Development/Moose/Core/Spawn.lua b/Moose Development/Moose/Core/Spawn.lua index f58937439..8bffbc2e0 100644 --- a/Moose Development/Moose/Core/Spawn.lua +++ b/Moose Development/Moose/Core/Spawn.lua @@ -1667,6 +1667,9 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth ) -- If RandomizeUnits, then Randomize the formation at the start point. if self.SpawnRandomizeUnits then + if self.SpawnRandomizePosition then + PointVec3 = COORDINATE:New( SpawnTemplate.x, SpawnTemplate.route.points[1].alt, SpawnTemplate.y ) + end for UnitID = 1, #SpawnTemplate.units do local RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius ) if (SpawnZone) then diff --git a/Moose Development/Moose/Functional/Range.lua b/Moose Development/Moose/Functional/Range.lua index 6c0143823..0ec94102b 100644 --- a/Moose Development/Moose/Functional/Range.lua +++ b/Moose Development/Moose/Functional/Range.lua @@ -109,7 +109,6 @@ -- @field Core.Menu#MENU_MISSION menuF10root Specific user defined root F10 menu. -- @field #number ceilingaltitude Range ceiling altitude in ft MSL. Aircraft above this altitude are not considered to be in the range. Default is 20000 ft. -- @field #boolean ceilingenabled Range has a ceiling and is not unlimited. Default is false. - -- @extends Core.Fsm#FSM --- *Don't only practice your art, but force your way into its secrets; art deserves that, for it and knowledge can raise man to the Divine.* - Ludwig van Beethoven @@ -1271,6 +1270,9 @@ function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume, self.controlmsrs:SetCoalition(Coalition or coalition.side.BLUE) self.controlmsrs:SetLabel("RANGEC") self.controlmsrs:SetVolume(Volume or 1.0) + if self.rangezone then + self.controlmsrs:SetCoordinate(self.rangezone:GetCoordinate()) + end self.controlsrsQ = MSRSQUEUE:New("CONTROL") self.instructmsrs=MSRS:New(PathToSRS or MSRS.path, Frequency or 305, Modulation or radio.modulation.AM) @@ -1278,6 +1280,9 @@ function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume, self.instructmsrs:SetCoalition(Coalition or coalition.side.BLUE) self.instructmsrs:SetLabel("RANGEI") self.instructmsrs:SetVolume(Volume or 1.0) + if self.rangezone then + self.instructmsrs:SetCoordinate(self.rangezone:GetCoordinate()) + end self.instructsrsQ = MSRSQUEUE:New("INSTRUCT") if PathToGoogleKey then @@ -1316,8 +1321,13 @@ function RANGE:SetSRSRangeControl( frequency, modulation, voice, culture, gender self.rangecontrol = true if relayunitname then local unit = UNIT:FindByName(relayunitname) - local Coordinate = unit:GetCoordinate() - self.rangecontrolrelayname = relayunitname + if unit then + local Coordinate = unit:GetCoordinate() + self.rangecontrolrelayname = relayunitname + self.controlmsrs:SetCoordinate(Coordinate) + else + MESSAGE:New("RANGE: Control Relay Unit "..relayunitname.." not found!",15,"ERROR"):ToAllIf(self.Debug):ToLog() + end end return self end @@ -1345,9 +1355,13 @@ function RANGE:SetSRSRangeInstructor( frequency, modulation, voice, culture, gen self.instructor = true if relayunitname then local unit = UNIT:FindByName(relayunitname) - local Coordinate = unit:GetCoordinate() - self.instructmsrs:SetCoordinate(Coordinate) - self.instructorrelayname = relayunitname + if unit then + local Coordinate = unit:GetCoordinate() + self.instructmsrs:SetCoordinate(Coordinate) + self.instructorrelayname = relayunitname + else + MESSAGE:New("RANGE: Instructor Relay Unit "..relayunitname.." not found!",15,"ERROR"):ToAllIf(self.Debug):ToLog() + end end return self end diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index 873b68619..980e908c5 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -4222,25 +4222,27 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition, local function PopulateStorage(Name,liquids,equip,airframes) 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) + if newWH then + 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 - end - - if airframes and airframes > 0 then - for typename in pairs (CSAR.AircraftType) do - newWH:SetItem(typename,airframes) + + if airframes and airframes > 0 then + for typename in pairs (CSAR.AircraftType) do + newWH:SetItem(typename,airframes) + end end end end @@ -4319,8 +4321,6 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition, } -- Create BIRTH event. world.onEvent(Event) - - PopulateStorage(Name.."-1",liquids,equip,airframes) else -- Spawn FARP local newfarp = SPAWNSTATIC:NewFromType(STypeName,"Heliports",Country) -- "Invisible FARP" "FARP" @@ -4328,10 +4328,11 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition, newfarp:InitFARP(callsign,freq,mod,DynamicSpawns,HotStart) local spawnedfarp = newfarp:SpawnFromCoordinate(farplocation,0,Name) table.insert(ReturnObjects,spawnedfarp) - - PopulateStorage(Name,liquids,equip,airframes) + end - + + PopulateStorage(Name,liquids,equip,airframes) + -- Spawn Objects local FARPStaticObjectsNato = { ["FUEL"] = { TypeName = "FARP Fuel Depot", ShapeName = "GSM Rus", Category = "Fortifications"},