mirror of
https://github.com/technix/ham_radio.git
synced 2024-11-27 09:23:50 +01:00
add tuning sound
This commit is contained in:
parent
a4160c1563
commit
364bcc4671
@ -20,8 +20,11 @@ minetest.register_node("ham_radio:beacon", {
|
||||
light_source = 3,
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
if minetest.is_player(placer) then
|
||||
local name = placer:get_player_name()
|
||||
meta:set_string('operated_by', name)
|
||||
ham_radio.play_tuning_sound(placer)
|
||||
end
|
||||
meta:set_string("frequency", ham_radio.find_free_frequency(ham_radio.settings.beacon_frequency))
|
||||
ham_radio.transmitter_update_infotext(meta)
|
||||
ham_radio.save_transmitter(pos, meta)
|
||||
|
7
init.lua
7
init.lua
@ -33,6 +33,13 @@ function ham_radio.delete_transmitter(pos)
|
||||
mod_storage:set_string(key, '') -- storage
|
||||
end
|
||||
|
||||
function ham_radio.play_tuning_sound(player)
|
||||
minetest.sound_play(
|
||||
{name = "ham_radio_tuning"..math.random(1,5)},
|
||||
{to_player = player:get_player_name()}
|
||||
)
|
||||
end
|
||||
|
||||
dofile(modpath.."/config.lua")
|
||||
|
||||
dofile(modpath.."/helpers.lua")
|
||||
|
@ -43,6 +43,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
local item = player:get_wielded_item()
|
||||
local meta = item:get_meta()
|
||||
meta:set_string("frequency", fields.frequency)
|
||||
-- play radio sound
|
||||
ham_radio.play_tuning_sound(player)
|
||||
-- replace wielded item with new metadata
|
||||
player:set_wielded_item(item)
|
||||
-- reset rds messages
|
||||
|
BIN
textures/ham_radio_tuning1.ogg
Normal file
BIN
textures/ham_radio_tuning1.ogg
Normal file
Binary file not shown.
BIN
textures/ham_radio_tuning2.ogg
Normal file
BIN
textures/ham_radio_tuning2.ogg
Normal file
Binary file not shown.
BIN
textures/ham_radio_tuning3.ogg
Normal file
BIN
textures/ham_radio_tuning3.ogg
Normal file
Binary file not shown.
BIN
textures/ham_radio_tuning4.ogg
Normal file
BIN
textures/ham_radio_tuning4.ogg
Normal file
Binary file not shown.
BIN
textures/ham_radio_tuning5.ogg
Normal file
BIN
textures/ham_radio_tuning5.ogg
Normal file
Binary file not shown.
@ -72,6 +72,7 @@ minetest.register_node("ham_radio:transmitter", {
|
||||
meta:set_string("rds_message", fields.rds_message)
|
||||
ham_radio.transmitter_update_infotext(meta)
|
||||
ham_radio.save_transmitter(pos, meta)
|
||||
ham_radio.play_tuning_sound(sender)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
Loading…
Reference in New Issue
Block a user