2021-07-19 02:27:37 +02:00
|
|
|
-- ██ ██ ██████ ██████ ██████ ███ ██ ███████ ██████
|
|
|
|
-- ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██
|
|
|
|
-- ██ █ ██ ██ ██ ██ ██████ ██ ██ ██ █████ ██████
|
|
|
|
-- ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
|
|
-- ███ ███ ██████ ██████ ██ ██ ██ ████ ███████ ██ ██
|
|
|
|
local wea = worldeditadditions
|
|
|
|
worldedit.register_command("wcorner", {
|
2021-07-23 23:12:20 +02:00
|
|
|
params = "<replace_node>",
|
|
|
|
description = "Set the corners of the current selection to <replace_node>",
|
2021-07-19 02:27:37 +02:00
|
|
|
privs = {worldedit=true},
|
|
|
|
require_pos = 2,
|
2021-07-22 22:29:29 +02:00
|
|
|
parse = function(params_text)
|
|
|
|
local node = worldedit.normalize_nodename(params_text)
|
2021-07-19 02:27:37 +02:00
|
|
|
if not node then
|
2021-07-22 22:29:29 +02:00
|
|
|
return false, "invalid node name: " .. params_text
|
2021-07-19 02:27:37 +02:00
|
|
|
end
|
|
|
|
return true, node
|
|
|
|
end,
|
|
|
|
nodes_needed = function(name)
|
|
|
|
local p1, p2, total = worldedit.pos1[name], worldedit.pos2[name], 1
|
|
|
|
for k,v in pairs({"x","y","z"}) do
|
|
|
|
if p1[v] ~= p2[v] then total = total*2 end
|
|
|
|
end
|
|
|
|
return total
|
|
|
|
end,
|
|
|
|
func = function(name, node)
|
|
|
|
local _, count = wea.corner_set(worldedit.pos1[name], worldedit.pos2[name], node)
|
|
|
|
return _, count .. " nodes set"
|
|
|
|
end,
|
|
|
|
})
|