summaryrefslogtreecommitdiffstats
path: root/MCServer
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-15 09:49:40 +0100
committermadmaxoft <github@xoft.cz>2013-11-15 09:49:56 +0100
commit7fddf4479df7f454d340c23c1a93b982dbbbee4d (patch)
tree8b7badeea1255abd9e8a25b3c5aca14be46d78cd /MCServer
parentRemoved BlockEntities' constructors from the API. (diff)
downloadcuberite-7fddf4479df7f454d340c23c1a93b982dbbbee4d.tar
cuberite-7fddf4479df7f454d340c23c1a93b982dbbbee4d.tar.gz
cuberite-7fddf4479df7f454d340c23c1a93b982dbbbee4d.tar.bz2
cuberite-7fddf4479df7f454d340c23c1a93b982dbbbee4d.tar.lz
cuberite-7fddf4479df7f454d340c23c1a93b982dbbbee4d.tar.xz
cuberite-7fddf4479df7f454d340c23c1a93b982dbbbee4d.tar.zst
cuberite-7fddf4479df7f454d340c23c1a93b982dbbbee4d.zip
Diffstat (limited to 'MCServer')
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 04a15a002..248433ddd 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -26,6 +26,7 @@ function Initialize(Plugin)
cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat);
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity);
cPluginManager.AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick);
+ cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated);
PluginManager = cRoot:Get():GetPluginManager();
PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities");
@@ -531,6 +532,27 @@ end
+function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)
+ -- Get the topmost block coord:
+ local Height = a_ChunkDesc:GetHeight(0, 0);
+
+ -- Create a sign there:
+ a_ChunkDesc:SetBlockTypeMeta(0, Height + 1, 0, E_BLOCK_SIGN_POST, 0);
+ local BlockEntity = a_ChunkDesc:GetBlockEntity(0, Height + 1, 0);
+ if (BlockEntity ~= nil) then
+ LOG("Setting sign lines...");
+ local SignEntity = tolua.cast(BlockEntity, "cSignEntity");
+ SignEntity:SetLines("Chunk:", tonumber(a_ChunkX) .. ", " .. tonumber(a_ChunkZ), "", "(Debuggers)");
+ end
+
+ -- Update the heightmap:
+ a_ChunkDesc:SetHeight(0, 0, Height + 1);
+end
+
+
+
+
+
-- Function "round" copied from http://lua-users.org/wiki/SimpleRound
function round(num, idp)
local mult = 10^(idp or 0)