From 916de1e3cc8292a2ea4c60f2d5a1b457963627e9 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Sat, 26 Sep 2020 20:17:30 +0200 Subject: [PATCH] Liquid Pumps: Fix issue with undetected pipe connection gaps --- chemistry/ta4_doser.lua | 1 + chemistry/ta4_liquid_filter.lua | 2 ++ chemistry/ta4_stand.lua | 1 + liquids/node_api.lua | 11 +++++++++++ liquids/pump.lua | 1 + liquids/waterpump.lua | 1 + 6 files changed, 17 insertions(+) diff --git a/chemistry/ta4_doser.lua b/chemistry/ta4_doser.lua index dfbeff7..165316d 100644 --- a/chemistry/ta4_doser.lua +++ b/chemistry/ta4_doser.lua @@ -292,6 +292,7 @@ minetest.register_node("techage:ta4_doser", { after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) Pipe:after_dig_node(pos) + liquid.after_dig_pump(pos) techage.del_mem(pos) end, on_receive_fields = on_receive_fields, diff --git a/chemistry/ta4_liquid_filter.lua b/chemistry/ta4_liquid_filter.lua index eb15a8f..ec6b6ff 100644 --- a/chemistry/ta4_liquid_filter.lua +++ b/chemistry/ta4_liquid_filter.lua @@ -105,6 +105,8 @@ minetest.register_node("techage:ta4_liquid_filter_filler", { end, after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) + liquid.after_dig_pump(pos) + techage.del_mem(pos) end, paramtype = "light", diff --git a/chemistry/ta4_stand.lua b/chemistry/ta4_stand.lua index c28ca55..cd1617d 100644 --- a/chemistry/ta4_stand.lua +++ b/chemistry/ta4_stand.lua @@ -117,6 +117,7 @@ minetest.register_node("techage:ta4_reactor_stand", { after_dig_node = function(pos, oldnode) Pipe:after_dig_node(pos) Cable:after_dig_node(pos) + liquid.after_dig_pump(pos) techage.del_mem(pos) end, diff --git a/liquids/node_api.lua b/liquids/node_api.lua index 7a6484c..b6ec288 100644 --- a/liquids/node_api.lua +++ b/liquids/node_api.lua @@ -235,3 +235,14 @@ function liquid.update_network(pos, outdir) networks.node_connections(pos, Pipe) delete_netID(pos, outdir) end + +-- To be called from each pump in 'after_dig_node' +-- before calling 'techage.del_mem(pos)' +function liquid.after_dig_pump(pos) + local nvm = techage.get_nvm(pos) + if nvm.pipe2 and nvm.pipe2.netIDs then + for outdir, netID in pairs(nvm.pipe2.netIDs) do + networks.delete_network("pipe2", netID) + end + end +end \ No newline at end of file diff --git a/liquids/pump.lua b/liquids/pump.lua index 45fc50b..cab1b68 100644 --- a/liquids/pump.lua +++ b/liquids/pump.lua @@ -135,6 +135,7 @@ end local function after_dig_node(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) + liquid.after_dig_pump(pos) techage.del_mem(pos) end diff --git a/liquids/waterpump.lua b/liquids/waterpump.lua index c7a348d..afec554 100644 --- a/liquids/waterpump.lua +++ b/liquids/waterpump.lua @@ -126,6 +126,7 @@ end local function after_dig_node(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) Cable:after_dig_node(pos) + liquid.after_dig_pump(pos) techage.del_mem(pos) end