aboutsummaryrefslogtreecommitdiff
path: root/builtin/game
diff options
context:
space:
mode:
authorAlex Ford <gordion42@gmail.com>2015-11-18 12:26:09 -0700
committerparamat <mat.gregory@virginmedia.com>2015-12-02 02:18:44 +0000
commit97908cc65670d3f6cf2e286390bfea10f653aaa8 (patch)
tree49c1b4bb175990d7402590a78a9edd8bb804e6bc /builtin/game
parent57b429574ef92c62d202955535896b36845b88db (diff)
downloadminetest-97908cc65670d3f6cf2e286390bfea10f653aaa8.tar.gz
minetest-97908cc65670d3f6cf2e286390bfea10f653aaa8.tar.bz2
minetest-97908cc65670d3f6cf2e286390bfea10f653aaa8.zip
Add on_secondary_use when right clicking an item in the air
Diffstat (limited to 'builtin/game')
-rw-r--r--builtin/game/item.lua7
-rw-r--r--builtin/game/register.lua1
2 files changed, 8 insertions, 0 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index 44ec35cc9..6c2214ef6 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -347,6 +347,10 @@ function core.item_place(itemstack, placer, pointed_thing, param2)
return itemstack
end
+function core.item_secondary_use(itemstack, placer)
+ return itemstack
+end
+
function core.item_drop(itemstack, dropper, pos)
if dropper and dropper:is_player() then
local v = dropper:get_look_dir()
@@ -605,6 +609,7 @@ core.craftitemdef_default = {
-- Interaction callbacks
on_place = redef_wrapper(core, 'item_place'), -- core.item_place
on_drop = redef_wrapper(core, 'item_drop'), -- core.item_drop
+ on_secondary_use = redef_wrapper(core, 'item_secondary_use'),
on_use = nil,
}
@@ -622,6 +627,7 @@ core.tooldef_default = {
-- Interaction callbacks
on_place = redef_wrapper(core, 'item_place'), -- core.item_place
+ on_secondary_use = redef_wrapper(core, 'item_secondary_use'),
on_drop = redef_wrapper(core, 'item_drop'), -- core.item_drop
on_use = nil,
}
@@ -640,6 +646,7 @@ core.noneitemdef_default = { -- This is used for the hand and unknown items
-- Interaction callbacks
on_place = redef_wrapper(core, 'item_place'),
+ on_secondary_use = redef_wrapper(core, 'item_secondary_use'),
on_drop = nil,
on_use = nil,
}
diff --git a/builtin/game/register.lua b/builtin/game/register.lua
index 00bb23278..992fdf744 100644
--- a/builtin/game/register.lua
+++ b/builtin/game/register.lua
@@ -272,6 +272,7 @@ core.register_item(":unknown", {
description = "Unknown Item",
inventory_image = "unknown_item.png",
on_place = core.item_place,
+ on_secondary_use = core.item_secondary_use,
on_drop = core.item_drop,
groups = {not_in_creative_inventory=1},
diggable = true,