BuckarooBanzay / digibuilder

0 stars 2 forks source link

Add commands for processing lists of positions/nodes #16

Open OgelGames opened 1 year ago

OgelGames commented 1 year ago

Reading or placing a bunch of nodes requires complex programming to avoid overheating the controlling Luacontroller, and it also creates a lot of digiline messages.

I suggest adding commands to send the digibuilder a list of positions or nodes, with only a single message sent back after completion (or if anything fails). For reading it could be instant, and for placing it would respect the placement delay. (optionally with a "stop" command to abort placement)

Commands could be getnodes and setnodes, like this:

digiline_send("digibuilder", {
    command = "getnodes",
    positions = {
        {x = 1, y = 1, z = 1},
        {x = 2, y = 2, z = 2},
        {x = 3, y = 3, z = 3},
        {x = 4, y = 4, z = 4},
    },
})
digiline_send("digibuilder", {
    command = "setnodes",
    nodes = {
        {pos = {x = 1, y = 1, z = 1}, name = "default:dirt"},
        {pos = {x = 2, y = 2, z = 2}, name = "default:dirt"},
        {pos = {x = 3, y = 3, z = 3}, name = "default:dirt"},
        {pos = {x = 4, y = 4, z = 4}, name = "default:dirt"},
    },
})