diff options
Diffstat (limited to 'src/script/common')
-rw-r--r-- | src/script/common/c_content.cpp | 22 | ||||
-rw-r--r-- | src/script/common/c_content.h | 4 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 799251bcf..1c78f139f 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -975,11 +975,11 @@ void luaentity_get(lua_State *L, u16 id) } /******************************************************************************/ -NoiseParams *read_noiseparams(lua_State *L, int index) +NoiseParams *get_noiseparams(lua_State *L, int index) { NoiseParams *np = new NoiseParams; - if (!read_noiseparams_nc(L, index, np)) { + if (!read_noiseparams(L, index, np)) { delete np; np = NULL; } @@ -987,7 +987,7 @@ NoiseParams *read_noiseparams(lua_State *L, int index) return np; } -bool read_noiseparams_nc(lua_State *L, int index, NoiseParams *np) +bool read_noiseparams(lua_State *L, int index, NoiseParams *np) { if (index < 0) index = lua_gettop(L) + 1 + index; @@ -995,12 +995,16 @@ bool read_noiseparams_nc(lua_State *L, int index, NoiseParams *np) if (!lua_istable(L, index)) return false; - np->offset = getfloatfield_default(L, index, "offset", 0.0); - np->scale = getfloatfield_default(L, index, "scale", 0.0); - np->persist = getfloatfield_default(L, index, "persist", 0.0); - np->seed = getintfield_default(L, index, "seed", 0); - np->octaves = getintfield_default(L, index, "octaves", 0); - np->eased = getboolfield_default(L, index, "eased", false); + np->offset = getfloatfield_default(L, index, "offset", 0.0); + np->scale = getfloatfield_default(L, index, "scale", 0.0); + np->persist = getfloatfield_default(L, index, "persist", 0.0); + np->lacunarity = getfloatfield_default(L, index, "lacunarity", 2.0); + np->seed = getintfield_default(L, index, "seed", 0); + np->octaves = getintfield_default(L, index, "octaves", 0); + + u32 flags = 0, flagmask = 0; + np->flags = getflagsfield(L, index, "flags", flagdesc_noiseparams, + &flags, &flagmask) ? flags : NOISE_FLAG_DEFAULTS; lua_getfield(L, index, "spread"); np->spread = read_v3f(L, -1); diff --git a/src/script/common/c_content.h b/src/script/common/c_content.h index 5b4dff2bd..02e3e29fa 100644 --- a/src/script/common/c_content.h +++ b/src/script/common/c_content.h @@ -147,9 +147,9 @@ bool string_to_enum (const EnumString *spec, int &result, const std::string &str); -NoiseParams* read_noiseparams (lua_State *L, int index); +NoiseParams* get_noiseparams (lua_State *L, int index); -bool read_noiseparams_nc (lua_State *L, int index, +bool read_noiseparams (lua_State *L, int index, NoiseParams *np); bool get_schematic (lua_State *L, int index, Schematic *schem, |