From 0ec396432ba3a3548c23b29ce0404ca6ff0db67a Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Fri, 19 Aug 2022 01:06:37 -0600 Subject: [PATCH] fix crash in flow through --- flow_through.lua | 5 ++++- mapgen_prefill.lua | 2 ++ mineclone.lua | 7 +++++-- springs.lua | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/flow_through.lua b/flow_through.lua index 3983f20..a6a2188 100644 --- a/flow_through.lua +++ b/flow_through.lua @@ -3,6 +3,9 @@ local flow_through_directions = { {{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) 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 dest_flowing_node 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 set_node(dest_pos, source_node) set_node(source_pos, dest_node) diff --git a/mapgen_prefill.lua b/mapgen_prefill.lua index 0812acc..a55ad3f 100644 --- a/mapgen_prefill.lua +++ b/mapgen_prefill.lua @@ -1,3 +1,5 @@ +local data = {} + dynamic_liquid.mapgen_prefill = function(def) local water_level = def.liquid_level diff --git a/mineclone.lua b/mineclone.lua index 245813c..472efa5 100644 --- a/mineclone.lua +++ b/mineclone.lua @@ -34,6 +34,9 @@ if dynamic_liquid.config.springs then y_max = water_level, y_min = -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 \ No newline at end of file diff --git a/springs.lua b/springs.lua index b7aa92b..df8378f 100644 --- a/springs.lua +++ b/springs.lua @@ -17,7 +17,7 @@ dynamic_liquid.spring = function(def) interval = interval, chance = chance, min_y = y_min, - max_y = y_max-1, + max_y = y_max-1, catch_up = false, action = function(pos,node) local y = pos.y