summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/DiamondMover
diff options
context:
space:
mode:
authormathiascode <mathiascode@users.noreply.github.com>2017-02-24 10:11:38 +0100
committerMattes D <github@xoft.cz>2017-02-24 10:11:38 +0100
commit330d66097f4b7fdcd3215ff576e7d65b59833dc4 (patch)
tree8964791209c01f6f5655c856da2330af5faa3aa6 /Server/Plugins/DiamondMover
parentChanged world_end to world_the_end #3531 (#3538) (diff)
downloadcuberite-330d66097f4b7fdcd3215ff576e7d65b59833dc4.tar
cuberite-330d66097f4b7fdcd3215ff576e7d65b59833dc4.tar.gz
cuberite-330d66097f4b7fdcd3215ff576e7d65b59833dc4.tar.bz2
cuberite-330d66097f4b7fdcd3215ff576e7d65b59833dc4.tar.lz
cuberite-330d66097f4b7fdcd3215ff576e7d65b59833dc4.tar.xz
cuberite-330d66097f4b7fdcd3215ff576e7d65b59833dc4.tar.zst
cuberite-330d66097f4b7fdcd3215ff576e7d65b59833dc4.zip
Diffstat (limited to '')
-rw-r--r--Server/Plugins/DiamondMover/DiamondMover.lua85
1 files changed, 0 insertions, 85 deletions
diff --git a/Server/Plugins/DiamondMover/DiamondMover.lua b/Server/Plugins/DiamondMover/DiamondMover.lua
deleted file mode 100644
index d3e70acfc..000000000
--- a/Server/Plugins/DiamondMover/DiamondMover.lua
+++ /dev/null
@@ -1,85 +0,0 @@
-
--- DiamondMover.lua
-
--- An example Lua plugin using the cBlockArea object
--- When a player rclks with a diamond in their hand, an area around the clicked block is moved in the direction the player is facing
-
-
-
-
-
--- Global variables
-MOVER_SIZE_X = 4;
-MOVER_SIZE_Y = 4;
-MOVER_SIZE_Z = 4;
-
-
-
-
-
-function Initialize(Plugin)
- Plugin:SetName("DiamondMover");
- Plugin:SetVersion(1);
-
- cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USED_ITEM, OnPlayerUsedItem);
-
- LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion());
- return true;
-end
-
-
-
-
-
-function OnPlayerUsedItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
-
- -- Don't check if the direction is in the air
- if (BlockFace == -1) then
- return false;
- end;
-
- if (not Player:HasPermission("diamondmover.move")) then
- return false;
- end;
-
- -- Rclk with a diamond to push in the direction the player is facing
- if (Player:GetEquippedItem().m_ItemType == E_ITEM_DIAMOND) then
- local Area = cBlockArea();
- Area:Read(Player:GetWorld(),
- BlockX - MOVER_SIZE_X, BlockX + MOVER_SIZE_X,
- BlockY - MOVER_SIZE_Y, BlockY + MOVER_SIZE_Y,
- BlockZ - MOVER_SIZE_Z, BlockZ + MOVER_SIZE_Z
- );
-
- local PlayerPitch = Player:GetPitch();
- if (PlayerPitch < -70) then -- looking up
- BlockY = BlockY + 1;
- else
- if (PlayerPitch > 70) then -- looking down
- BlockY = BlockY - 1;
- else
- local PlayerRot = Player:GetYaw() + 180; -- Convert [-180, 180] into [0, 360] for simpler conditions
- if ((PlayerRot < 45) or (PlayerRot > 315)) then
- BlockZ = BlockZ - 1;
- else
- if (PlayerRot < 135) then
- BlockX = BlockX + 1;
- else
- if (PlayerRot < 225) then
- BlockZ = BlockZ + 1;
- else
- BlockX = BlockX - 1;
- end;
- end;
- end;
- end;
- end;
-
- Area:Write(Player:GetWorld(), BlockX - MOVER_SIZE_X, BlockY - MOVER_SIZE_Y, BlockZ - MOVER_SIZE_Z);
- return false;
- end
-end
-
-
-
-