Add support in luacontroller for a not yet released mod called 'digilines'

This commit is contained in:
Jeija 2013-01-19 21:45:39 +01:00
parent fc384aedbb
commit 62ddebaecb

View File

@ -167,6 +167,15 @@ local getinterrupt = function(pos)
return interrupt return interrupt
end end
local getdigiline_send = function (pos)
local digiline_send = function (channel, msg)
if digiline then
digiline:receptor_send(pos, digiline.rules.default, channel, minetest.serialize(msg))
end
end
return digiline_send
end
local create_environment = function(pos, mem, event) local create_environment = function(pos, mem, event)
-- Gather variables for the environment -- Gather variables for the environment
local vports = minetest.registered_nodes[minetest.env:get_node(pos).name].virtual_portstates local vports = minetest.registered_nodes[minetest.env:get_node(pos).name].virtual_portstates
@ -177,6 +186,7 @@ local create_environment = function(pos, mem, event)
pin = merge_portstates(vports, rports), pin = merge_portstates(vports, rports),
port = vports, port = vports,
interrupt = getinterrupt(pos), interrupt = getinterrupt(pos),
digiline_send = getdigiline_send(pos),
mem = mem, mem = mem,
event = event} event = event}
end end
@ -200,7 +210,6 @@ local do_overheat = function (pos, meta)
minetest.env:remove_node(pos) minetest.env:remove_node(pos)
minetest.after(0.2, overheat_off, pos) -- wait for pending operations minetest.after(0.2, overheat_off, pos) -- wait for pending operations
minetest.env:add_item(pos, BASENAME.."0000") minetest.env:add_item(pos, BASENAME.."0000")
return
end end
end end
@ -298,6 +307,29 @@ end
local output_rules={} local output_rules={}
local input_rules={} local input_rules={}
local nodebox = {
type = "fixed",
fixed = {
{ -8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }, -- bottom slab
{ -5/16, -7/16, -5/16, 5/16, -6/16, 5/16 }, -- circuit board
{ -3/16, -6/16, -3/16, 3/16, -5/16, 3/16 }, -- IC
}
}
local selectionbox = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, -5/16, 8/16 },
}
local digiline = {
receptor = {},
effector = {
action = function (pos, node, channel, msg)
lc_update (pos, {type = "digiline", iid = {channel = channel, msg = minetest.deserialize(msg)}})
end
}
}
for a = 0, 1 do for a = 0, 1 do
for b = 0, 1 do for b = 0, 1 do
for c = 0, 1 do for c = 0, 1 do
@ -354,20 +386,6 @@ local mesecons = {
} }
} }
local nodebox = {
type = "fixed",
fixed = {
{ -8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }, -- bottom slab
{ -5/16, -7/16, -5/16, 5/16, -6/16, 5/16 }, -- circuit board
{ -3/16, -6/16, -3/16, 3/16, -5/16, 3/16 }, -- IC
}
}
local selectionbox = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, -5/16, 8/16 },
}
minetest.register_node(nodename, { minetest.register_node(nodename, {
description = "Luacontroller", description = "Luacontroller",
drawtype = "nodebox", drawtype = "nodebox",
@ -395,6 +413,7 @@ minetest.register_node(nodename, {
reset_meta(pos, fields.code, err) reset_meta(pos, fields.code, err)
end, end,
mesecons = mesecons, mesecons = mesecons,
digiline = digiline,
is_luacontroller = true, is_luacontroller = true,
virtual_portstates = { a = a == 1, -- virtual portstates are virtual_portstates = { a = a == 1, -- virtual portstates are
b = b == 1, -- the ports the the b = b == 1, -- the ports the the