ham_radio/init.lua

41 lines
1.1 KiB
Lua
Raw Normal View History

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 = {},
playerlocators = {},
settings = {
hud_pos = { x = 0.45, y = 0.7 },
hud_offset = { x = 15, y = 15 },
hud_alignment = { x = 1, y = 0 }
}
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