https://github.com/ogelgames/vizlib
Minetest visulization library
https://github.com/ogelgames/vizlib
library minetest minetest-mod
Last synced: 2 months ago
JSON representation
Minetest visulization library
- Host: GitHub
- URL: https://github.com/ogelgames/vizlib
- Owner: OgelGames
- License: mit
- Created: 2023-02-19T10:41:01.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-06-28T05:17:28.000Z (almost 2 years ago)
- Last Synced: 2025-01-30T20:06:16.413Z (3 months ago)
- Topics: library, minetest, minetest-mod
- Language: Lua
- Homepage:
- Size: 1.39 MB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Minetest Visulization Library [vizlib]
[](https://github.com/OgelGames/vizlib/actions)
[](LICENSE.md)
[](https://www.minetest.net)
[](https://content.minetest.net/packages/OgelGames/vizlib/)
## OverviewThis 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](API.md) for detailed documentation.
## Examples
Drawing a line between two points.
```lua
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.
```lua
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.
```lua
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
```## Installation
Download the [master branch](https://github.com/OgelGames/vizlib/archive/master.zip) or the [latest release](https://github.com/OgelGames/vizlib/releases), and follow [the usual installation steps](https://wiki.minetest.net/Installing_Mods).
Alternatively, you can download and install the mod from [ContentDB](https://content.minetest.net/packages/OgelGames/vizlib) or the online content tab in Minetest.
## License
All code is licensed under the [MIT License](LICENSE).
`vizlib_particle.png` is licensed as [CC0](https://creativecommons.org/publicdomain/zero/1.0/).