mirror of
https://github.com/technix/ham_radio.git
synced 2025-03-13 11:22:32 +01:00
bugfix: allow receiver to tune to beacons
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
function ham_radio.validate_frequency(frequency)
|
||||
function ham_radio.validate_frequency(frequency, is_receiver)
|
||||
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)
|
||||
if next(ham_radio.find_transmitters(frequency)) then
|
||||
if is_receiver ~= nil and next(ham_radio.find_transmitters(frequency)) then
|
||||
if num_freq >= ham_radio.settings.locked_frequency.min
|
||||
and num_freq <= ham_radio.settings.locked_frequency.max then
|
||||
-- transmitter is in locked frequency range
|
||||
|
@ -37,7 +37,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "ham_radio:configure_handheld_receiver" or not minetest.is_player(player) then
|
||||
return false
|
||||
end
|
||||
if not ham_radio.validate_frequency(fields.frequency) then
|
||||
if not ham_radio.validate_frequency(fields.frequency, true) then
|
||||
return false
|
||||
end
|
||||
local item = player:get_wielded_item()
|
||||
|
Reference in New Issue
Block a user