diff --git a/mods/mapgen/init.lua b/mods/mapgen/init.lua index 5b5582c2..3178250b 100644 --- a/mods/mapgen/init.lua +++ b/mods/mapgen/init.lua @@ -139,10 +139,19 @@ minetest.register_abm({ for x = -1,1 do for y = -1,0 do for z = -1,1 do - n_pos = {x=x + pos.x,y=y+pos.y,z=z+pos.z} - n_name = minetest.get_node(n_pos).name - if n_name == "moontest:vacuum" or n_name == "moontest:air" then - minetest.remove_node(n_pos) + --ignore diagonals + if x ~= 1 and z ~= 1 then + if x ~= -1 and z ~= 1 then + if x ~= 1 and z ~= -1 then + if x ~= -1 and z ~= -1 then + n_pos = {x=x + pos.x,y=y+pos.y,z=z+pos.z} + n_name = minetest.get_node(n_pos).name + if n_name == "moontest:vacuum" or n_name == "moontest:air" then + minetest.remove_node(n_pos) + end + end + end + end end end end diff --git a/mods/moontest/init.lua b/mods/moontest/init.lua index 187c9060..48e3f1af 100644 --- a/mods/moontest/init.lua +++ b/mods/moontest/init.lua @@ -119,13 +119,13 @@ minetest.register_on_dignode(function(pos, oldnode, digger) end end) --- Air dies ---this is the hackiest code I've ever written +-- Air gets filled with vacuum or moontest:air, depending on surroudings +-- this is the hackiest code I've ever written -- If neighbors worked as I would like it to, this wouldn't be necessary... minetest.register_abm({ - nodenames = {"moontest:air"}, - neighbors = {"moontest:vacuum"}, - interval = 1, + nodenames = {"moontest:air", "air"}, + neighbors = {"moontest:vacuum", "moontest:air"}, + interval = 2, --must be asynchronous with liquid ABM to avoid deadlock chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) local x = pos.x @@ -157,7 +157,27 @@ minetest.register_abm({ if minetest.get_node(back).name == "moontest:vacuum" then minetest.set_node(pos, {name="moontest:vacuum"}) end - + --now cross reference if air should get filled with moontest:air + if node.name == "air" then + if minetest.get_node(left).name == "moontest:air" then + minetest.set_node(pos, {name="moontest:air"}) + end + if minetest.get_node(right).name == "moontest:air" then + minetest.set_node(pos, {name="moontest:air"}) + end + if minetest.get_node(up).name == "moontest:air" then + minetest.set_node(pos, {name="moontest:air"}) + end + if minetest.get_node(down).name == "moontest:air" then + minetest.set_node(pos, {name="moontest:air"}) + end + if minetest.get_node(forward).name == "moontest:air" then + minetest.set_node(pos, {name="moontest:air"}) + end + if minetest.get_node(back).name == "moontest:air" then + minetest.set_node(pos, {name="moontest:air"}) + end + end end })