Further fixes

This commit is contained in:
Applevangelist 2024-07-16 13:38:42 +02:00
parent 04f2f7d34f
commit c73d8a6339
4 changed files with 36 additions and 20 deletions

View File

@ -834,7 +834,7 @@ function DATABASE:FindGroup( GroupName )
local GroupFound = self.GROUPS[GroupName]
if GroupFound == nil and GroupName ~= nil then
if GroupFound == nil and GroupName ~= nil and self.Templates.Groups[GroupName] == nil then
-- see if the group exists in the API, maybe a dynamic slot
self:_RegisterDynamicGroup(GroupName)
return self.GROUPS[GroupName]

View File

@ -4743,18 +4743,23 @@ do -- SET_CLIENT
self:T( { "Evaluated Coalition", MClientCoalition } )
MClientInclude = MClientInclude and MClientCoalition
end
if self.Filter.Categories and MClientInclude then
local MClientCategory = false
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
local ClientCategoryID = _DATABASE:GetCategoryFromClientTemplate( MClientName )
local UnitCategory
if ClientCategoryID==nil and MClient:IsAlive()~=nil then
local UnitCategory = 0
if ClientCategoryID==nil and MClient:IsExist() then
ClientCategoryID,UnitCategory=MClient:GetCategory()
end
self:T3( { "Category:", UnitCategory, self.FilterMeta.Categories[CategoryName], CategoryName } )
if self.FilterMeta.Categories[CategoryName] and UnitCategory and self.FilterMeta.Categories[CategoryName] == UnitCategory then
MClientCategory = true
self:T3( { "Category:", UnitCategory, self.FilterMeta.Categories[CategoryName], CategoryName } )
if self.FilterMeta.Categories[CategoryName] and UnitCategory and self.FilterMeta.Categories[CategoryName] == UnitCategory then
MClientCategory = true
end
else
self:T3( { "Category:", ClientCategoryID, self.FilterMeta.Categories[CategoryName], CategoryName } )
if self.FilterMeta.Categories[CategoryName] and ClientCategoryID and self.FilterMeta.Categories[CategoryName] == ClientCategoryID then
MClientCategory = true
end
end
end
self:T( { "Evaluated Category", MClientCategory } )
@ -5217,13 +5222,18 @@ do -- SET_PLAYER
local MClientCategory = false
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
local ClientCategoryID = _DATABASE:GetCategoryFromClientTemplate( MClientName )
local UnitCategory
if ClientCategoryID==nil and MClient:IsAlive()~=nil then
local UnitCategory = 0
if ClientCategoryID==nil and MClient:IsExist() then
ClientCategoryID,UnitCategory=MClient:GetCategory()
end
self:T3( { "Category:", UnitCategory, self.FilterMeta.Categories[CategoryName], CategoryName } )
if self.FilterMeta.Categories[CategoryName] and UnitCategory and self.FilterMeta.Categories[CategoryName] == UnitCategory then
MClientCategory = true
self:T3( { "Category:", UnitCategory, self.FilterMeta.Categories[CategoryName], CategoryName } )
if self.FilterMeta.Categories[CategoryName] and UnitCategory and self.FilterMeta.Categories[CategoryName] == UnitCategory then
MClientCategory = true
end
else
self:T3( { "Category:", ClientCategoryID, self.FilterMeta.Categories[CategoryName], CategoryName } )
if self.FilterMeta.Categories[CategoryName] and ClientCategoryID and self.FilterMeta.Categories[CategoryName] == ClientCategoryID then
MClientCategory = true
end
end
end
self:T( { "Evaluated Category", MClientCategory } )

View File

@ -97,6 +97,7 @@ RADIO = {
Power = 100,
Loop = false,
alias = nil,
moduhasbeenset = false,
}
--- Create a new RADIO Object. This doesn't broadcast a transmission, though, use @{#RADIO.Broadcast} to actually broadcast.
@ -167,12 +168,13 @@ function RADIO:SetFrequency(Frequency)
self:F2(Frequency)
if type(Frequency) == "number" then
-- If frequency is in range
--if (Frequency >= 30 and Frequency <= 87.995) or (Frequency >= 108 and Frequency <= 173.995) or (Frequency >= 225 and Frequency <= 399.975) then
-- Convert frequency from MHz to Hz
self.Frequency = Frequency * 1000000
self.Frequency = Frequency
self.HertzFrequency = Frequency * 1000000
-- If the RADIO is attached to a UNIT or a GROUP, we need to send the DCS Command "SetFrequency" to change the UNIT or GROUP frequency
if self.Positionable.ClassName == "UNIT" or self.Positionable.ClassName == "GROUP" then
@ -180,7 +182,7 @@ function RADIO:SetFrequency(Frequency)
local commandSetFrequency={
id = "SetFrequency",
params = {
frequency = self.Frequency,
frequency = self.HertzFrequency,
modulation = self.Modulation,
}
}
@ -197,7 +199,7 @@ function RADIO:SetFrequency(Frequency)
return self
end
--- Set AM or FM modulation of the radio transmitter.
--- Set AM or FM modulation of the radio transmitter. Set this before you set a frequency!
-- @param #RADIO self
-- @param #number Modulation Modulation is either radio.modulation.AM or radio.modulation.FM.
-- @return #RADIO self
@ -206,6 +208,10 @@ function RADIO:SetModulation(Modulation)
if type(Modulation) == "number" then
if Modulation == radio.modulation.AM or Modulation == radio.modulation.FM then --TODO Maybe make this future proof if ED decides to add an other modulation ?
self.Modulation = Modulation
if self.moduhasbeenset == false and Modulation == radio.modulation.FM then -- override default
self:SetFrequency(self.Frequency)
end
self.moduhasbeenset = true
return self
end
end

View File

@ -306,7 +306,7 @@ function CLIENT:IsMultiSeated()
return false
end
--- Checks for a client alive event and calls a function on a continuous basis.
--- Checks for a client alive event and calls a function on a continuous basis. Does **NOT** work for dynamic spawn client slots!
-- @param #CLIENT self
-- @param #function CallBackFunction Create a function that will be called when a player joins the slot.
-- @param ... (Optional) Arguments for callback function as comma separated list.
@ -325,7 +325,7 @@ end
-- @param #CLIENT self
function CLIENT:_AliveCheckScheduler( SchedulerName )
self:F3( { SchedulerName, self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
self:T2( { SchedulerName, self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
if self:IsAlive() then