mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix minetest.dig_node returning true when node isn't diggable (#10890)
This commit is contained in:
parent
d1ec5117d9
commit
6e0e0324a4
3 changed files with 14 additions and 5 deletions
|
@ -141,9 +141,14 @@ bool ScriptApiNode::node_on_dig(v3s16 p, MapNode node,
|
|||
push_v3s16(L, p);
|
||||
pushnode(L, node, ndef);
|
||||
objectrefGetOrCreate(L, digger);
|
||||
PCALL_RES(lua_pcall(L, 3, 0, error_handler));
|
||||
lua_pop(L, 1); // Pop error handler
|
||||
return true;
|
||||
PCALL_RES(lua_pcall(L, 3, 1, error_handler));
|
||||
|
||||
// nil is treated as true for backwards compat
|
||||
bool result = lua_isnil(L, -1) || lua_toboolean(L, -1);
|
||||
|
||||
lua_pop(L, 2); // Pop error handler and result
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void ScriptApiNode::node_on_construct(v3s16 p, MapNode node)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue