2022-04-01 20:07:40 +02:00
2022-03-26 13:14:12 +01:00
2022-04-01 20:07:40 +02:00
2022-04-01 17:26:15 +02:00
2022-04-01 13:53:46 +02:00
2022-03-29 18:11:49 +02:00
2022-04-01 17:21:17 +02:00
2022-03-25 21:13:40 +01:00
2022-03-29 17:54:18 +02:00
2022-03-28 08:44:19 +02:00
2022-04-01 17:08:30 +02:00

mtscad

OpenSCAD inspired minetest mod

Status: WIP

Example

Files placed in <worlddir>/mtscad/

stairs.lua

-- diagonal line along x and y with "count" nodes
local function diag_x_line(ctx, count)
    for x=0, count do
        ctx
        :translate(x, x, 0)
        :set_node()
    end
end

return function(ctx, opts)
    -- filler
    ctx
    :with(opts.filler)
    :execute(diag_x_line, opts.height-1)
    :translate(0, 0, opts.width-1)
    :execute(diag_x_line, opts.height-1)

    -- slopes above
    ctx
    :with(opts.slopes)
    :slope(-1, 1, 0)
    :translate(0, 1, 0)
    :execute(diag_x_line, opts.height-2)
    :translate(0, 0, opts.width-1)
    :execute(diag_x_line, opts.height-2)

    -- slopes below
    ctx
    :with(opts.slopes)
    :slope(1, -1, 0)
    :translate(1, 0, 0)
    :execute(diag_x_line, opts.height-2)
    :translate(0, 0, opts.width-1)
    :execute(diag_x_line, opts.height-2)

    -- stairs
    for z=1,opts.width-2 do
        ctx
        :with(opts.stairs)
        :slope(-1, 1, 0)
        :translate(0, 0, z)
        :execute(diag_x_line, opts.height-1)
    end
end

test.lua

local stairs = load("stairs")

return function(ctx)
    ctx
    :rotate(0, 0, 0)
    :execute(stairs, {
        height = 4,
        width = 5,
        slopes = "moreblocks:slope_stone",
        stairs = "moreblocks:stair_stone_alt_4",
        filler = "default:stone"
    })
end
/scad test
Description
No description provided
Readme 139 KiB
Languages
Lua 99%
Dockerfile 0.7%
Mathematica 0.3%