1
0
cuberite-2a/Server/Plugins/APIDump/Hooks/OnDropSpense.lua
KrystilizeNevaDies 23bca00831
Implement Dropspenser Hook (#4903)
* Implement Dropspenser Hook

Implemented a hook for dropspensing.
HOOK_DROPSPENSE

When plugin callback returns true then dropspense is cancelled

* Update src/Bindings/PluginManager.h

Co-authored-by: peterbell10 <peterbell10@live.co.uk>

* Create OnDropSpense.lua

* Fix indent

* Forgot include

Forgot to include the plugin manager. Although now im confused why it was working on my end without including the plugin manager

* Update plugins.lua with dropspense

* fix typos

* haha notepad++ go brr

Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-09-21 15:31:45 +00:00

27 lines
980 B
Lua

return
{
HOOK_DROPSPENSE =
{
CalledWhen = "A dispenser or dropper is about to dispense/drop an item.",
DefaultFnName = "OnDropSpense", -- also used as pagename
Desc = [[
This callback is called whenever a {{cDropSpenserEntity|dropspenser}} dropspenses an {{cItem|item}}. A plugin may decide to disallow
the move by returning true.
]],
Params =
{
{ Name = "World", Type = "{{cWorld}}", Notes = "World where the dropspenser resides" },
{ Name = "DropSpenser", Type = "{{cDropSpenserEntity}}", Notes = "The dropspenser that is pulling the item" },
{ Name = "SlotNum", Type = "number", Notes = "The slot of the dropspensed item in the dropspenser's {{cItemGrid|internal storage}}" },
},
Returns = [[
If the function returns false or no value, the next plugin's callback is called. If the function
returns true, no other callback is called for this event and the dropspenser will not dropspense the item.
]],
}, -- HOOK_DROPSPENSE
}