1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Call on_secondary_use when object is right-clicked

This commit is contained in:
sfan5 2019-11-10 00:36:29 +01:00
parent 3b0df9760b
commit 4d668f32a6
4 changed files with 15 additions and 7 deletions

View file

@ -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)) {

View file

@ -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,