Digibuilder
Revision as of 21:11, 9 February 2024 by Birdlover32767 (talk | contribs) (Add category and example)
Overview
A Digibuilder is a Digiline device used to place nodes around it. It looks like .
Crafting Recipe
A Digibuilder is made by crafting 8 Luacontrollers in a ring around a Diamond Block.
Digiline Interactions
Getting a node
{
command = "getnode",
pos = { x=1, y=0, z=0 }
}
-- OUTPUTS:
-- { error = true, message = "..." }: error
-- { pos = { x=1, y=0, z=0 }, name = "default:stone" }: a stone block
-- { pos = { x=1, y=0, z=0 }, name = "stairs:stair_stone", param2 = 3 }: a stair with info on param2 (rotation)
Setting a node
{
command = "setnode",
pos = { x=1, y=0, z=0 },
param2 = 3,
name = "stairs:stair_stone"
}
-- OUTPUTS:
-- { error = true, message = "..." }: error
-- { pos = { x=1, y=0, z=0 }, success = true, name = "default:stone" }: a stone block
-- { pos = { x=1, y=0, z=0 }, success = true, name = "stairs:stair_stone", param2 = 3 }: a stair with info on param2 (rotation)
Example
-- This program makes a :) out of dirt.
-- Place the digibuilder 1 block above the ground, make sure its channel is "digibuilder".
-- Put at least 7 dirt inside it.
pos = {{x=1,z=1},{x=1,z=-1},{x=-2,z=0},{x=-2,z=1},{x=-2,z=-1},{x=-1,z=2},{x=-1,z=-2}} -- You can change these positions to draw something else.
-- We use interrupts because the luacontroller would burn if we sent them all at the same time.
if event.type == "program" then
-- Initialization
mem.index = 1
interrupt(0.5)
elseif event.type == "interrupt" then
if mem.index < #pos+1 then -- Don't want to go off the edge!
interrupt(0.5)
p = pos[mem.index] -- Get position
digiline_send("digibuilder", { -- Place the dirt.
command = "setnode",
pos = {x=p.x,y=-1,z=p.z},
name = "default:dirt"
})
mem.index = mem.index + 1
end
end