Browse Source

Make grates do what they're supposed to do

master
HimbeerserverDE 1 year ago
parent
commit
734cb4cfaf
  1. 7
      nodes.lua

7
nodes.lua

@ -236,6 +236,7 @@ local place_grate = function(pos)
local dir = minetest.facedir_to_dir(node.param2)
local target = vector.subtract(pos, dir)
waterworks.place_connected(pos, "outlet", {pos = pos, target = target, pressure = target.y})
waterworks.place_connected(pos, "inlet", {pos = pos, target = target, pressure = target.y})
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Grate elevation " .. tostring(target.y))
end
@ -261,9 +262,9 @@ minetest.register_node("waterworks:grate", {
},
sounds = default.node_sound_metal_defaults(),
_waterworks_update_connected = place_outlet,
_waterworks_update_connected = place_grate,
on_construct = function(pos)
place_outlet(pos)
place_grate(pos)
end,
on_destruct = function(pos)
waterworks.remove_connected(pos, "outlet")
@ -274,7 +275,7 @@ minetest.register_node("waterworks:grate", {
waterworks.remove_connected(pos, "inlet")
node.param2 = new_param2
minetest.swap_node(pos, node)
place_outlet(pos)
place_grate(pos)
return true
end,
})
Loading…
Cancel
Save