disable caching because of bug

This commit is contained in:
techniX 2019-12-24 00:47:03 +02:00
parent 1587dfa8d2
commit a583093ddc
2 changed files with 9 additions and 16 deletions

@ -30,16 +30,6 @@ function ham_radio.validate_frequency(frequency, is_receiver)
return { result = result, message = message }
end
function ham_radio.find_transmitters(frequency)
local transmitter_list = {}
for key, transmitter in pairs(ham_radio.transmitters) do
if transmitter.frequency == frequency then
transmitter_list[key] = transmitter
end
end
return transmitter_list
end
function ham_radio.find_free_frequency(range)
local frequency = -1
while frequency == -1 do

@ -11,10 +11,15 @@ ham_radio = {
transmitters = {},
}
-- preload transmitter data
local all_transmitters = mod_storage:to_table().fields
for key, transmitter_data in pairs(all_transmitters) do
ham_radio.transmitters[key] = minetest.parse_json(transmitter_data)
function ham_radio.find_transmitters(frequency)
local transmitter_list = {}
local all_transmitters = mod_storage:to_table().fields
for key, transmitter_data in pairs(all_transmitters) do
if transmitter_data.frequency == frequency then
transmitter_list[key] = transmitter_data
end
end
return transmitter_list
end
function ham_radio.save_transmitter(pos, meta)
@ -24,13 +29,11 @@ function ham_radio.save_transmitter(pos, meta)
operated_by = meta:get_string("operated_by")
}
local key = minetest.pos_to_string(pos, 0)
ham_radio.transmitters[key] = transmitter_properties -- cache
mod_storage:set_string(key, minetest.write_json(transmitter_properties)) -- storage
end
function ham_radio.delete_transmitter(pos)
local key = minetest.pos_to_string(pos, 0)
ham_radio.transmitters[key] = nil -- cache
mod_storage:set_string(key, '') -- storage
end