allow empty frequency (turn off)

This commit is contained in:
techniX 2019-12-08 17:10:46 +02:00
parent aaabf34595
commit 63b9e98b07
2 changed files with 9 additions and 1 deletions

@ -1,4 +1,7 @@
function ham_radio.validate_frequency(frequency)
if frequency == "" then
return true -- empty frequency is allowed to disable transmitter/receiver
end
local transmission_is_allowed = true
local num_freq = tonumber(frequency)
local freq = tostring(num_freq)

@ -1,7 +1,12 @@
ham_radio.transmitter_update_infotext = function(meta)
local infotext = {'Frequency: ', meta:get_string("frequency")}
local frequency = meta:get_string("frequency")
local broadcast_message = meta:get_string("broadcast_message")
if frequency == "" then
frequency = "--"
broadcast_message = ""
end
local infotext = {'Frequency: ', frequency}
if broadcast_message ~= "" then
table.insert(infotext, '\nBroadcast: "')
table.insert(infotext, broadcast_message)