summaryrefslogtreecommitdiffstats
path: root/MCServer
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-07-12 02:37:28 +0200
committerarchshift <admin@archshift.com>2014-07-12 02:37:28 +0200
commit83c69134c079ac204c2fda1f375987b9651510d6 (patch)
tree73e02b553e6f3218545d543f587ab25eb918c462 /MCServer
parentFor now, removed creator member from Entity Effect for pointer safety (diff)
parentSimplified the player data loading. (diff)
downloadcuberite-83c69134c079ac204c2fda1f375987b9651510d6.tar
cuberite-83c69134c079ac204c2fda1f375987b9651510d6.tar.gz
cuberite-83c69134c079ac204c2fda1f375987b9651510d6.tar.bz2
cuberite-83c69134c079ac204c2fda1f375987b9651510d6.tar.lz
cuberite-83c69134c079ac204c2fda1f375987b9651510d6.tar.xz
cuberite-83c69134c079ac204c2fda1f375987b9651510d6.tar.zst
cuberite-83c69134c079ac204c2fda1f375987b9651510d6.zip
Diffstat (limited to 'MCServer')
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua1
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua28
2 files changed, 29 insertions, 0 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index aa818fc11..0e626c580 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -2343,6 +2343,7 @@ end
{ Params = "BlockX, BlockY, BlockZ, BlockMeta", Return = "", Notes = "Sets the meta for the block at the specified coords." },
{ Params = "{{Vector3i|BlockCoords}}, BlockMeta", Return = "", Notes = "Sets the meta for the block at the specified coords." },
},
+ SetChunkAlwaysTicked = { Params = "ChunkX, ChunkZ, IsAlwaysTicked", Return = "", Notes = "Sets the chunk to always be ticked even when it doesn't contain any clients. IsAlwaysTicked set to true turns forced ticking on, set to false turns it off. Every call with 'true' should be paired with a later call with 'false', otherwise the ticking won't stop. Multiple actions can request ticking independently, the ticking will continue until the last call with 'false'. Note that when the chunk unloads, it loses the value of this flag." },
SetNextBlockTick = { Params = "BlockX, BlockY, BlockZ", Return = "", Notes = "Sets the blockticking to start at the specified block in the next tick." },
SetCommandBlockCommand = { Params = "BlockX, BlockY, BlockZ, Command", Return = "bool", Notes = "Sets the command to be executed in a command block at the specified coordinates. Returns if command was changed." },
SetCommandBlocksEnabled = { Params = "IsEnabled (bool)", Return = "", Notes = "Sets whether command blocks should be enabled on the (entire) server." },
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
+
+
+
+