From a615da6b12186c83b343dcf76d56e402252d4862 Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 19 Apr 2015 03:37:55 +0100 Subject: [PATCH] Biome API: Add biome-specific river water --- src/mg_biome.cpp | 14 ++++++++------ src/mg_biome.h | 1 + src/script/lua_api/l_mapgen.cpp | 27 ++++++++++++++------------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/mg_biome.cpp b/src/mg_biome.cpp index 854876545..241a06829 100644 --- a/src/mg_biome.cpp +++ b/src/mg_biome.cpp @@ -55,6 +55,7 @@ BiomeManager::BiomeManager(IGameDef *gamedef) : b->m_nodenames.push_back("mapgen_stone"); b->m_nodenames.push_back("mapgen_water_source"); b->m_nodenames.push_back("mapgen_water_source"); + b->m_nodenames.push_back("mapgen_river_water_source"); b->m_nodenames.push_back("air"); m_ndef->pendNodeResolve(b, NODE_RESOLVE_DEFERRED); @@ -131,11 +132,12 @@ void BiomeManager::clear() void Biome::resolveNodeNames() { - getIdFromNrBacklog(&c_top, "mapgen_dirt_with_grass", CONTENT_AIR); - getIdFromNrBacklog(&c_filler, "mapgen_dirt", CONTENT_AIR); - getIdFromNrBacklog(&c_stone, "mapgen_stone", CONTENT_AIR); - getIdFromNrBacklog(&c_water_top, "mapgen_water_source", CONTENT_AIR); - getIdFromNrBacklog(&c_water, "mapgen_water_source", CONTENT_AIR); - getIdFromNrBacklog(&c_dust, "air", CONTENT_IGNORE); + getIdFromNrBacklog(&c_top, "mapgen_dirt_with_grass", CONTENT_AIR); + getIdFromNrBacklog(&c_filler, "mapgen_dirt", CONTENT_AIR); + getIdFromNrBacklog(&c_stone, "mapgen_stone", CONTENT_AIR); + getIdFromNrBacklog(&c_water_top, "mapgen_water_source", CONTENT_AIR); + getIdFromNrBacklog(&c_water, "mapgen_water_source", CONTENT_AIR); + getIdFromNrBacklog(&c_river_water, "mapgen_river_water_source", CONTENT_AIR); + getIdFromNrBacklog(&c_dust, "air", CONTENT_IGNORE); } diff --git a/src/mg_biome.h b/src/mg_biome.h index ce5ce2f0a..e289fb16d 100644 --- a/src/mg_biome.h +++ b/src/mg_biome.h @@ -42,6 +42,7 @@ public: content_t c_stone; content_t c_water_top; content_t c_water; + content_t c_river_water; content_t c_dust; s16 depth_top; diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp index daa040e3b..e90fe32c8 100644 --- a/src/script/lua_api/l_mapgen.cpp +++ b/src/script/lua_api/l_mapgen.cpp @@ -389,22 +389,23 @@ Biome *read_biome_def(lua_State *L, int index, INodeDefManager *ndef) Biome *b = BiomeManager::create(biometype); b->name = getstringfield_default(L, index, "name", ""); - b->depth_top = getintfield_default(L, index, "depth_top", 1); - b->depth_filler = getintfield_default(L, index, "depth_filler", 2); - b->depth_water_top = getintfield_default(L, index, "depth_water_top", 0); - b->y_min = getintfield_default(L, index, "y_min", -31000); - b->y_max = getintfield_default(L, index, "y_max", 31000); - b->heat_point = getfloatfield_default(L, index, "heat_point", 0.f); - b->humidity_point = getfloatfield_default(L, index, "humidity_point", 0.f); + b->depth_top = getintfield_default(L, index, "depth_top", 1); + b->depth_filler = getintfield_default(L, index, "depth_filler", 2); + b->depth_water_top = getintfield_default(L, index, "depth_water_top", 0); + b->y_min = getintfield_default(L, index, "y_min", -31000); + b->y_max = getintfield_default(L, index, "y_max", 31000); + b->heat_point = getfloatfield_default(L, index, "heat_point", 0.f); + b->humidity_point = getfloatfield_default(L, index, "humidity_point", 0.f); b->flags = 0; //reserved std::vector &nn = b->m_nodenames; - nn.push_back(getstringfield_default(L, index, "node_top", "")); - nn.push_back(getstringfield_default(L, index, "node_filler", "")); - nn.push_back(getstringfield_default(L, index, "node_stone", "")); - nn.push_back(getstringfield_default(L, index, "node_water_top", "")); - nn.push_back(getstringfield_default(L, index, "node_water", "")); - nn.push_back(getstringfield_default(L, index, "node_dust", "")); + nn.push_back(getstringfield_default(L, index, "node_top", "")); + nn.push_back(getstringfield_default(L, index, "node_filler", "")); + nn.push_back(getstringfield_default(L, index, "node_stone", "")); + nn.push_back(getstringfield_default(L, index, "node_water_top", "")); + nn.push_back(getstringfield_default(L, index, "node_water", "")); + nn.push_back(getstringfield_default(L, index, "node_river_water", "")); + nn.push_back(getstringfield_default(L, index, "node_dust", "")); ndef->pendNodeResolve(b, NODE_RESOLVE_DEFERRED); return b; -- 2.25.1