From 56a0c48580f231aa73b0a4a577fe048afcbcafac Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Fri, 29 Jul 2016 14:44:39 +0100 Subject: [PATCH] Added additional examples to the documentation for HOOK_BLOCK_SPREAD. (#3277) Fixes issue #3274 --- .../Plugins/APIDump/Hooks/OnBlockSpread.lua | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Server/Plugins/APIDump/Hooks/OnBlockSpread.lua b/Server/Plugins/APIDump/Hooks/OnBlockSpread.lua index 7da796d4d..4d6dac21a 100644 --- a/Server/Plugins/APIDump/Hooks/OnBlockSpread.lua +++ b/Server/Plugins/APIDump/Hooks/OnBlockSpread.lua @@ -32,9 +32,25 @@ return Cuberite will process the spread. If the function returns true, no other callback is called for this event and the spread will not occur. ]], + Examples = + { + { + Title = "Stop fire spreading", + Desc = "Stops fire from spreading, but does not remove any player-placed fire.", + Code = [[ + function OnBlockSpread(World, BlockX, Blocky, BlockZ, source) + if (source == ssFireSpread) then + -- Return true to block the fire spreading. + return true + end + -- We don't care about any other events, let them continue. + return false + end + + -- Add the callback. + cPluginManager:AddHook(cPluginManager.HOOK_BLOCK_SPREAD, OnBlockSpread); + ]], + }, + }, }, -- HOOK_BLOCK_SPREAD } - - - -