mirror of
https://github.com/HybridDog/we_undo.git
synced 2025-01-05 20:27:35 +01:00
Support spiral
This commit is contained in:
parent
101523e1e9
commit
48553a1cdc
@ -24,6 +24,7 @@ Supported chatcommands:
|
||||
* /hollowcylinder and /hcyl
|
||||
* /pyramid and /pyr
|
||||
* /hollowpyramid and /hpyr
|
||||
* /spiral
|
||||
* /load
|
||||
* /y
|
||||
* /n
|
||||
@ -50,7 +51,6 @@ Not yet implemented:
|
||||
* /contract
|
||||
* /outset
|
||||
* /inset
|
||||
* /spiral
|
||||
* /copy
|
||||
* /move
|
||||
* /stack
|
||||
@ -78,3 +78,4 @@ TODO:
|
||||
* Add times to the changes, show in //show_journal
|
||||
* Implement more commands
|
||||
* worldedit pyramid fix
|
||||
* Fix the shown "nodes changed" count
|
||||
|
27
init.lua
27
init.lua
@ -18,6 +18,7 @@ local command_invoker
|
||||
|
||||
local function override_chatcommand(cname, func_before, func_after)
|
||||
local command = minetest.registered_chatcommands[cname]
|
||||
assert(command, "Chatcommand " .. cname .. " isn't registered.")
|
||||
-- save the name of the player and execute func_before if present
|
||||
if func_before then
|
||||
local func = command.func
|
||||
@ -715,6 +716,32 @@ for i = 1,2 do
|
||||
)
|
||||
end
|
||||
|
||||
local we_spiral = worldedit.spiral
|
||||
local function spiral_func(_,_, ...)
|
||||
return we_spiral(...)
|
||||
end
|
||||
local function my_we_spiral(pos, length, height, spacer, ...)
|
||||
-- FIXME adding the spacer to the extent makes it work
|
||||
local extent = math.ceil(length / 2) + spacer
|
||||
|
||||
local pos1 = vector.subtract(pos, extent)
|
||||
local pos2 = vector.add(pos, extent)
|
||||
|
||||
pos1.y = pos.y
|
||||
pos2.y = pos.y + math.ceil(height) - 1
|
||||
|
||||
return we_nodeset_wrapper(spiral_func, pos1, pos2, pos, length, height,
|
||||
spacer, ...)
|
||||
end
|
||||
override_cc_with_confirm("/spiral",
|
||||
function()
|
||||
worldedit.spiral = my_we_spiral
|
||||
end,
|
||||
function()
|
||||
worldedit.spiral = we_spiral
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
-- tells if the metadata is that dummy
|
||||
local function is_meta_empty(metatabl)
|
||||
|
Loading…
Reference in New Issue
Block a user