1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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.
This commit is contained in:
paramat 2017-11-18 20:37:00 +00:00 committed by paramat
parent c655984849
commit 4b553ece09
4 changed files with 35 additions and 18 deletions

View file

@ -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: