diff options
author | paramat <mat.gregory@virginmedia.com> | 2015-06-19 00:17:03 +0100 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2015-06-20 04:16:17 +0100 |
commit | 70da8a940b054d0ad22168af47fed4b7c091914f (patch) | |
tree | 2153fd4c5f421a5a7374553c3863b65bbb590bda /src/script/lua_api | |
parent | d7190df07ec92067ab5f40086df84ab30994bf87 (diff) | |
download | minetest-70da8a940b054d0ad22168af47fed4b7c091914f.tar.gz minetest-70da8a940b054d0ad22168af47fed4b7c091914f.tar.bz2 minetest-70da8a940b054d0ad22168af47fed4b7c091914f.zip |
Mapgen objects: Enable heatmap and humidmap for all biome api mapgens
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_mapgen.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp index 1a462adf7..2d67e2f29 100644 --- a/src/script/lua_api/l_mapgen.cpp +++ b/src/script/lua_api/l_mapgen.cpp @@ -510,21 +510,26 @@ int ModApiMapgen::l_get_mapgen_object(lua_State *L) return 1; } - case MGOBJ_HEATMAP: { // Mapgen V7 specific objects - case MGOBJ_HUMIDMAP: - if (strcmp(emerge->params.mg_name.c_str(), "v7")) + case MGOBJ_HEATMAP: { + if (!mg->heatmap) return 0; - MapgenV7 *mgv7 = (MapgenV7 *)mg; + lua_newtable(L); + for (size_t i = 0; i != maplen; i++) { + lua_pushnumber(L, mg->heatmap[i]); + lua_rawseti(L, -2, i + 1); + } + + return 1; + } - float *arr = (mgobj == MGOBJ_HEATMAP) ? - mgv7->noise_heat->result : mgv7->noise_humidity->result; - if (!arr) + case MGOBJ_HUMIDMAP: { + if (!mg->humidmap) return 0; lua_newtable(L); for (size_t i = 0; i != maplen; i++) { - lua_pushnumber(L, arr[i]); + lua_pushnumber(L, mg->humidmap[i]); lua_rawseti(L, -2, i + 1); } |