Use bulk_set_node in hades_gaia

master
Wuzzy 2021-07-20 19:36:03 +02:00
parent 668c5c6539
commit 26ba2e3828
1 changed files with 20 additions and 17 deletions

View File

@ -3,32 +3,35 @@ local S = minetest.get_translator("hades_gaia")
-- WTPFL Licenses
hades_gaia = {}
local conv = function(pos)
local conv = function(pos, pos_table)
local nodename = minetest.get_node(pos).name
if nodename == "hades_core:ash" or nodename == "hades_core:volcanic_sand" or nodename == "hades_core:fertile_sand" or nodename == "hades_core:stone_baked" or nodename == "hades_core:stone" or nodename == "hades_core:mossystone" or nodename == "hades_core:tuff" or nodename == "hades_core:tuff_baked" or nodename == "hades_core:mossytuff" then
-- minetest.remove_node(pos)
minetest.set_node(pos, {name="hades_core:dirt"})
minetest.check_for_falling(pos)
table.insert(pos_table, pos)
end
end
local cotrig = function(pos)
for dx=-4,4 do
local pos_table = {}
for dx=-4,4 do
for dz=-4,4 do
for dy=1,-1,-1 do
pos.x = pos.x+dx
pos.y = pos.y+dy
pos.z = pos.z+dz
if math.abs(dx)<4 and math.abs(dy)<1 and math.abs(dz)<4 then
conv(pos)
end
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
for dy=1,-1,-1 do
pos.x = pos.x+dx
pos.y = pos.y+dy
pos.z = pos.z+dz
if math.abs(dx)<4 and math.abs(dy)<1 and math.abs(dz)<4 then
conv(table.copy(pos), pos_table)
end
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
end
end
end
minetest.bulk_set_node(pos_table, {name="hades_core:dirt"})
for p=1, #pos_table do
minetest.check_for_falling(pos_table[p])
end
end
end
function hades_gaia.staffgaia_on_use(itemstack, user, pointed_thing, uses)