mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Do not add group values of zero to group lists. (#8751)
This fixes an issue where when the engine looked up groups (for example, in ABM node names), NodeDefManager's m_group_to_items would contain nodes with a group value of zero, resulting in nodes with flammable = 0 being burned by a fire mod with a group:flammable checking ABM. It brings consistency to the behaviour described in the api documentation, where zero and nil groups should be the same.
This commit is contained in:
parent
233cb86e86
commit
4d7f296717
@ -1535,6 +1535,8 @@ void read_groups(lua_State *L, int index, ItemGroupList &result)
|
||||
// key at index -2 and value at index -1
|
||||
std::string name = luaL_checkstring(L, -2);
|
||||
int rating = luaL_checkinteger(L, -1);
|
||||
// zero rating indicates not in the group
|
||||
if (rating != 0)
|
||||
result[name] = rating;
|
||||
// removes value, keeps key for next iteration
|
||||
lua_pop(L, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user