mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Rework functionality of leveled nodes (#9852)
Co-authored-by: sfan5 <sfan5@live.de> Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
This commit is contained in:
parent
7d3972a504
commit
c94d37827d
8 changed files with 79 additions and 34 deletions
|
@ -694,6 +694,8 @@ ContentFeatures read_content_features(lua_State *L, int index)
|
|||
f.liquid_range = getintfield_default(L, index,
|
||||
"liquid_range", f.liquid_range);
|
||||
f.leveled = getintfield_default(L, index, "leveled", f.leveled);
|
||||
f.leveled_max = getintfield_default(L, index,
|
||||
"leveled_max", f.leveled_max);
|
||||
|
||||
getboolfield(L, index, "liquid_renewable", f.liquid_renewable);
|
||||
f.drowning = getintfield_default(L, index,
|
||||
|
@ -860,6 +862,8 @@ void push_content_features(lua_State *L, const ContentFeatures &c)
|
|||
lua_setfield(L, -2, "post_effect_color");
|
||||
lua_pushnumber(L, c.leveled);
|
||||
lua_setfield(L, -2, "leveled");
|
||||
lua_pushnumber(L, c.leveled_max);
|
||||
lua_setfield(L, -2, "leveled_max");
|
||||
lua_pushboolean(L, c.sunlight_propagates);
|
||||
lua_setfield(L, -2, "sunlight_propagates");
|
||||
lua_pushnumber(L, c.light_source);
|
||||
|
|
|
@ -529,13 +529,13 @@ int ModApiEnvMod::l_set_node_level(lua_State *L)
|
|||
|
||||
// add_node_level(pos, level)
|
||||
// pos = {x=num, y=num, z=num}
|
||||
// level: 0..63
|
||||
// level: -127..127
|
||||
int ModApiEnvMod::l_add_node_level(lua_State *L)
|
||||
{
|
||||
GET_ENV_PTR;
|
||||
|
||||
v3s16 pos = read_v3s16(L, 1);
|
||||
u8 level = 1;
|
||||
s16 level = 1;
|
||||
if(lua_isnumber(L, 2))
|
||||
level = lua_tonumber(L, 2);
|
||||
MapNode n = env->getMap().getNode(pos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue