Toggle RDS on shift+click
This commit is contained in:
parent
652183d253
commit
7205e8a69b
@ -31,7 +31,7 @@ Beacon is a simplified transmitter. After placement it automatically tunes on a
|
|||||||
Handheld receiver is a wielded tool.
|
Handheld receiver is a wielded tool.
|
||||||
|
|
||||||
- Left click opens configuration dialog to set frequency. Empty string turns receiver off.
|
- Left click opens configuration dialog to set frequency. Empty string turns receiver off.
|
||||||
- Right click toggles reception of RDS messages.
|
- Shift + left click toggles reception of RDS messages.
|
||||||
|
|
||||||
When receiver is tuned to a frequency where at least one transmitter is present, HUD signal meter bar shows signal power. The signal power depends on distance and direction to the transmitter.
|
When receiver is tuned to a frequency where at least one transmitter is present, HUD signal meter bar shows signal power. The signal power depends on distance and direction to the transmitter.
|
||||||
|
|
||||||
|
22
receiver.lua
22
receiver.lua
@ -5,7 +5,18 @@ minetest.register_tool("ham_radio:handheld_receiver", {
|
|||||||
groups = { disable_repair = 1 },
|
groups = { disable_repair = 1 },
|
||||||
-- left click - change frequency
|
-- left click - change frequency
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
local keys = user:get_player_control()
|
||||||
local meta = itemstack:get_meta()
|
local meta = itemstack:get_meta()
|
||||||
|
if keys.sneak then
|
||||||
|
-- left click with shift - RDS on/off
|
||||||
|
local is_rds_disabled = meta:get_string("rds_disabled")
|
||||||
|
if is_rds_disabled == "" then
|
||||||
|
meta:set_string("rds_disabled", "true")
|
||||||
|
else
|
||||||
|
meta:set_string("rds_disabled", "")
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
local frequency = meta:get_string("frequency")
|
local frequency = meta:get_string("frequency")
|
||||||
minetest.show_formspec(user:get_player_name(), "ham_radio:configure_handheld_receiver",
|
minetest.show_formspec(user:get_player_name(), "ham_radio:configure_handheld_receiver",
|
||||||
table.concat({
|
table.concat({
|
||||||
@ -19,17 +30,6 @@ minetest.register_tool("ham_radio:handheld_receiver", {
|
|||||||
},'')
|
},'')
|
||||||
)
|
)
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
|
||||||
-- right click - RDS on/off
|
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
|
||||||
local meta = itemstack:get_meta()
|
|
||||||
local is_rds_disabled = meta:get_string("rds_disabled")
|
|
||||||
if is_rds_disabled == "" then
|
|
||||||
meta:set_string("rds_disabled", "true")
|
|
||||||
else
|
|
||||||
meta:set_string("rds_disabled", "")
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user