38 lines
982 B
Lua
38 lines
982 B
Lua
--doorbell mod
|
|
|
|
minetest.register_node("doorbell:doorbell_digiline",{
|
|
tiles = {"doorbell_digiline.png"},
|
|
description = "doorbell_digiline",
|
|
groups = {cracky=3},
|
|
on_construct = function(pos)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string("formspec","field[channel;Channel;${channel}")
|
|
end,
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
|
local name = sender:get_player_name()
|
|
local meta = minetest.get_meta(pos)
|
|
if fields.channel then meta:set_string("channel",fields.channel) end
|
|
end,
|
|
digiline =
|
|
{
|
|
receptor = {},
|
|
effector = {
|
|
action = function(pos,node,channel,msg)
|
|
local meta = minetest.get_meta(pos)
|
|
local setchan = meta:get_string("channel")
|
|
if channel ~= setchan then return end
|
|
if msg == "doorbell" then
|
|
doorbell_play(pos, "deurbel1")
|
|
end
|
|
end
|
|
}
|
|
},
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = '"doorbell:doorbell_digiline" 1',
|
|
recipe = {
|
|
{'doorbell:doorbell', "digilines:wire_std_00000000"},
|
|
}
|
|
})
|