mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Support for UNIT and GROUP in RADIO:SetTransmission() + indentation
This commit is contained in:
parent
396aa38c18
commit
4655a6413d
@ -76,8 +76,19 @@ end
|
||||
function RADIO:SetFrequency(frequency)
|
||||
self:F(frequency)
|
||||
if type(frequency) == "number" then
|
||||
-- If frequency is in range
|
||||
if (frequency >= 30 and frequency < 88) or (frequency >= 108 and frequency < 152) or (frequency >= 225 and frequency < 400) then
|
||||
self.Frequency = frequency * 1000 -- Coversion in Hz
|
||||
-- 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
|
||||
self.Positionable:GetDCSObject():getController():setCommand({
|
||||
id = "SetFrequency",
|
||||
params = {
|
||||
frequency = self.Frequency,
|
||||
modulation = self.Modulation,
|
||||
}
|
||||
})
|
||||
end
|
||||
return self
|
||||
end
|
||||
end
|
||||
@ -211,18 +222,6 @@ function RADIO:Broadcast()
|
||||
self:F()
|
||||
-- If the POSITIONABLE is actually a Unit or a Group, use the more complicated DCS function
|
||||
if self.Positionable.ClassName == "UNIT" or self.Positionable.ClassName == "GROUP" then
|
||||
-- If the user didn't change the frequency, he wants to use the on defined in the Mission Editor.
|
||||
-- Else we set the frequency of the UNIT or the GROUP in DCS
|
||||
if self.Frequency ~= 0 then
|
||||
self.Positionable:GetDCSObject():getController():setCommand({
|
||||
id = "SetFrequency",
|
||||
params = {
|
||||
frequency = self.Frequency,
|
||||
modulation = self.Modulation,
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
self.Positionable:GetDCSObject():getController():setCommand({
|
||||
id = "TransmitMessage",
|
||||
params = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user