From 6e3b9d99e91404e91e6d8997d9fc68ac1a055805 Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Fri, 23 Jul 2021 16:21:58 -0700 Subject: [PATCH] removed tests --- Chat-Command-Reference.md | 3 ++- worldeditadditions/lib/wireframe/make_compass.lua | 9 +++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Chat-Command-Reference.md b/Chat-Command-Reference.md index 1a0692a..7bae456 100644 --- a/Chat-Command-Reference.md +++ b/Chat-Command-Reference.md @@ -371,6 +371,7 @@ This command is best explained with examples: The above functions just like `//replace` - nothing special going on here. It replaces all `dirt` nodes with `stone`. + Let's make it more interesting: ```weacmd @@ -722,7 +723,7 @@ Short for _select relative_. Sets the pos2 at set distances along 3 axes relativ //srel front 5 //srel y 12 right -2 //srel left 3 up 5 -front 7 -//scube -z 12 -y -2 x -2 +//srel -z 12 -y -2 x -2 ``` diff --git a/worldeditadditions/lib/wireframe/make_compass.lua b/worldeditadditions/lib/wireframe/make_compass.lua index 372de86..a272df7 100644 --- a/worldeditadditions/lib/wireframe/make_compass.lua +++ b/worldeditadditions/lib/wireframe/make_compass.lua @@ -9,27 +9,24 @@ -- @param {string} node1 Name of the node to place -- @param {string} node2 Name of the node of the bead function worldeditadditions.make_compass(pos1,node1,node2) - local debug, ret = "", {} + minetest.set_node(vector.add(pos1,vector.new(0,1,3)), {name=node2}) local counts = { replaced = 1 } + -- z y x is the preferred loop order (because CPU cache I'd guess, since then we're iterating linearly through the data array) for z = -3,3 do if z ~= 0 then for k,x in pairs({math.floor(-3/math.abs(z)),0,math.ceil(3/math.abs(z))}) do minetest.set_node(vector.new(pos1.x+x,pos1.y,pos1.z+z), {name=node1}) counts.replaced = counts.replaced + 1 - table.insert(ret,x) end else for x = -3,3 do minetest.set_node(vector.new(pos1.x+x,pos1.y,pos1.z), {name=node1}) counts.replaced = counts.replaced + 1 - table.insert(ret,pos1.x+x) end end - debug = debug..z.." -- "..table.concat(ret,", ").."\n" - ret={} end - return true, debug..counts.replaced + return true, counts.replaced end