mirror of
https://gitlab.icynet.eu/evert/fluid_lib.git
synced 2024-12-18 11:15:43 +01:00
Fix crash when buffer doesn't accept fluids
This commit is contained in:
parent
f7250e5bec
commit
4b9b42c409
@ -47,6 +47,10 @@ function fluid_lib.buffer_accepts_fluid(pos, buffer, fluid)
|
|||||||
local bfdata = fluid_lib.get_buffer_data(pos, buffer)
|
local bfdata = fluid_lib.get_buffer_data(pos, buffer)
|
||||||
if not bfdata then return false end
|
if not bfdata then return false end
|
||||||
|
|
||||||
|
if not bfdata.accepts then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
if bfdata.fluid ~= "" and bfdata.fluid ~= fluid then
|
if bfdata.fluid ~= "" and bfdata.fluid ~= fluid then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -32,6 +32,7 @@ function fluid_lib.cleanse_node_description(node)
|
|||||||
local ndef = minetest.registered_nodes[node]
|
local ndef = minetest.registered_nodes[node]
|
||||||
if not ndef then return nil end
|
if not ndef then return nil end
|
||||||
|
|
||||||
|
-- Remove translation string
|
||||||
local desc_no_translation = ndef.description
|
local desc_no_translation = ndef.description
|
||||||
if string.match(desc_no_translation, "^\27") ~= nil then
|
if string.match(desc_no_translation, "^\27") ~= nil then
|
||||||
desc_no_translation = desc_no_translation:match("[)]([%w%s]+)\27")
|
desc_no_translation = desc_no_translation:match("[)]([%w%s]+)\27")
|
||||||
|
@ -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 fluidcount = srcdef.node_io_get_liquid_stack(srcpos, srcnode, "", aindex):get_count()
|
||||||
local defc = math.min(fluidcount, idef)
|
local defc = math.min(fluidcount, idef)
|
||||||
local defi = srcdef.node_io_take_liquid(srcpos, srcnode, "", nil, afluid, defc)
|
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)
|
local lo = destdef.node_io_put_liquid(pos, destnode, "", nil, afluid, defi.millibuckets)
|
||||||
pumped = pumped + (defi.millibuckets - lo)
|
pumped = pumped + (defi.millibuckets - lo)
|
||||||
changed = true
|
changed = true
|
||||||
|
Loading…
Reference in New Issue
Block a user