mirror of
https://github.com/technix/ham_radio.git
synced 2024-11-30 10:53:46 +01:00
disable caching because of bug
This commit is contained in:
parent
1587dfa8d2
commit
a583093ddc
10
helpers.lua
10
helpers.lua
@ -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
|
||||
|
15
init.lua
15
init.lua
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user