mirror of
https://github.com/technix/ham_radio.git
synced 2024-08-18 20:24:07 +02:00
this is a handheld receiver actually
This commit is contained in:
parent
9256f83b37
commit
58c9bb199b
@ -21,7 +21,7 @@ function ham_radio:update_broadcast(player)
|
|||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local item = player:get_wielded_item()
|
local item = player:get_wielded_item()
|
||||||
|
|
||||||
if item:get_name() ~= "ham_radio:receiver" then
|
if item:get_name() ~= "ham_radio:handheld_receiver" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ minetest.register_craft({
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "ham_radio:receiver",
|
output = "ham_radio:handheld_receiver",
|
||||||
recipe = {
|
recipe = {
|
||||||
{'', antenna, ''},
|
{'', antenna, ''},
|
||||||
{'','ham_radio:circuit', ''},
|
{'','ham_radio:circuit', ''},
|
||||||
|
2
hud.lua
2
hud.lua
@ -4,7 +4,7 @@ function ham_radio.toggle_hud(player)
|
|||||||
local item = player:get_wielded_item()
|
local item = player:get_wielded_item()
|
||||||
|
|
||||||
-- remove hud and broadcasts if user does not wield a receiver
|
-- remove hud and broadcasts if user does not wield a receiver
|
||||||
if item:get_name() ~= "ham_radio:receiver" then
|
if item:get_name() ~= "ham_radio:handheld_receiver" then
|
||||||
if ham_radio.is_receiver_wielded[name] then
|
if ham_radio.is_receiver_wielded[name] then
|
||||||
player:hud_remove(ham_radio.playerhuds[name].background)
|
player:hud_remove(ham_radio.playerhuds[name].background)
|
||||||
player:hud_remove(ham_radio.playerhuds[name].frequency)
|
player:hud_remove(ham_radio.playerhuds[name].frequency)
|
||||||
|
14
receiver.lua
14
receiver.lua
@ -1,18 +1,18 @@
|
|||||||
-- minetest.chat_send_player(user:get_player_name(), "Itemstack"..meta:get_string("frequency").."^"..itemstack:get_name())
|
-- minetest.chat_send_player(user:get_player_name(), "Itemstack"..meta:get_string("frequency").."^"..itemstack:get_name())
|
||||||
|
|
||||||
|
|
||||||
minetest.register_tool("ham_radio:receiver", {
|
minetest.register_tool("ham_radio:handheld_receiver", {
|
||||||
description = "Ham Radio Receiver",
|
description = "Ham Radio Handheld Receiver",
|
||||||
wield_image = "ham_radio_receiver_wield.png",
|
wield_image = "ham_radio_receiver_handheld.png",
|
||||||
inventory_image = "ham_radio_receiver_wield.png",
|
inventory_image = "ham_radio_receiver_handheld.png",
|
||||||
groups = { disable_repair = 1 },
|
groups = { disable_repair = 1 },
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
local meta = itemstack:get_meta()
|
local meta = itemstack:get_meta()
|
||||||
local frequency = meta:get_string("frequency")
|
local frequency = meta:get_string("frequency")
|
||||||
minetest.show_formspec(user:get_player_name(), "ham_radio:configure_receiver",
|
minetest.show_formspec(user:get_player_name(), "ham_radio:configure_handheld_receiver",
|
||||||
table.concat({
|
table.concat({
|
||||||
"size[3,4]",
|
"size[3,4]",
|
||||||
"image[1,0;1,1;ham_radio_receiver_wield.png]",
|
"image[1,0;1,1;ham_radio_receiver_handheld.png]",
|
||||||
"field[0.25,2;3,1;frequency;Frequency;",tostring(frequency),"]",
|
"field[0.25,2;3,1;frequency;Frequency;",tostring(frequency),"]",
|
||||||
"tooltip[frequency;Integer number ",
|
"tooltip[frequency;Integer number ",
|
||||||
ham_radio.settings.frequency.min,"-",
|
ham_radio.settings.frequency.min,"-",
|
||||||
@ -25,7 +25,7 @@ minetest.register_tool("ham_radio:receiver", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if formname ~= "ham_radio:configure_receiver" or not minetest.is_player(player) then
|
if formname ~= "ham_radio:configure_handheld_receiver" or not minetest.is_player(player) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if not ham_radio.validate_frequency(fields.frequency) then
|
if not ham_radio.validate_frequency(fields.frequency) then
|
||||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Loading…
Reference in New Issue
Block a user