Cleaned up the T416 a bit

This commit is contained in:
Izaya 2016-10-06 15:00:03 +11:00
parent 0e489bcec4
commit e96e5793dd

View File

@ -20,7 +20,6 @@ local function t416_digiline_receive(pos, node, channel, msg)
local memoffset = meta:get_int("startaddr") local memoffset = meta:get_int("startaddr")
if channel:sub(1,#chan) == chan and tonumber(channel:sub(#chan+1),16)+1-memoffset <= MEMSIZE and tonumber(channel:sub(#chan+1),16)+1-memoffset > 0 then if channel:sub(1,#chan) == chan and tonumber(channel:sub(#chan+1),16)+1-memoffset <= MEMSIZE and tonumber(channel:sub(#chan+1),16)+1-memoffset > 0 then
local memaddr = tonumber(channel:sub(#chan+1),16)+1-memoffset local memaddr = tonumber(channel:sub(#chan+1),16)+1-memoffset
print(memaddr)
if tostring(msg):lower() == "get" then if tostring(msg):lower() == "get" then
digiline:receptor_send(pos, digiline.rules.default, channel, tonumber(mem[memaddr] or 0)) digiline:receptor_send(pos, digiline.rules.default, channel, tonumber(mem[memaddr] or 0))
print("Reading address "..tostring(memaddr)..": "..tostring(mem[memaddr])) print("Reading address "..tostring(memaddr)..": "..tostring(mem[memaddr]))
@ -39,7 +38,7 @@ print("Created T416 digiline function")
local function t416_set_meta(pos) local function t416_set_meta(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local ms = "" local ms = ""
for i = 1, 16 do for i = 1, MEMSIZE do
ms = ms .. "0\n" ms = ms .. "0\n"
end end
meta:set_string("mem",ms) meta:set_string("mem",ms)