From 4b9b42c4091b48bea8323fd99f49770a863cf8d0 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Wed, 20 May 2020 17:49:18 +0300 Subject: [PATCH] Fix crash when buffer doesn't accept fluids --- fluid_lib/buffer.lua | 4 ++++ fluid_lib/init.lua | 1 + fluid_transfer/network.lua | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fluid_lib/buffer.lua b/fluid_lib/buffer.lua index 2c24d65..a9a83f0 100644 --- a/fluid_lib/buffer.lua +++ b/fluid_lib/buffer.lua @@ -47,6 +47,10 @@ function fluid_lib.buffer_accepts_fluid(pos, buffer, fluid) local bfdata = fluid_lib.get_buffer_data(pos, buffer) if not bfdata then return false end + if not bfdata.accepts then + return false + end + if bfdata.fluid ~= "" and bfdata.fluid ~= fluid then return false end diff --git a/fluid_lib/init.lua b/fluid_lib/init.lua index e8ccf02..b8f6371 100644 --- a/fluid_lib/init.lua +++ b/fluid_lib/init.lua @@ -32,6 +32,7 @@ function fluid_lib.cleanse_node_description(node) local ndef = minetest.registered_nodes[node] if not ndef then return nil end + -- Remove translation string local desc_no_translation = ndef.description if string.match(desc_no_translation, "^\27") ~= nil then desc_no_translation = desc_no_translation:match("[)]([%w%s]+)\27") diff --git a/fluid_transfer/network.lua b/fluid_transfer/network.lua index 4b4dfea..17eaa28 100644 --- a/fluid_transfer/network.lua +++ b/fluid_transfer/network.lua @@ -212,7 +212,7 @@ function fluid_lib.transfer_timer_tick(pos, elapsed) local fluidcount = srcdef.node_io_get_liquid_stack(srcpos, srcnode, "", aindex):get_count() local defc = math.min(fluidcount, idef) local defi = srcdef.node_io_take_liquid(srcpos, srcnode, "", nil, afluid, defc) - if defi.millibuckets > 0 then + if defi and defi.millibuckets > 0 then local lo = destdef.node_io_put_liquid(pos, destnode, "", nil, afluid, defi.millibuckets) pumped = pumped + (defi.millibuckets - lo) changed = true