mirror of
https://github.com/technix/ham_radio.git
synced 2024-12-04 12:53:43 +01:00
39 lines
1018 B
Lua
39 lines
1018 B
Lua
local modpath = minetest.get_modpath("ham_radio")
|
|
local mod_storage = minetest.get_mod_storage()
|
|
|
|
ham_radio = rawget(_G, "ham_radio") or {}
|
|
|
|
ham_radio = {
|
|
playerhuds = {},
|
|
is_receiver_wielded = {},
|
|
settings = {
|
|
hud_pos = { x = 0.5, y = 0.8 },
|
|
}
|
|
}
|
|
|
|
function ham_radio.save_transmitter(frequency, transmitter_data)
|
|
mod_storage:set_string(tostring(frequency), minetest.write_json(transmitter_data))
|
|
end
|
|
|
|
function ham_radio.read_transmitter(frequency)
|
|
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 {}
|
|
end
|
|
|
|
function ham_radio.delete_transmitter(frequency)
|
|
mod_storage:set_string(tostring(frequency), nil)
|
|
end
|
|
|
|
dofile(modpath.."/craft.lua")
|
|
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
|