mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 23:42:59 +00:00
cornerset broken
This commit is contained in:
parent
dbab2e4a0d
commit
2c42e0495c
1 changed files with 23 additions and 7 deletions
|
@ -11,22 +11,38 @@
|
||||||
function worldeditadditions.corner_set(pos1,pos2,node)
|
function worldeditadditions.corner_set(pos1,pos2,node)
|
||||||
local node_id_replace = minetest.get_content_id(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)
|
-- 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
|
||||||
data[area:index(x, y, z)] = node_id_replace
|
minetest.setnode(vector.new(x,y,z), node_id_replace)
|
||||||
counts.replaced = counts.replaced + 1
|
counts.replaced = counts.replaced + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Save the modified nodes back to disk & return
|
|
||||||
worldedit.manip_helpers.finish(manip, data)
|
|
||||||
|
|
||||||
return true, counts.replaced
|
return true, counts.replaced
|
||||||
end
|
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
|
||||||
|
|
Loading…
Reference in a new issue