diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-03-16 16:12:16 +0100 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-03-27 23:20:28 +0100 |
commit | 54d55b31ef9b17673212184ac523f6f2a964338d (patch) | |
tree | df88721405d1d729de04ed6d57db81d47453a42e /MCServer | |
parent | Add SpreadSource (diff) | |
download | cuberite-54d55b31ef9b17673212184ac523f6f2a964338d.tar cuberite-54d55b31ef9b17673212184ac523f6f2a964338d.tar.gz cuberite-54d55b31ef9b17673212184ac523f6f2a964338d.tar.bz2 cuberite-54d55b31ef9b17673212184ac523f6f2a964338d.tar.lz cuberite-54d55b31ef9b17673212184ac523f6f2a964338d.tar.xz cuberite-54d55b31ef9b17673212184ac523f6f2a964338d.tar.zst cuberite-54d55b31ef9b17673212184ac523f6f2a964338d.zip |
Diffstat (limited to '')
-rw-r--r-- | MCServer/Plugins/APIDump/APIDesc.lua | 9 | ||||
-rw-r--r-- | MCServer/Plugins/APIDump/Hooks/OnBlockSpread.lua | 40 |
2 files changed, 49 insertions, 0 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 74e7bf860..92b57865f 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1826,6 +1826,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); }, Constants = { + HOOK_BLOCK_SPREAD = { Notes = "Called when a block spreads based on world conditions" }, HOOK_BLOCK_TO_PICKUPS = { Notes = "Called when a block has been dug and is being converted to pickups. The server has provided the default pickups and the plugins may modify them." }, HOOK_CHAT = { Notes = "Called when a client sends a chat message that is not a command. The plugin may modify the chat message" }, HOOK_CHUNK_AVAILABLE = { Notes = "Called when a chunk is loaded or generated and becomes available in the {{cWorld|world}}." }, @@ -2767,6 +2768,14 @@ end data provided with the explosions, such as the exploding {{cCreeper|creeper}} entity or the {{Vector3i|coords}} of the exploding bed. ]], + }, + SpreadSource = + { + Include = "^es.*", + TextBefore = [[ + These constants are used to differentiate the various sources of spreads. They are used in + the {{OnBlockSpread|HOOK_BLOCK_SPREAD}} hook. + ]], } }, }, -- Globals diff --git a/MCServer/Plugins/APIDump/Hooks/OnBlockSpread.lua b/MCServer/Plugins/APIDump/Hooks/OnBlockSpread.lua new file mode 100644 index 000000000..1dde55f36 --- /dev/null +++ b/MCServer/Plugins/APIDump/Hooks/OnBlockSpread.lua @@ -0,0 +1,40 @@ +return +{ + HOOK_BLOCK_SPREAD = + { + CalledWhen = "Called when a block spreads based on world conditions", + DefaultFnName = "OnBlockSpread", -- also used as pagename + Desc = [[ + This hook is called when a block spreads.</p> + <p> + The explosion carries with it the type of its source - whether it's a creeper exploding, or TNT, + etc. It also carries the identification of the actual source. The exact type of the identification + depends on the source kind: + <table> + <tr><th>Source</th><th>Notes</th></tr> + <tr><td>esFireSpread</td><td>Fire spreading</td></tr> + <tr><td>esGrassSpread</td><td>Grass spreading</td></tr> + <tr><td>esMushroomSpread</td><td>Mushroom spreading</td></tr> + <tr><td>esMycelSpread</td><td>Mycel spreading</td></tr> + <tr><td>esVineSpread</td><td>Vine spreading</td></tr> + </table></p> + ]], + Params = + { + { Name = "World", Type = "{{cWorld}}", Notes = "The world in which the block resides" }, + { Name = "BlockX", Type = "number", Notes = "X-coord of the block" }, + { Name = "BlockY", Type = "number", Notes = "Y-coord of the block" }, + { Name = "BlockZ", Type = "number", Notes = "Z-coord of the block" }, + { Name = "Source", Type = "eSpreadSource", Notes = "Source of the spread. See the table above." }, + }, + Returns = [[ + If the function returns false or no value, the next plugin's callback is called, and finally + MCServer will process the spread. If the function + returns true, no other callback is called for this event and the spread will not occur. + ]], + }, -- HOOK_BLOCK_SPREAD +} + + + + |