1
0
Fork 0

fix crash in flow through

mineclone_compatibility
FaceDeer 2022-08-19 01:06:37 -06:00
parent 103fd9a22a
commit 0ec396432b
4 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,9 @@ local flow_through_directions = {
{{x=0,z=1},{x=1,z=0}}, {{x=0,z=1},{x=1,z=0}},
} }
local get_node = minetest.get_node
local set_node = minetest.set_node
dynamic_liquid.flow_through_abm = function(def) dynamic_liquid.flow_through_abm = function(def)
minetest.register_abm({ minetest.register_abm({
@ -20,7 +23,7 @@ dynamic_liquid.flow_through_abm = function(def)
local source_flowing_node = dynamic_liquid.registered_liquids[source_node.name] local source_flowing_node = dynamic_liquid.registered_liquids[source_node.name]
local dest_flowing_node local dest_flowing_node
if source_flowing_node ~= nil then if source_flowing_node ~= nil then
dest_node = minetest.get_node(dest_pos) dest_node = get_node(dest_pos)
if dest_node.name == source_flowing_node or dest_node.name == "air" then if dest_node.name == source_flowing_node or dest_node.name == "air" then
set_node(dest_pos, source_node) set_node(dest_pos, source_node)
set_node(source_pos, dest_node) set_node(source_pos, dest_node)

View File

@ -1,3 +1,5 @@
local data = {}
dynamic_liquid.mapgen_prefill = function(def) dynamic_liquid.mapgen_prefill = function(def)
local water_level = def.liquid_level local water_level = def.liquid_level

View File

@ -35,5 +35,8 @@ if dynamic_liquid.config.springs then
y_min = -15, y_min = -15,
pressure = 15, pressure = 15,
}) })
end
if dynamic_liquid.config.mapgen_prefill then
dynamic_liquid.mapgen_prefill({liquid="mcl_core:water_source", liquid_level=water_level})
end end

View File

@ -17,7 +17,7 @@ dynamic_liquid.spring = function(def)
interval = interval, interval = interval,
chance = chance, chance = chance,
min_y = y_min, min_y = y_min,
max_y = y_max-1, max_y = y_max-1,
catch_up = false, catch_up = false,
action = function(pos,node) action = function(pos,node)
local y = pos.y local y = pos.y