mirror of
https://github.com/HybridDog/we_undo.git
synced 2025-01-07 13:17:35 +01:00
Support spiral
This commit is contained in:
parent
101523e1e9
commit
48553a1cdc
@ -24,6 +24,7 @@ Supported chatcommands:
|
|||||||
* /hollowcylinder and /hcyl
|
* /hollowcylinder and /hcyl
|
||||||
* /pyramid and /pyr
|
* /pyramid and /pyr
|
||||||
* /hollowpyramid and /hpyr
|
* /hollowpyramid and /hpyr
|
||||||
|
* /spiral
|
||||||
* /load
|
* /load
|
||||||
* /y
|
* /y
|
||||||
* /n
|
* /n
|
||||||
@ -50,7 +51,6 @@ Not yet implemented:
|
|||||||
* /contract
|
* /contract
|
||||||
* /outset
|
* /outset
|
||||||
* /inset
|
* /inset
|
||||||
* /spiral
|
|
||||||
* /copy
|
* /copy
|
||||||
* /move
|
* /move
|
||||||
* /stack
|
* /stack
|
||||||
@ -78,3 +78,4 @@ TODO:
|
|||||||
* Add times to the changes, show in //show_journal
|
* Add times to the changes, show in //show_journal
|
||||||
* Implement more commands
|
* Implement more commands
|
||||||
* worldedit pyramid fix
|
* 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 function override_chatcommand(cname, func_before, func_after)
|
||||||
local command = minetest.registered_chatcommands[cname]
|
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
|
-- save the name of the player and execute func_before if present
|
||||||
if func_before then
|
if func_before then
|
||||||
local func = command.func
|
local func = command.func
|
||||||
@ -715,6 +716,32 @@ for i = 1,2 do
|
|||||||
)
|
)
|
||||||
end
|
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
|
-- tells if the metadata is that dummy
|
||||||
local function is_meta_empty(metatabl)
|
local function is_meta_empty(metatabl)
|
||||||
|
Loading…
Reference in New Issue
Block a user