summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPilzAdam <adam-k@outlook.com>2012-11-03 12:34:44 -0700
committerPilzAdam <adam-k@outlook.com>2012-11-03 12:34:44 -0700
commit3cab24fbcfbbeb12cdd9f085167969e1a934bd59 (patch)
tree2e3d14987c808e44cce1dd108b6c3224fc158ecf /src
parent755df5f659899e961a7b1875837088fbc6cc1a55 (diff)
parent926830e0df7b95d4e53c917db07236ef3e19e991 (diff)
downloadminetest-3cab24fbcfbbeb12cdd9f085167969e1a934bd59.tar.gz
minetest-3cab24fbcfbbeb12cdd9f085167969e1a934bd59.tar.bz2
minetest-3cab24fbcfbbeb12cdd9f085167969e1a934bd59.zip
Merge pull request #243 from xyzz/liquid_renewable
Add liquid_renewable property, allow non-renewable liquids.
Diffstat (limited to 'src')
-rw-r--r--src/map.cpp4
-rw-r--r--src/nodedef.cpp3
-rw-r--r--src/nodedef.h2
-rw-r--r--src/scriptapi.cpp1
4 files changed, 8 insertions, 2 deletions
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<v3s16, MapBlock*> & 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<<serializeString(liquid_alternative_flowing);
os<<serializeString(liquid_alternative_source);
writeU8(os, liquid_viscosity);
+ writeU8(os, liquid_renewable);
writeU8(os, light_source);
writeU32(os, damage_per_second);
node_box.serialize(os);
@@ -307,6 +309,7 @@ void ContentFeatures::deSerialize(std::istream &is)
liquid_alternative_flowing = deSerializeString(is);
liquid_alternative_source = deSerializeString(is);
liquid_viscosity = readU8(is);
+ liquid_renewable = readU8(is);
light_source = readU8(is);
damage_per_second = readU32(is);
node_box.deSerialize(is);
diff --git a/src/nodedef.h b/src/nodedef.h
index 7c6931834..4ff6c6b48 100644
--- a/src/nodedef.h
+++ b/src/nodedef.h
@@ -209,6 +209,8 @@ struct ContentFeatures
// 1 giving almost instantaneous propagation and 7 being
// the slowest possible
u8 liquid_viscosity;
+ // Is liquid renewable (new liquid source will be created between 2 existing)
+ bool liquid_renewable;
// Amount of light the node emits
u8 light_source;
u32 damage_per_second;
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index 9fa927ff3..09900ce1f 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -1238,6 +1238,7 @@ static ContentFeatures read_content_features(lua_State *L, int index)
// the slowest possible
f.liquid_viscosity = getintfield_default(L, index,
"liquid_viscosity", f.liquid_viscosity);
+ getboolfield(L, index, "liquid_renewable", f.liquid_renewable);
// Amount of light the node emits
f.light_source = getintfield_default(L, index,
"light_source", f.light_source);