Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Applevangelist 2024-06-20 08:53:08 +02:00
commit 07dc55b284
6 changed files with 60 additions and 27 deletions

View File

@ -1147,10 +1147,13 @@ end
-- @param #string GroupName Group name. -- @param #string GroupName Group name.
-- @return #table Group template table. -- @return #table Group template table.
function DATABASE:GetGroupTemplate( GroupName ) function DATABASE:GetGroupTemplate( GroupName )
local GroupTemplate = self.Templates.Groups[GroupName].Template local GroupTemplate=nil
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID if self.Templates.Groups[GroupName] then
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID GroupTemplate = self.Templates.Groups[GroupName].Template
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
end
return GroupTemplate return GroupTemplate
end end

View File

@ -2748,6 +2748,9 @@ do -- COORDINATE
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, true, Tdiff) local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, true, Tdiff)
local sunset=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, false, 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) local time=UTILS.ClockToSeconds(clock)
-- Check if time is between sunrise and sunset. -- Check if time is between sunrise and sunset.

View File

@ -14366,32 +14366,55 @@ function AIRBOSS:_GetOnboardNumbers( group, playeronly )
-- Debug text. -- Debug text.
local text = string.format( "Onboard numbers of group %s:", groupname ) local text = string.format( "Onboard numbers of group %s:", groupname )
-- Units of template group. local template=group:GetTemplate()
local units = group:GetTemplate().units
-- Get numbers.
local numbers = {} local numbers = {}
for _, unit in pairs( units ) do if template then
-- Onboard number and unit name. -- Units of template group.
local n = tostring( unit.onboard_num ) local units = template.units
local name = unit.name
local skill = unit.skill or "Unknown"
-- Debug text. -- Get numbers.
text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) ) for _, unit in pairs( units ) do
if playeronly and skill == "Client" or skill == "Player" then -- Onboard number and unit name.
-- There can be only one player in the group, so we skip everything else. local n = tostring( unit.onboard_num )
return n 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 end
-- Table entry. -- Debug info.
numbers[name] = n self:T2( self.lid .. text )
end
-- Debug info. else
self:T2( self.lid .. text )
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 return numbers
end end

View File

@ -292,7 +292,7 @@ CSAR.AircraftType["AH-64D_BLK_II"] = 2
CSAR.AircraftType["Bronco-OV-10A"] = 2 CSAR.AircraftType["Bronco-OV-10A"] = 2
CSAR.AircraftType["MH-60R"] = 10 CSAR.AircraftType["MH-60R"] = 10
CSAR.AircraftType["OH-6A"] = 2 CSAR.AircraftType["OH-6A"] = 2
CSAR.AircraftType["OH-58D"] = 2 CSAR.AircraftType["OH58D"] = 2
--- CSAR class version. --- CSAR class version.
-- @field #string version -- @field #string version

View File

@ -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 ["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}, ["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-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. --- CTLD class version.

View File

@ -1778,10 +1778,14 @@ end
--- Returns the group template from the global _DATABASE object (an instance of @{Core.Database#DATABASE}). --- Returns the group template from the global _DATABASE object (an instance of @{Core.Database#DATABASE}).
-- @param #GROUP self -- @param #GROUP self
-- @return #table -- @return #table Template table.
function GROUP:GetTemplate() function GROUP:GetTemplate()
local GroupName = self:GetName() 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 end
--- Returns the group template route.points[] (the waypoints) from the global _DATABASE object (an instance of @{Core.Database#DATABASE}). --- Returns the group template route.points[] (the waypoints) from the global _DATABASE object (an instance of @{Core.Database#DATABASE}).