MT-test3d/test3d_t410/init.lua
2017-02-12 01:57:00 +00:00

31 lines
1003 B
Lua

if not digiline then
print("Digilines not found.")
return
end
local oldprint=print
local function print(...)
for k,v in ipairs({...}) do
oldprint("[Test3D:T410] "..tostring(v))
end
end
print("Loading.")
local function t410_set_meta(pos)
minetest.get_meta(pos):set_string("formspec","size[2,4]\nfield[0,1;2.9,1;addr;Address;]\nfield[0,2;2.9,1;data;Data;]\nbutton[0,3;2,1;write;Write]")
end
minetest.register_node("test3d_t410:t410", {
description = "T410 Memory Access Console",
tiles = {"t416-top.png","t416-top.png","t416-side.png","t416-side.png","t416-side.png","t416-side.png"},
on_construct = t410_set_meta,
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
on_receive_fields = function(pos,_,fields,sender)
if fields.addr == nil then return end
digiline:receptor_send(pos, digiline.rules.default, fields.addr, tonumber(fields.data) or 0)
print("Set "..fields.addr.." to "..fields.data)
end,
digiline = {
receptor = {},
},
})
print("T410 node registered")