diff options
author | madmaxoft <github@xoft.cz> | 2014-09-03 17:02:16 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-09-03 17:02:16 +0200 |
commit | 5fa1a7fa223324a891c14c8b91544d859ee6fef4 (patch) | |
tree | 10749672072f5ca62c06e5c7c071098266d538ab /MCServer | |
parent | Exported ForEachEntityInBox() to Lua API. (diff) | |
download | cuberite-5fa1a7fa223324a891c14c8b91544d859ee6fef4.tar cuberite-5fa1a7fa223324a891c14c8b91544d859ee6fef4.tar.gz cuberite-5fa1a7fa223324a891c14c8b91544d859ee6fef4.tar.bz2 cuberite-5fa1a7fa223324a891c14c8b91544d859ee6fef4.tar.lz cuberite-5fa1a7fa223324a891c14c8b91544d859ee6fef4.tar.xz cuberite-5fa1a7fa223324a891c14c8b91544d859ee6fef4.tar.zst cuberite-5fa1a7fa223324a891c14c8b91544d859ee6fef4.zip |
Diffstat (limited to 'MCServer')
-rw-r--r-- | MCServer/Plugins/Debuggers/Debuggers.lua | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 179935c08..ca764c959 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -65,6 +65,8 @@ function Initialize(Plugin) PM:BindCommand("/sb", "debuggers", HandleSetBiome, "- Sets the biome around you to the specified one"); PM:BindCommand("/wesel", "debuggers", HandleWESel, "- Expands the current WE selection by 1 block in X/Z"); PM:BindCommand("/rmitem", "debuggers", HandleRMItem, "- Remove the specified item from the inventory."); + PM:BindCommand("/pickups", "debuggers", HandlePickups, "- Spawns random pickups around you"); + PM:BindCommand("/poof", "debuggers", HandlePoof, "- Nudges pickups close to you away from you"); Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers) Plugin:AddWebTab("StressTest", HandleRequest_StressTest) @@ -1558,3 +1560,50 @@ end + +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_COAL), +} + + + + + +function HandlePickups(a_Split, a_Player) + local PlayerX = a_Player:GetPosX() + local PlayerY = a_Player:GetPosY() + local PlayerZ = a_Player:GetPosZ() + local World = a_Player:GetWorld() + local Range = 15 + for x = 0, Range do for z = 0, Range do + local x = PlayerX + x - Range / 2 + local z = PlayerZ + z - Range / 2 + local Items = cItems() + Items:Add(PossibleItems[math.random(#PossibleItems)]) + World:SpawnItemPickups(Items, x, PlayerY, z, 0) + end end -- for z, for x +end + + + + +function HandlePoof(a_Split, a_Player) + local PlayerPos = a_Player:GetPos() + local Box = cBoundingBox(PlayerPos, a_Player:GetWidth() / 2, a_Player:GetHeight()) + 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 + end + ) + a_Player:SendMessage("Poof!") +end + + + + |