mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-20 22:33:16 -04:00
The air/vacuum fix to end all fixes
Probably will have a bug in the next few days. :P Fixed air and vacuum not flowing back in when liquids are removed. Also added an ABM to regular air to make it change to moontest air or vacuum based on neighbors. Liquid no longer deletes atmosphere diagonally placed from it.
This commit is contained in:
parent
170596c13f
commit
e09c391650
2 changed files with 39 additions and 10 deletions
|
@ -139,6 +139,11 @@ minetest.register_abm({
|
|||
for x = -1,1 do
|
||||
for y = -1,0 do
|
||||
for z = -1,1 do
|
||||
--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
|
||||
|
@ -147,5 +152,9 @@ minetest.register_abm({
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -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
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue