X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fscript%2Fcpp_api%2Fs_item.cpp;h=24955cefcb161ed7568480312fa9eb7d5469f9bf;hb=5146086a64d5eeb480948d612a008a2ec81455d4;hp=5d9d260831575ec5ff1746784a7465c135ac2acb;hpb=f547452685b299712ff5aa15bf06b4cd6069deec;p=minetest.git diff --git a/src/script/cpp_api/s_item.cpp b/src/script/cpp_api/s_item.cpp index 5d9d26083..24955cefc 100644 --- a/src/script/cpp_api/s_item.cpp +++ b/src/script/cpp_api/s_item.cpp @@ -115,7 +115,8 @@ bool ScriptApiItem::item_OnUse(ItemStack &item, return true; } -bool ScriptApiItem::item_OnSecondaryUse(ItemStack &item, ServerActiveObject *user) +bool ScriptApiItem::item_OnSecondaryUse(ItemStack &item, + ServerActiveObject *user, const PointedThing &pointed) { SCRIPTAPI_PRECHECKHEADER @@ -126,8 +127,6 @@ bool ScriptApiItem::item_OnSecondaryUse(ItemStack &item, ServerActiveObject *use LuaItemStack::create(L, item); objectrefGetOrCreate(L, user); - PointedThing pointed; - pointed.type = POINTEDTHING_NOTHING; pushPointedThing(pointed); PCALL_RES(lua_pcall(L, 3, 1, error_handler)); if (!lua_isnil(L, -1)) { @@ -177,7 +176,7 @@ bool ScriptApiItem::item_CraftPredict(ItemStack &item, ServerActiveObject *user, const InventoryList *old_craft_grid, const InventoryLocation &craft_inv) { SCRIPTAPI_PRECHECKHEADER - + sanity_check(old_craft_grid); int error_handler = PUSH_ERROR_HANDLER(L); lua_getglobal(L, "core"); @@ -255,10 +254,10 @@ bool ScriptApiItem::getItemCallback(const char *name, const char *callbackname, return false; } -void ScriptApiItem::pushPointedThing(const PointedThing& pointed) +void ScriptApiItem::pushPointedThing(const PointedThing &pointed, bool hitpoint) { lua_State* L = getStack(); - push_pointed_thing(L, pointed); + push_pointed_thing(L, pointed, false, hitpoint); }