mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Simple deco: Allow setting param2 value on placement
Schematics can already be placed with a param2 value, but not simple 1-node plant decorations of the simple type. This adds a `param2` field to the simple deco type that is checked to be between 0 and 255, and put to the placed node at mapgen. This can be used to put a degrotate value in, or e.g. a fill value for leveltype nodes, or a place_param2 value at mapgen placement, or vary the shape of meshoptions plantlike drawtype.
This commit is contained in:
parent
075833e393
commit
2e69711613
4 changed files with 12 additions and 2 deletions
|
@ -975,6 +975,7 @@ bool read_deco_simple(lua_State *L, DecoSimple *deco)
|
|||
|
||||
deco->deco_height = getintfield_default(L, index, "height", 1);
|
||||
deco->deco_height_max = getintfield_default(L, index, "height_max", 0);
|
||||
deco->deco_param2 = getintfield_default(L, index, "param2", 0);
|
||||
|
||||
if (deco->deco_height <= 0) {
|
||||
errorstream << "register_decoration: simple decoration height"
|
||||
|
@ -990,6 +991,12 @@ bool read_deco_simple(lua_State *L, DecoSimple *deco)
|
|||
return false;
|
||||
}
|
||||
|
||||
if ((deco->deco_param2 < 0) || (deco->deco_param2 > 255)) {
|
||||
errorstream << "register_decoration: param2 out of bounds (0-255)"
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue