From 2c42e0495cc0880686ef6701ccf52d1b38ed150e Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Mon, 19 Jul 2021 07:42:47 -0700 Subject: [PATCH] cornerset broken --- .../lib/wireframe/corner_set.lua | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/worldeditadditions/lib/wireframe/corner_set.lua b/worldeditadditions/lib/wireframe/corner_set.lua index 822c7e1..bebb20d 100644 --- a/worldeditadditions/lib/wireframe/corner_set.lua +++ b/worldeditadditions/lib/wireframe/corner_set.lua @@ -11,22 +11,38 @@ function worldeditadditions.corner_set(pos1,pos2,node) local node_id_replace = minetest.get_content_id(node) - -- Fetch the nodes in the specified area - local manip, area = worldedit.manip_helpers.init(pos1, pos2) - local data = manip:get_data() - -- z y x is the preferred loop order (because CPU cache I'd guess, since then we're iterating linearly through the data array) local counts = { replaced = 0 } for k,z in pairs({pos1.z,pos2.z}) do for k,y in pairs({pos1.y,pos2.y}) do for k,x in pairs({pos1.x,pos2.x}) do - data[area:index(x, y, z)] = node_id_replace + minetest.setnode(vector.new(x,y,z), node_id_replace) counts.replaced = counts.replaced + 1 end end end - -- Save the modified nodes back to disk & return - worldedit.manip_helpers.finish(manip, data) return true, counts.replaced end +-- function worldeditadditions.corner_set(pos1,pos2,node) +-- local node_id_replace = minetest.get_content_id(node) +-- +-- -- Fetch the nodes in the specified area +-- local manip, area = worldedit.manip_helpers.init(pos1, pos2) +-- local data = manip:get_data() +-- +-- -- z y x is the preferred loop order (because CPU cache I'd guess, since then we're iterating linearly through the data array) +-- local counts = { replaced = 0 } +-- for k,z in pairs({pos1.z,pos2.z}) do +-- for k,y in pairs({pos1.y,pos2.y}) do +-- for k,x in pairs({pos1.x,pos2.x}) do +-- data[area:index(x, y, z)] = node_id_replace +-- counts.replaced = counts.replaced + 1 +-- end +-- end +-- end +-- -- Save the modified nodes back to disk & return +-- worldedit.manip_helpers.finish(manip, data) +-- +-- return true, counts.replaced +-- end