mirror of
https://github.com/HybridDog/we_undo.git
synced 2025-01-05 20:27:35 +01:00
Support pyramid and hollowpyramid
This commit is contained in:
parent
b30ed66caa
commit
101523e1e9
@ -22,6 +22,8 @@ Supported chatcommands:
|
||||
* /hollowdome and /hdo
|
||||
* /cylinder and /cyl
|
||||
* /hollowcylinder and /hcyl
|
||||
* /pyramid and /pyr
|
||||
* /hollowpyramid and /hpyr
|
||||
* /load
|
||||
* /y
|
||||
* /n
|
||||
@ -48,8 +50,6 @@ Not yet implemented:
|
||||
* /contract
|
||||
* /outset
|
||||
* /inset
|
||||
* /hollowpyramid /hpyr
|
||||
* /pyramid /pyr
|
||||
* /spiral
|
||||
* /copy
|
||||
* /move
|
||||
@ -77,3 +77,4 @@ TODO:
|
||||
e.g. //undo ~1 to undo the change before the latest one
|
||||
* Add times to the changes, show in //show_journal
|
||||
* Implement more commands
|
||||
* worldedit pyramid fix
|
||||
|
34
init.lua
34
init.lua
@ -681,6 +681,40 @@ for i = 1,2 do
|
||||
)
|
||||
end
|
||||
|
||||
local we_pyramid = worldedit.pyramid
|
||||
local function pyramid_func(_,_, ...)
|
||||
return we_pyramid(...)
|
||||
end
|
||||
local function my_we_pyramid(pos, axis, height, ...)
|
||||
local h = math.ceil(math.abs(height))
|
||||
-- This code is commented because of a worldedit pyramid wrapping bug. FIXME
|
||||
--~ local pos1 = vector.subtract(pos, h-1)
|
||||
--~ local pos2 = vector.add(pos, h-1)
|
||||
|
||||
--~ if height > 0 then
|
||||
--~ pos1[axis] = pos[axis]
|
||||
--~ else
|
||||
--~ pos2[axis] = pos[axis]
|
||||
--~ end
|
||||
|
||||
-- This workaround doesn't necessarily work right. It worked when tested.
|
||||
local pos1 = vector.subtract(pos, h + 15)
|
||||
local pos2 = vector.add(pos, h + 15)
|
||||
|
||||
return we_nodeset_wrapper(pyramid_func, pos1, pos2, pos, axis, height, ...)
|
||||
end
|
||||
local pyramid_cmds = {"/pyramid", "/hollowpyramid"}
|
||||
for i = 1,2 do
|
||||
override_cc_with_confirm(pyramid_cmds[i],
|
||||
function()
|
||||
worldedit.pyramid = my_we_pyramid
|
||||
end,
|
||||
function()
|
||||
worldedit.pyramid = we_pyramid
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
-- tells if the metadata is that dummy
|
||||
local function is_meta_empty(metatabl)
|
||||
|
Loading…
Reference in New Issue
Block a user