forked from Mirrorlandia_minetest/minetest
Pass ContentFeatures as reference to read_content_features (#10464)
This commit is contained in:
parent
d671102546
commit
11f3deb9c4
@ -491,13 +491,11 @@ TileDef read_tiledef(lua_State *L, int index, u8 drawtype)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
ContentFeatures read_content_features(lua_State *L, int index)
|
void read_content_features(lua_State *L, ContentFeatures &f, int index)
|
||||||
{
|
{
|
||||||
if(index < 0)
|
if(index < 0)
|
||||||
index = lua_gettop(L) + 1 + index;
|
index = lua_gettop(L) + 1 + index;
|
||||||
|
|
||||||
ContentFeatures f;
|
|
||||||
|
|
||||||
/* Cache existence of some callbacks */
|
/* Cache existence of some callbacks */
|
||||||
lua_getfield(L, index, "on_construct");
|
lua_getfield(L, index, "on_construct");
|
||||||
if(!lua_isnil(L, -1)) f.has_on_construct = true;
|
if(!lua_isnil(L, -1)) f.has_on_construct = true;
|
||||||
@ -800,7 +798,6 @@ ContentFeatures read_content_features(lua_State *L, int index)
|
|||||||
getstringfield(L, index, "node_dig_prediction",
|
getstringfield(L, index, "node_dig_prediction",
|
||||||
f.node_dig_prediction);
|
f.node_dig_prediction);
|
||||||
|
|
||||||
return f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void push_content_features(lua_State *L, const ContentFeatures &c)
|
void push_content_features(lua_State *L, const ContentFeatures &c)
|
||||||
|
@ -67,7 +67,8 @@ struct collisionMoveResult;
|
|||||||
|
|
||||||
extern struct EnumString es_TileAnimationType[];
|
extern struct EnumString es_TileAnimationType[];
|
||||||
|
|
||||||
ContentFeatures read_content_features (lua_State *L, int index);
|
void read_content_features (lua_State *L, ContentFeatures &f,
|
||||||
|
int index);
|
||||||
void push_content_features (lua_State *L,
|
void push_content_features (lua_State *L,
|
||||||
const ContentFeatures &c);
|
const ContentFeatures &c);
|
||||||
|
|
||||||
|
@ -570,7 +570,8 @@ int ModApiItemMod::l_register_item_raw(lua_State *L)
|
|||||||
|
|
||||||
// Read the node definition (content features) and register it
|
// Read the node definition (content features) and register it
|
||||||
if (def.type == ITEM_NODE) {
|
if (def.type == ITEM_NODE) {
|
||||||
ContentFeatures f = read_content_features(L, table);
|
ContentFeatures f;
|
||||||
|
read_content_features(L, f, table);
|
||||||
// when a mod reregisters ignore, only texture changes and such should
|
// when a mod reregisters ignore, only texture changes and such should
|
||||||
// be done
|
// be done
|
||||||
if (f.name == "ignore")
|
if (f.name == "ignore")
|
||||||
|
Loading…
Reference in New Issue
Block a user