Merge branch 'develop' into FF/Ops

This commit is contained in:
Frank
2025-11-23 20:42:00 +01:00
6 changed files with 937 additions and 681 deletions
+1 -1
View File
@@ -2037,7 +2037,7 @@ function AUFTRAG:NewRESCUEHELO(Carrier)
-- Mission options: -- Mission options:
mission.missionTask=ENUMS.MissionTask.NOTHING mission.missionTask=ENUMS.MissionTask.NOTHING
mission.missionFraction=0.5 mission.missionFraction=0.9
mission.optionROE=ENUMS.ROE.WeaponHold mission.optionROE=ENUMS.ROE.WeaponHold
mission.optionROT=ENUMS.ROT.NoReaction mission.optionROT=ENUMS.ROT.NoReaction
+34 -7
View File
@@ -4303,6 +4303,26 @@ function OPSGROUP:_UpdateTask(Task, Mission)
if Task.dcstask.id==AUFTRAG.SpecialTask.FORMATION then if Task.dcstask.id==AUFTRAG.SpecialTask.FORMATION then
if Mission.type == AUFTRAG.Type.RESCUEHELO then
self:T("**********")
self:T("** RESCUEHELO USED")
self:T("**********")
local param=Task.dcstask.params
local followUnit=UNIT:FindByName(param.unitname)
local helogroupname = self:GetGroup():GetName()
Task.formation = RESCUEHELO:New(followUnit,helogroupname)
Task.formation:SetRespawnOnOff(false)
Task.formation.respawninair=false
Task.formation:SetTakeoffCold()
Task.formation:SetHomeBase(followUnit)
Task.formation.helo = self:GetGroup()
-- Start formation FSM.
Task.formation:Start()
if self:IsFlightgroup() then
self:SetDespawnAfterLanding()
end
else
-- Set of group(s) to follow Mother. -- Set of group(s) to follow Mother.
local followSet=SET_GROUP:New():AddGroup(self.group) local followSet=SET_GROUP:New():AddGroup(self.group)
@@ -4320,11 +4340,13 @@ function OPSGROUP:_UpdateTask(Task, Mission)
Task.formation:SetFollowTimeInterval(param.dtFollow) Task.formation:SetFollowTimeInterval(param.dtFollow)
-- Formation mode. -- Formation mode.
Task.formation:SetFlightModeFormation(self.group) --Task.formation:SetFlightModeFormation(self.group)
-- Start formation FSM. -- Start formation FSM.
Task.formation:Start() Task.formation:Start()
end
elseif Task.dcstask.id==AUFTRAG.SpecialTask.PATROLZONE then elseif Task.dcstask.id==AUFTRAG.SpecialTask.PATROLZONE then
--- ---
@@ -8020,11 +8042,16 @@ function OPSGROUP:onafterDead(From, Event, To)
-- Get asset. -- Get asset.
local asset=self.legion:GetAssetByName(self.groupname) local asset=self.legion:GetAssetByName(self.groupname)
if asset then
-- Get request. -- Get request.
local request=self.legion:GetRequestByID(asset.rid) local request=self.legion:GetRequestByID(asset.rid)
-- Trigger asset dead event. -- Trigger asset dead event.
self.legion:AssetDead(asset, request) self.legion:AssetDead(asset, request)
end
end end
-- Stop in 5 sec to give possible respawn attempts a chance. -- Stop in 5 sec to give possible respawn attempts a chance.
@@ -12717,7 +12744,7 @@ end
-- @return #OPSGROUP self -- @return #OPSGROUP self
function OPSGROUP:SetDefaultCallsign(CallsignName, CallsignNumber) function OPSGROUP:SetDefaultCallsign(CallsignName, CallsignNumber)
self:T(self.lid..string.format("Setting Default callsing %s-%s", tostring(CallsignName), tostring(CallsignNumber))) self:T(self.lid..string.format("Setting Default callsign %s-%s", tostring(CallsignName), tostring(CallsignNumber)))
self.callsignDefault={} --#OPSGROUP.Callsign self.callsignDefault={} --#OPSGROUP.Callsign
self.callsignDefault.NumberSquad=CallsignName self.callsignDefault.NumberSquad=CallsignName
@@ -13476,8 +13503,8 @@ function OPSGROUP:GetAmmoUnit(unit, display)
if ammotable then if ammotable then
local weapons=#ammotable local weapons=#ammotable
--self:I(ammotable) --self:I(ammotable)
--UTILS.PrintTableToLog(ammotable) --UTILS.PrintTableToLog(ammotable)
-- Loop over all weapons. -- Loop over all weapons.
for w=1,weapons do for w=1,weapons do
@@ -13485,9 +13512,9 @@ function OPSGROUP:GetAmmoUnit(unit, display)
-- Number of current weapon. -- Number of current weapon.
local Nammo=ammotable[w]["count"] local Nammo=ammotable[w]["count"]
-- Range in meters. Seems only to exist for missiles (not shells). -- Range in meters. Seems only to exist for missiles (not shells).
local rmin=ammotable[w]["desc"]["rangeMin"] or 0 local rmin=ammotable[w]["desc"]["rangeMin"] or 0
local rmax=ammotable[w]["desc"]["rangeMaxAltMin"] or 0 local rmax=ammotable[w]["desc"]["rangeMaxAltMin"] or 0
-- Type name of current weapon. -- Type name of current weapon.
local Tammo=ammotable[w]["desc"]["typeName"] local Tammo=ammotable[w]["desc"]["typeName"]
+22 -8
View File
@@ -234,7 +234,7 @@ _RESCUEHELOID=0
--- Class version. --- Class version.
-- @field #string version -- @field #string version
RESCUEHELO.version="1.1.0" RESCUEHELO.version="1.2.0"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@@ -247,6 +247,7 @@ RESCUEHELO.version="1.1.0"
-- DONE: Possibility to add already present/spawned aircraft, e.g. for warehouse. -- DONE: Possibility to add already present/spawned aircraft, e.g. for warehouse.
-- DONE: Add rescue event when aircraft crashes. -- DONE: Add rescue event when aircraft crashes.
-- DONE: Make offset input parameter. -- DONE: Make offset input parameter.
-- DONE: Make useable for AUFTRAG
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor -- Constructor
@@ -337,6 +338,9 @@ function RESCUEHELO:New(carrierunit, helogroupname)
self:AddTransition("*", "Stop", "Stopped") self:AddTransition("*", "Stop", "Stopped")
self:I(self.lid.."Started.")
--- Triggers the FSM event "Start" that starts the rescue helo. Initializes parameters and starts event handlers. --- Triggers the FSM event "Start" that starts the rescue helo. Initializes parameters and starts event handlers.
-- @function [parent=#RESCUEHELO] Start -- @function [parent=#RESCUEHELO] Start
-- @param #RESCUEHELO self -- @param #RESCUEHELO self
@@ -871,14 +875,24 @@ function RESCUEHELO:onafterStart(From, Event, To)
-- Delay before formation is started. -- Delay before formation is started.
local delay=120 local delay=120
-- Spawn helo. We need to introduce an alias in case this class is used twice. This would confuse the spawn routine. local UsesAliveGroup=false
local Spawn=SPAWN:NewWithAlias(self.helogroupname, self.alias) local Spawn = GROUP:FindByName(self.helogroupname)
if Spawn and Spawn:IsAlive() then
self.helo=Spawn
UsesAliveGroup = true
delay = 1
else
-- Set modex for spawn. -- Spawn helo. We need to introduce an alias in case this class is used twice. This would confuse the spawn routine.
Spawn:InitModex(self.modex) local Spawn=SPAWN:NewWithAlias(self.helogroupname, self.alias)
-- Set modex for spawn.
Spawn:InitModex(self.modex)
end
-- Spawn in air or at airbase. -- Spawn in air or at airbase.
if self.takeoff==SPAWN.Takeoff.Air then if UsesAliveGroup==false and self.takeoff==SPAWN.Takeoff.Air then
-- Carrier heading -- Carrier heading
local hdg=self.carrier:GetHeading() local hdg=self.carrier:GetHeading()
@@ -898,7 +912,7 @@ function RESCUEHELO:onafterStart(From, Event, To)
-- Start formation in 1 seconds -- Start formation in 1 seconds
delay=1 delay=1
else elseif UsesAliveGroup==false and self.uncontrolledac then
-- Check if an uncontrolled helo group was requested. -- Check if an uncontrolled helo group was requested.
if self.uncontrolledac then if self.uncontrolledac then
@@ -920,7 +934,7 @@ function RESCUEHELO:onafterStart(From, Event, To)
return return
end end
else elseif UsesAliveGroup==false then
-- Spawn at airbase. -- Spawn at airbase.
self.helo=Spawn:SpawnAtAirbase(self.airbase, self.takeoff, nil, AIRBASE.TerminalType.HelicopterUsable) self.helo=Spawn:SpawnAtAirbase(self.airbase, self.takeoff, nil, AIRBASE.TerminalType.HelicopterUsable)
+113
View File
@@ -5161,3 +5161,116 @@ function UTILS.ValidateAndRepositionStatic(Country, Category, Type, Position, Sh
return nil return nil
end end
---
-- This function can be used to scan all airdromes of a map and write the Moose enums to a file.
function UTILS.CreateAirbaseEnum()
-- Save file function
local function _savefile( filename, data )
local file=lfs.writedir() .. filename
local f = io.open(file , "wb")
if f then
f:write( data )
f:close()
env.info(string.format("Saving to file %s", tostring(file) ))
else
env.info(string.format("ERROR: Could not save results to file %s", tostring(file) ))
end
end
-- Get all airbases
local airbases=world.getAirbases()
-- Get map name
local mapname=env.mission.theatre
-- Put airbases in a table
local myab={}
for i,_airbase in pairs(airbases) do
local airbase=_airbase --DCS#Airbase
local cat=airbase:getDesc().category
if cat==Airbase.Category.AIRDROME then
-- Get airbase name
local name=airbase:getName()
-- Key is the name with illigal characters replaced
local key=name
-- Germany map specifics
if name=="Airracing Lubeck" then
key="Airracing_Luebeck"
elseif name=="Bad Durkheim" then
key="Bad_Duerkheim"
elseif name=="Buchel" then
key="Buechel"
elseif name=="Buckeburg" then
key="Bueckeburg"
elseif name=="Dusseldorf" then
key="Duesseldorf"
elseif name=="Gutersloh" then
key="Guetersloh"
elseif name=="Kothen" then
key="Koethen"
elseif name=="Larz" then
key="Laerz"
elseif name=="Lubeck" then
key="Luebeck"
elseif name=="Luneburg" then
key="Lueneburg"
elseif name=="Norvenich" then
key="Noervenich"
elseif name=="Ober-Morlen" then
key="Ober_Moerlen"
elseif name=="Peenemunde" then
key="Peenemuende"
elseif name=="Pottschutthohe" then
key="Pottschutthoehe"
elseif name=="Schonefeld" then
key="Schoenefeld"
elseif name=="Weser Wumme" then
key="Weser_Wuemme"
elseif name=="Zollschen" then
key="Zoellschen"
elseif name=="Zweibrucken" then
key="Zweibruecken"
end
-- Replace blanks, hyphens by underscores
key=key:gsub(" ", "_")
key=key:gsub("-", "_")
key=key:gsub("'", "_")
key=UTILS.ReplaceIllegalCharacters(key, "_")
local entry={}
entry.key=key
entry.name=name
table.insert(myab, entry)
end
end
-- Sort by name
table.sort(myab, function(a,b) return a.name < b.name end)
local text=string.format("\n--- Airbases of the %s map", mapname)
text=text.."\n--"
for _,ab in pairs(myab) do
text=text..string.format("\n-- * `AIRBASE.%s.%s` %s", mapname, ab.key, ab.name)
end
text=text.."\n--"
text=text..string.format("\n-- @field %s", mapname)
text=text..string.format("\nAIRBASE.%s = {", mapname)
for _,ab in pairs(myab) do
text=text..string.format('\n\t["%s"] = "%s",', ab.key, ab.name)
end
text=text.."\n}"
_savefile(string.format("%s-enums.txt", env.mission.theatre), text)
--env.info(text)
end
File diff suppressed because it is too large Load Diff
@@ -75,6 +75,13 @@ function SCENERY:Register( SceneryName, SceneryObject, SceneryZone )
self.Vector = (self.Vec3 and VECTOR) and VECTOR:NewFromVec(self.Vec3) or nil self.Vector = (self.Vec3 and VECTOR) and VECTOR:NewFromVec(self.Vec3) or nil
end end
if SceneryObject then
local vec3 = SceneryObject:getPoint()
self.Vec3 = { x = vec3.x, y = vec3.y, z = vec3.z }
self.Vec2 = { x = vec3.x, y = vec3.z }
self.Vector = (self.Vec3 and VECTOR) and VECTOR:NewFromVec(self.Vec3) or nil
end
if self.SceneryObject and self.SceneryObject.getLife then -- fix some objects do not have all functions if self.SceneryObject and self.SceneryObject.getLife then -- fix some objects do not have all functions
self.Life0 = self.SceneryObject:getLife() or 1 self.Life0 = self.SceneryObject:getLife() or 1
else else