Unkown nodes: Provide position on interact (#6505)
* Unkown nodes: Provide position on interact
This commit is contained in:
@@ -211,7 +211,8 @@ bool ScriptApiItem::item_CraftPredict(ItemStack &item, ServerActiveObject *user,
|
||||
// function onto the stack
|
||||
// If core.registered_items[name] doesn't exist, core.nodedef_default
|
||||
// is tried instead so unknown items can still be manipulated to some degree
|
||||
bool ScriptApiItem::getItemCallback(const char *name, const char *callbackname)
|
||||
bool ScriptApiItem::getItemCallback(const char *name, const char *callbackname,
|
||||
const v3s16 *p)
|
||||
{
|
||||
lua_State* L = getStack();
|
||||
|
||||
@@ -222,10 +223,12 @@ bool ScriptApiItem::getItemCallback(const char *name, const char *callbackname)
|
||||
lua_getfield(L, -1, name);
|
||||
lua_remove(L, -2); // Remove registered_items
|
||||
// Should be a table
|
||||
if(lua_type(L, -1) != LUA_TTABLE)
|
||||
{
|
||||
if (lua_type(L, -1) != LUA_TTABLE) {
|
||||
// Report error and clean up
|
||||
errorstream << "Item \"" << name << "\" not defined" << std::endl;
|
||||
errorstream << "Item \"" << name << "\" not defined";
|
||||
if (p)
|
||||
errorstream << " at position " << PP(*p);
|
||||
errorstream << std::endl;
|
||||
lua_pop(L, 1);
|
||||
|
||||
// Try core.nodedef_default instead
|
||||
|
||||
Reference in New Issue
Block a user