mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Implement check_offset for decorations
This commit is contained in:
parent
c91182e1b3
commit
ba80d1ce1f
4 changed files with 32 additions and 12 deletions
|
@ -1097,6 +1097,7 @@ int ModApiMapgen::l_register_decoration(lua_State *L)
|
|||
deco->y_max = getintfield_default(L, index, "y_max", 31000);
|
||||
deco->nspawnby = getintfield_default(L, index, "num_spawn_by", -1);
|
||||
deco->place_offset_y = getintfield_default(L, index, "place_offset_y", 0);
|
||||
deco->check_offset = getintfield_default(L, index, "check_offset", -1);
|
||||
deco->sidelen = getintfield_default(L, index, "sidelen", 8);
|
||||
if (deco->sidelen <= 0) {
|
||||
errorstream << "register_decoration: sidelen must be "
|
||||
|
@ -1131,6 +1132,10 @@ int ModApiMapgen::l_register_decoration(lua_State *L)
|
|||
errorstream << "register_decoration: no spawn_by nodes defined,"
|
||||
" but num_spawn_by specified" << std::endl;
|
||||
}
|
||||
if (deco->check_offset < -1 || deco->check_offset > 1) {
|
||||
delete deco;
|
||||
luaL_error(L, "register_decoration: check_offset out of range! Allowed values: [-1, 0, 1]");
|
||||
}
|
||||
|
||||
//// Handle decoration type-specific parameters
|
||||
bool success = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue