From 752057fb1b3a71058b5391bde9b0e21d87196539 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 13 Jan 2013 11:10:26 +0000 Subject: Forgotten files for previous merge commit (rev 1139) git-svn-id: http://mc-server.googlecode.com/svn/trunk@1140 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/Debuggers/Debuggers.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'MCServer/Plugins/Debuggers') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 5550f0335..f2f3f9570 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -13,7 +13,7 @@ function Initialize(Plugin) Plugin:SetVersion(1) PluginManager = cRoot:Get():GetPluginManager() - PluginManager:AddHook(Plugin, cPluginManager.E_PLUGIN_BLOCK_PLACE) + PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM) PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE) LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) @@ -24,13 +24,15 @@ end -function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem) +function OnPlayerUsingItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ) -- dont check if the direction is in the air - if BlockFace == BLOCK_FACE_NONE then + if (BlockFace == BLOCK_FACE_NONE) then return false end + local HeldItem = Player:GetEquippedItem(); + if (HeldItem.m_ItemType == E_ITEM_STICK) then -- Magic sTick of ticking: set the pointed block for ticking at the next tick Player:SendMessage(cChatColor.LightGray .. "Setting next block tick to {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}") @@ -42,7 +44,9 @@ function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem) -- Magic rod of query: show block types and metas for both neighbors of the pointed face local Type = 0; local Meta = 0; - Type, Meta = Player:GetWorld():GetBlockTypeMeta(BlockX, BlockY, BlockZ, Type, Meta); + local Valid = false; + Valid, Type, Meta = Player:GetWorld():GetBlockTypeMeta(BlockX, BlockY, BlockZ, Type, Meta); + if (Type == E_BLOCK_AIR) then Player:SendMessage(cChatColor.LightGray .. "Block {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: air:" .. Meta); else @@ -53,8 +57,8 @@ function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem) local X = BlockX; local Y = BlockY; local Z = BlockZ; - X, Y, Z = AddDirection(BlockX, BlockY, BlockZ, BlockFace); - Type, Meta = Player:GetWorld():GetBlockTypeMeta(X, Y, Z, Type, Meta); + X, Y, Z = AddFaceDirection(BlockX, BlockY, BlockZ, BlockFace); + Valid, Type, Meta = Player:GetWorld():GetBlockTypeMeta(X, Y, Z, Type, Meta); if (Type == E_BLOCK_AIR) then Player:SendMessage(cChatColor.LightGray .. "Block {" .. X .. ", " .. Y .. ", " .. Z .. "}: air:" .. Meta); else -- cgit v1.2.3