Minetest-WorldEditAdditions/worldeditadditions/lib/sculpt/brushes/square.lua

18 lines
645 B
Lua
Raw Permalink Normal View History

2023-08-03 01:42:46 +00:00
---
-- @module worldeditadditions.sculpt.brushes
--- Returns a simple square brush with 100% weight for every pixel.
2023-08-03 01:42:46 +00:00
-- Default inbuilt brush.
2023-07-02 19:05:46 +00:00
-- @name square
-- @param size Vector3 The desired size of the brush. Only the x and y components are used; the z component is ignored.
-- @returns bool,number[],Vector3 1: true, as this function always succeeds. 2: A simple square brush as a zero-indexed flat array. 3: The size of the resulting brush as a Vector3, using the x and y components.
return function(size)
local result = {}
for y=0, size.y do
for x=0, size.x do
result[y*size.x + x] = 1
end
end
return true, result, size
end