summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-10 18:19:05 +0200
committermadmaxoft <github@xoft.cz>2014-07-10 18:19:05 +0200
commit3b7e0969b98ecbd1d499a9ac2edd22a619ae5591 (patch)
tree0ea2101bdbb7a63e8f36fe849afd965231bc71db
parentImplemented support for forced chunk ticking. (diff)
downloadcuberite-3b7e0969b98ecbd1d499a9ac2edd22a619ae5591.tar
cuberite-3b7e0969b98ecbd1d499a9ac2edd22a619ae5591.tar.gz
cuberite-3b7e0969b98ecbd1d499a9ac2edd22a619ae5591.tar.bz2
cuberite-3b7e0969b98ecbd1d499a9ac2edd22a619ae5591.tar.lz
cuberite-3b7e0969b98ecbd1d499a9ac2edd22a619ae5591.tar.xz
cuberite-3b7e0969b98ecbd1d499a9ac2edd22a619ae5591.tar.zst
cuberite-3b7e0969b98ecbd1d499a9ac2edd22a619ae5591.zip
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index deb6a720b..918204deb 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -31,6 +31,8 @@ function Initialize(Plugin)
PM:AddHook(cPluginManager.HOOK_PLUGIN_MESSAGE, OnPluginMessage);
PM:AddHook(cPluginManager.HOOK_PLAYER_JOINED, OnPlayerJoined);
PM:AddHook(cPluginManager.HOOK_PROJECTILE_HIT_BLOCK, OnProjectileHitBlock);
+ PM:AddHook(cPluginManager.HOOK_CHUNK_UNLOADING, OnChunkUnloading);
+ PM:AddHook(cPluginManager.HOOK_WORLD_STARTED, OnWorldStarted);
-- _X: Disabled so that the normal operation doesn't interfere with anything
-- PM:AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated);
@@ -1382,6 +1384,7 @@ end
function OnProjectileHitBlock(a_Projectile, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockHitPos)
+ -- Test projectile hooks by setting the blocks they hit on fire:
local BlockX, BlockY, BlockZ = AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace)
local World = a_Projectile:GetWorld()
@@ -1391,3 +1394,28 @@ end
+
+function OnChunkUnloading(a_World, a_ChunkX, a_ChunkZ)
+ -- Do not let chunk [0, 0] unload, so that it continues ticking [cWorld:SetChunkAlwaysTicked() test]
+ if ((a_ChunkX == 0) and (a_ChunkZ == 0)) then
+ return true
+ end
+end
+
+
+
+
+
+function OnWorldStarted(a_World)
+ -- Make the chunk [0, 0] in every world keep ticking [cWorld:SetChunkAlwaysTicked() test]
+ a_World:ChunkStay({{0, 0}}, nil,
+ function()
+ -- The chunk is loaded, make it always tick:
+ a_World:SetChunkAlwaysTicked(0, 0, true)
+ end
+ )
+end
+
+
+
+