From ab371cc93491baf0973ecc94b96c3a1fdb4abfd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Juh=C3=A1sz?= Date: Sat, 10 Dec 2016 19:02:44 +0100 Subject: Light calculation: New bulk node lighting code This commit introduces a new bulk node lighting algorithm to minimize lighting bugs during l-system tree generation, schematic placement and non-mapgen-object lua voxelmanip light calculation. If the block above the changed area is not loaded, it gets loaded to avoid lighting bugs. Light is updated as soon as write_to_map is called on a voxel manipulator, therefore update_map does nothing. --- src/script/lua_api/l_mapgen.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/script/lua_api/l_mapgen.cpp') diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp index bc1c32f03..0bc9e25f7 100644 --- a/src/script/lua_api/l_mapgen.cpp +++ b/src/script/lua_api/l_mapgen.cpp @@ -1357,7 +1357,9 @@ int ModApiMapgen::l_place_schematic(lua_State *L) { MAP_LOCK_REQUIRED; - Map *map = &(getEnv(L)->getMap()); + GET_ENV_PTR; + + ServerMap *map = &(env->getServerMap()); SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr; //// Read position -- cgit v1.2.3 From 46276414ed51d61dc29879ac85e861dc770d90da Mon Sep 17 00:00:00 2001 From: paramat Date: Mon, 13 Mar 2017 13:34:32 +0000 Subject: Get biome list: Downgrade missing biome message to infostream It is harmless for a biome listed in an ore or decoration registration to be missing. Now that we are registering certain biomes or not based on options (such as floatland biomes), the biome lists in ore and decoration registrations trigger these error messages, avoiding these error messages would need a large amount of duplication of ore and decoration registrations. --- src/script/lua_api/l_mapgen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/script/lua_api/l_mapgen.cpp') diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp index 0bc9e25f7..6d3171df9 100644 --- a/src/script/lua_api/l_mapgen.cpp +++ b/src/script/lua_api/l_mapgen.cpp @@ -419,7 +419,7 @@ size_t get_biome_list(lua_State *L, int index, if (is_single) { Biome *biome = get_or_load_biome(L, index, biomemgr); if (!biome) { - errorstream << "get_biome_list: failed to get biome '" + infostream << "get_biome_list: failed to get biome '" << (lua_isstring(L, index) ? lua_tostring(L, index) : "") << "'." << std::endl; return 1; @@ -438,7 +438,7 @@ size_t get_biome_list(lua_State *L, int index, Biome *biome = get_or_load_biome(L, -1, biomemgr); if (!biome) { fail_count++; - errorstream << "get_biome_list: failed to get biome '" + infostream << "get_biome_list: failed to get biome '" << (lua_isstring(L, -1) ? lua_tostring(L, -1) : "") << "'" << std::endl; continue; @@ -927,7 +927,7 @@ int ModApiMapgen::l_register_decoration(lua_State *L) //// Get biomes associated with this decoration (if any) lua_getfield(L, index, "biomes"); if (get_biome_list(L, -1, biomemgr, &deco->biomes)) - errorstream << "register_decoration: couldn't get all biomes " << std::endl; + infostream << "register_decoration: couldn't get all biomes " << std::endl; lua_pop(L, 1); //// Get node name(s) to 'spawn by' @@ -1092,7 +1092,7 @@ int ModApiMapgen::l_register_ore(lua_State *L) //// Get biomes associated with this decoration (if any) lua_getfield(L, index, "biomes"); if (get_biome_list(L, -1, bmgr, &ore->biomes)) - errorstream << "register_ore: couldn't get all biomes " << std::endl; + infostream << "register_ore: couldn't get all biomes " << std::endl; lua_pop(L, 1); //// Get noise parameters if needed -- cgit v1.2.3 From c07c642ab091b7250ecdc5defee1fec26ba73dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Mon, 8 May 2017 20:43:03 +0200 Subject: read_schematic_replacements: ensure fields are strings (#5726) * read_schematic_replacements: ensure fields are strings add a type check before reading strings on read_schematic_replacements deserializer * throw LuaError instead of asserting the whole client --- src/script/lua_api/l_mapgen.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/script/lua_api/l_mapgen.cpp') diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp index 6d3171df9..32eb7af84 100644 --- a/src/script/lua_api/l_mapgen.cpp +++ b/src/script/lua_api/l_mapgen.cpp @@ -325,14 +325,22 @@ void read_schematic_replacements(lua_State *L, int index, StringMap *replace_nam if (lua_istable(L, -1)) { // Old {{"x", "y"}, ...} format lua_rawgeti(L, -1, 1); + if (!lua_isstring(L, -1)) + throw LuaError("schematics: replace_from field is not a string"); replace_from = lua_tostring(L, -1); lua_pop(L, 1); lua_rawgeti(L, -1, 2); + if (!lua_isstring(L, -1)) + throw LuaError("schematics: replace_to field is not a string"); replace_to = lua_tostring(L, -1); lua_pop(L, 1); } else { // New {x = "y", ...} format + if (!lua_isstring(L, -2)) + throw LuaError("schematics: replace_from field is not a string"); replace_from = lua_tostring(L, -2); + if (!lua_isstring(L, -1)) + throw LuaError("schematics: replace_to field is not a string"); replace_to = lua_tostring(L, -1); } -- cgit v1.2.3