2019-12-06 14:58:49 +01:00
|
|
|
local modpath = minetest.get_modpath("ham_radio")
|
|
|
|
local mod_storage = minetest.get_mod_storage()
|
|
|
|
|
|
|
|
ham_radio = rawget(_G, "ham_radio") or {}
|
|
|
|
|
|
|
|
ham_radio = {
|
2019-12-06 15:25:03 +01:00
|
|
|
playerhuds = {},
|
2019-12-07 10:42:08 +01:00
|
|
|
is_receiver_wielded = {},
|
2019-12-06 15:25:03 +01:00
|
|
|
settings = {
|
2019-12-07 10:42:08 +01:00
|
|
|
hud_pos = { x = 0.5, y = 0.8 },
|
2019-12-06 15:25:03 +01:00
|
|
|
}
|
2019-12-06 14:58:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function ham_radio.save_transmitter(frequency, transmitter_data)
|
2019-12-06 15:25:03 +01:00
|
|
|
mod_storage:set_string(tostring(frequency), minetest.write_json(transmitter_data))
|
2019-12-06 14:58:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function ham_radio.read_transmitter(frequency)
|
2019-12-06 15:25:03 +01:00
|
|
|
local transmitter_data = mod_storage:get_string(tostring(frequency))
|
|
|
|
if transmitter_data ~= nil and transmitter_data ~= "" then
|
|
|
|
return minetest.parse_json(transmitter_data)
|
|
|
|
end
|
|
|
|
return {}
|
2019-12-06 14:58:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function ham_radio.delete_transmitter(frequency)
|
2019-12-06 15:25:03 +01:00
|
|
|
mod_storage:set_string(tostring(frequency), nil)
|
2019-12-06 14:58:49 +01:00
|
|
|
end
|
|
|
|
|
2019-12-06 16:30:45 +01:00
|
|
|
dofile(modpath.."/craft.lua")
|
2019-12-06 14:58:49 +01:00
|
|
|
dofile(modpath.."/transmitter.lua")
|
|
|
|
dofile(modpath.."/receiver.lua")
|
|
|
|
dofile(modpath.."/hud.lua")
|
|
|
|
|
|
|
|
-- TODO: craft transmitter
|
|
|
|
-- TODO: configure transmitter
|
|
|
|
-- TODO: craft pelengator
|
|
|
|
-- TODO: set pelengator frequency
|