From 926830e0df7b95d4e53c917db07236ef3e19e991 Mon Sep 17 00:00:00 2001 From: Ilya Zhuravlev Date: Fri, 7 Sep 2012 20:48:12 +0400 Subject: [PATCH] Add liquid_renewable property. --- doc/lua_api.txt | 2 ++ src/map.cpp | 4 ++-- src/nodedef.cpp | 3 +++ src/nodedef.h | 2 ++ src/scriptapi.cpp | 1 + 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/lua_api.txt b/doc/lua_api.txt index b71b6d62c..36dd6b2aa 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1345,6 +1345,8 @@ Node definition (register_node) liquid_alternative_flowing = "", -- Flowing version of source liquid liquid_alternative_source = "", -- Source version of flowing liquid liquid_viscosity = 0, -- Higher viscosity = slower flow (max. 7) + liquid_renewable = true, -- Can new liquid source be created by placing + two or more sources nearly? light_source = 0, -- Amount of light emitted by node damage_per_second = 0, -- If player is inside node, this damage is caused node_box = {type="regular"}, -- See "Node boxes" diff --git a/src/map.cpp b/src/map.cpp index 39c6d292b..2845f3a67 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1746,12 +1746,12 @@ void Map::transformLiquids(core::map & modified_blocks) content_t new_node_content; s8 new_node_level = -1; s8 max_node_level = -1; - if (num_sources >= 2 || liquid_type == LIQUID_SOURCE) { + if ((num_sources >= 2 && nodemgr->get(liquid_kind).liquid_renewable) || liquid_type == LIQUID_SOURCE) { // liquid_kind will be set to either the flowing alternative of the node (if it's a liquid) // or the flowing alternative of the first of the surrounding sources (if it's air), so // it's perfectly safe to use liquid_kind here to determine the new node content. new_node_content = nodemgr->getId(nodemgr->get(liquid_kind).liquid_alternative_source); - } else if (num_sources == 1 && sources[0].t != NEIGHBOR_LOWER) { + } else if (num_sources >= 1 && sources[0].t != NEIGHBOR_LOWER) { // liquid_kind is set properly, see above new_node_content = liquid_kind; max_node_level = new_node_level = LIQUID_LEVEL_MAX; diff --git a/src/nodedef.cpp b/src/nodedef.cpp index d644dc229..466531efa 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -203,6 +203,7 @@ void ContentFeatures::reset() liquid_alternative_flowing = ""; liquid_alternative_source = ""; liquid_viscosity = 0; + liquid_renewable = true; light_source = 0; damage_per_second = 0; node_box = NodeBox(); @@ -253,6 +254,7 @@ void ContentFeatures::serialize(std::ostream &os) os<