mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-23 23:53:44 +01:00
corner set working
This commit is contained in:
parent
1a78e61c31
commit
0c9987c745
@ -9,14 +9,13 @@
|
|||||||
-- @param {Position} pos2 The 2nd positioon defining the WorldEdit selection
|
-- @param {Position} pos2 The 2nd positioon defining the WorldEdit selection
|
||||||
-- @param {string} node Name of the node to place
|
-- @param {string} node Name of the node to place
|
||||||
function worldeditadditions.corner_set(pos1,pos2,node)
|
function worldeditadditions.corner_set(pos1,pos2,node)
|
||||||
local node_id_replace = minetest.get_content_id(node)
|
|
||||||
|
|
||||||
-- z y x is the preferred loop order (because CPU cache I'd guess, since then we're iterating linearly through the data array)
|
-- 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 }
|
local counts = { replaced = 0 }
|
||||||
for k,z in pairs({pos1.z,pos2.z}) do
|
for k,z in pairs({pos1.z,pos2.z}) do
|
||||||
for k,y in pairs({pos1.y,pos2.y}) do
|
for k,y in pairs({pos1.y,pos2.y}) do
|
||||||
for k,x in pairs({pos1.x,pos2.x}) do
|
for k,x in pairs({pos1.x,pos2.x}) do
|
||||||
minetest.set_node(vector.new(x,y,z), node_id_replace)
|
minetest.set_node(vector.new(x,y,z), {name=node})
|
||||||
counts.replaced = counts.replaced + 1
|
counts.replaced = counts.replaced + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user