Document item use callbacks (#4668)

This commit is contained in:
raymoo 2016-10-26 20:24:34 -07:00 committed by Zeno-
parent 198ed60cab
commit 1fd9a07497
1 changed files with 5 additions and 0 deletions

View File

@ -3593,15 +3593,18 @@ Definition tables
on_place = func(itemstack, placer, pointed_thing), on_place = func(itemstack, placer, pointed_thing),
--[[ --[[
^ Shall place item and return the leftover itemstack ^ Shall place item and return the leftover itemstack
^ The placer may be any ObjectRef or nil.
^ default: minetest.item_place ]] ^ default: minetest.item_place ]]
on_secondary_use = func(itemstack, user, pointed_thing), on_secondary_use = func(itemstack, user, pointed_thing),
--[[ --[[
^ Same as on_place but called when pointing at nothing. ^ Same as on_place but called when pointing at nothing.
^ The user may be any ObjectRef or nil.
^ pointed_thing : always { type = "nothing" } ^ pointed_thing : always { type = "nothing" }
]] ]]
on_drop = func(itemstack, dropper, pos), on_drop = func(itemstack, dropper, pos),
--[[ --[[
^ Shall drop item and return the leftover itemstack ^ Shall drop item and return the leftover itemstack
^ The dropper may be any ObjectRef or nil.
^ default: minetest.item_drop ]] ^ default: minetest.item_drop ]]
on_use = func(itemstack, user, pointed_thing), on_use = func(itemstack, user, pointed_thing),
--[[ --[[
@ -3610,6 +3613,7 @@ Definition tables
inventory, or an itemstack to replace the original itemstack. inventory, or an itemstack to replace the original itemstack.
e.g. itemstack:take_item(); return itemstack e.g. itemstack:take_item(); return itemstack
^ Otherwise, the function is free to do what it wants. ^ Otherwise, the function is free to do what it wants.
^ The user may be any ObjectRef or nil.
^ The default functions handle regular use cases. ^ The default functions handle regular use cases.
]] ]]
after_use = func(itemstack, user, node, digparams), after_use = func(itemstack, user, node, digparams),
@ -3622,6 +3626,7 @@ Definition tables
itemstack:add_wear(digparams.wear) itemstack:add_wear(digparams.wear)
return itemstack return itemstack
end end
^ The user may be any ObjectRef or nil.
]] ]]
} }