From 1b9edb0279b008cf549d75fa3135c166503bf9bc Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 3 Sep 2014 23:05:49 +0200 Subject: Debuggers: Reviewed and fixed the Pickups and Poof commands. Now they're confirmed working. --- MCServer/Plugins/Debuggers/Debuggers.lua | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index ca764c959..0e7e647d5 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -1566,7 +1566,7 @@ local PossibleItems = cItem(E_ITEM_DIAMOND), cItem(E_ITEM_GOLD), cItem(E_ITEM_IRON), - cItem(E_ITEM_DYE, E_META_DYE_BLUE), -- Lapis lazuli + cItem(E_ITEM_DYE, 1, E_META_DYE_BLUE), -- Lapis lazuli cItem(E_ITEM_COAL), } @@ -1579,29 +1579,36 @@ function HandlePickups(a_Split, a_Player) local PlayerY = a_Player:GetPosY() local PlayerZ = a_Player:GetPosZ() local World = a_Player:GetWorld() - local Range = 15 + local Range = 12 for x = 0, Range do for z = 0, Range do - local x = PlayerX + x - Range / 2 - local z = PlayerZ + z - Range / 2 + local px = PlayerX + x - Range / 2 + local pz = PlayerZ + z - Range / 2 local Items = cItems() Items:Add(PossibleItems[math.random(#PossibleItems)]) - World:SpawnItemPickups(Items, x, PlayerY, z, 0) + World:SpawnItemPickups(Items, px, PlayerY, pz, 0) end end -- for z, for x + return true end function HandlePoof(a_Split, a_Player) - local PlayerPos = a_Player:GetPos() - local Box = cBoundingBox(PlayerPos, a_Player:GetWidth() / 2, a_Player:GetHeight()) + local PlayerPos = Vector3d(a_Player:GetPosition()) -- Create a copy of the position + PlayerPos.y = PlayerPos.y - 1 + local Box = cBoundingBox(PlayerPos, 4, 2) + local NumEntities = 0 a_Player:GetWorld():ForEachEntityInBox(Box, function (a_Entity) - local AddSpeed = PlayerPos - a_Entity:GetPosition() -- Speed away from the player - a_Entity:AddSpeed(AddSpeed / AddSpeed:SqrLength()) -- The further away, the less speed to add + if not(a_Entity:IsPlayer()) then + local AddSpeed = a_Entity:GetPosition() - PlayerPos -- Speed away from the player + a_Entity:AddSpeed(AddSpeed * 32 / (AddSpeed:SqrLength() + 1)) -- The further away, the less speed to add + NumEntities = NumEntities + 1 + end end ) - a_Player:SendMessage("Poof!") + a_Player:SendMessage("Poof! (" .. NumEntities .. " entities)") + return true end -- cgit v1.2.3