aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2019-11-10 00:36:29 +0100
committersfan5 <sfan5@live.de>2019-11-10 13:12:31 +0100
commit4d668f32a6d9a0d895a2385dec994d43bd084410 (patch)
tree83794c0ae69813f73df258072ab53aae1b7a1dd6 /src/script
parent3b0df9760b9630ddba1983ecb4c6e4f0f8857149 (diff)
downloadminetest-4d668f32a6d9a0d895a2385dec994d43bd084410.tar.gz
minetest-4d668f32a6d9a0d895a2385dec994d43bd084410.tar.bz2
minetest-4d668f32a6d9a0d895a2385dec994d43bd084410.zip
Call on_secondary_use when object is right-clicked
Diffstat (limited to 'src/script')
-rw-r--r--src/script/cpp_api/s_item.cpp5
-rw-r--r--src/script/cpp_api/s_item.h2
2 files changed, 3 insertions, 4 deletions
diff --git a/src/script/cpp_api/s_item.cpp b/src/script/cpp_api/s_item.cpp
index cbdfcf1b1..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)) {
diff --git a/src/script/cpp_api/s_item.h b/src/script/cpp_api/s_item.h
index 6c7f286a9..ad229f73e 100644
--- a/src/script/cpp_api/s_item.h
+++ b/src/script/cpp_api/s_item.h
@@ -42,7 +42,7 @@ public:
bool item_OnUse(ItemStack &item,
ServerActiveObject *user, const PointedThing &pointed);
bool item_OnSecondaryUse(ItemStack &item,
- ServerActiveObject *user);
+ ServerActiveObject *user, const PointedThing &pointed);
bool item_OnCraft(ItemStack &item, ServerActiveObject *user,
const InventoryList *old_craft_grid, const InventoryLocation &craft_inv);
bool item_CraftPredict(ItemStack &item, ServerActiveObject *user,