aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_mapgen.cpp
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2017-11-18 20:37:00 +0000
committerparamat <mat.gregory@virginmedia.com>2017-11-19 00:25:39 +0000
commit4b553ece09908dfdee59e9841fdc9420350eda9f (patch)
tree9e40dbc3725fd8e19eb163ed2198641cbd384817 /src/script/lua_api/l_mapgen.cpp
parentc655984849d69e83f0221ff9fbf6ce3782be873f (diff)
downloadminetest-4b553ece09908dfdee59e9841fdc9420350eda9f.tar.gz
minetest-4b553ece09908dfdee59e9841fdc9420350eda9f.tar.bz2
minetest-4b553ece09908dfdee59e9841fdc9420350eda9f.zip
Stratum ore: Add option for a constant thickness stratum
Add a 'stratum thickness' integer parameter, as an alternative to providing a 2nd noise parameter for thickness variation.
Diffstat (limited to 'src/script/lua_api/l_mapgen.cpp')
-rw-r--r--src/script/lua_api/l_mapgen.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index 01f9d1c41..e39370323 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -1116,7 +1116,7 @@ int ModApiMapgen::l_register_ore(lua_State *L)
ore->flags |= OREFLAG_USE_NOISE;
} else if (ore->NEEDS_NOISE) {
errorstream << "register_ore: specified ore type requires valid "
- "noise parameters" << std::endl;
+ "'noise_params' parameter" << std::endl;
delete ore;
return 0;
}
@@ -1161,11 +1161,13 @@ int ModApiMapgen::l_register_ore(lua_State *L)
OreStratum *orestratum = (OreStratum *)ore;
lua_getfield(L, index, "np_stratum_thickness");
- // If thickness noise missing unset 'use noise' flag
- if (!read_noiseparams(L, -1, &orestratum->np_stratum_thickness))
- ore->flags &= ~OREFLAG_USE_NOISE;
+ if (read_noiseparams(L, -1, &orestratum->np_stratum_thickness))
+ ore->flags |= OREFLAG_USE_NOISE2;
lua_pop(L, 1);
+ orestratum->stratum_thickness = getintfield_default(L, index,
+ "stratum_thickness", 8);
+
break;
}
default: