Download (180 KB)
For Minetest 5.0 and above

How do I install this?

This mod is a code library for visualizing basic shapes in-game. You can draw lines, circles, cubes, spheres and more.

It's ideal for showing the working area or range of functional nodes, and a better alternative to using entities.


Usage

Simply add vizlib to your mod's dependencies, and call any of the API functions from your code.

See API.md for detailed documentation.


Examples

Drawing a line between two points.

local pos1 = vector.new(-2, 0, -2)
local pos2 = vector.new(2, 2, 2)
vizlib.draw_line(pos1, pos2)

Drawing a blue sphere for the player Sam and removing it after 60 seconds.

local pos = vector.new(0, 5, 0)
local options = {
    color = "#0000ff",
    player = "Sam",
    infinite = true,
}
local shape = vizlib.draw_sphere(pos, 3, options)
minetest.after(60, vizlib.erase_shape, shape)

Showing a working range when punching a node with an empty hand.

on_punch = function(pos, _, player)
    if not player or player:get_wielded_item():get_name() ~= "" then
        -- Only show range when using an empty hand
        return
    end
    local radius = minetest.get_meta(pos):get_int("radius") + 0.5
    vizlib.draw_cube(pos, radius, {player = player})
end

Reviews

Review

Do you recommend this mod?

  • No reviews, yet.

Used By