This repository has been archived on 2019-06-10. You can view files and clone it, but cannot push or open issues or pull requests.
scriptblocks/mesecons.lua

38 lines
1.1 KiB
Lua
Raw Normal View History

2018-09-06 05:04:07 +02:00
--
-- Scriptblocks - Mesecons
--
-- Mesecon receiver
scriptblocks.register_with_alias('mesecon_receiver', {
description = 'Scriptblocks: Mesecon Receiver',
tiles = {'scriptblocks_mesecon.png'},
groups = {oddly_breakable_by_hand = 1},
use_texture_alpha = true,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string('formspec', [[
field[channel;]] .. scriptblocks.program_channel .. [[;${channel}]
field[info;Starting @info;${info}]
]])
end,
on_receive_fields = scriptblocks.create_formspec_handler(
false, 'channel', 'info'
),
2018-09-06 05:04:07 +02:00
scriptblock = function (pos, node, sender, info, last, main_channel)
return
end,
mesecons = {effector = {
action_on = function (pos, node)
local meta = minetest.get_meta(pos)
local channel = meta:get_string('channel')
local info = meta:get_string('info')
scriptblocks.queue(pos, pos, info or '', '', channel)
2018-09-06 05:04:07 +02:00
end,
}}
})
-- Legacy rmod alias
minetest.register_alias_force('rmod:scriptblock_mesecon',
'scriptblocks:mesecon_receiver')