Fixed diamond mover plugin
This commit is contained in:
parent
5f72cdac38
commit
f1491ad1d1
@ -22,6 +22,8 @@ function Initialize(Plugin)
|
|||||||
Plugin:SetVersion(1);
|
Plugin:SetVersion(1);
|
||||||
|
|
||||||
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USED_ITEM, OnPlayerUsedItem);
|
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USED_ITEM, OnPlayerUsedItem);
|
||||||
|
|
||||||
|
LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion());
|
||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -36,8 +38,8 @@ function OnPlayerUsedItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, Cu
|
|||||||
return false;
|
return false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (Player:HasPermission("diamondmover.move") == false) then
|
if (not Player:HasPermission("diamondmover.move")) then
|
||||||
return true;
|
return false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
-- Rclk with a diamond to push in the direction the player is facing
|
-- Rclk with a diamond to push in the direction the player is facing
|
||||||
@ -56,7 +58,7 @@ function OnPlayerUsedItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, Cu
|
|||||||
if (PlayerPitch > 70) then -- looking down
|
if (PlayerPitch > 70) then -- looking down
|
||||||
BlockY = BlockY - 1;
|
BlockY = BlockY - 1;
|
||||||
else
|
else
|
||||||
local PlayerRot = Player:GetRotation() + 180; -- Convert [-180, 180] into [0, 360] for simpler conditions
|
local PlayerRot = Player:GetYaw() + 180; -- Convert [-180, 180] into [0, 360] for simpler conditions
|
||||||
if ((PlayerRot < 45) or (PlayerRot > 315)) then
|
if ((PlayerRot < 45) or (PlayerRot > 315)) then
|
||||||
BlockZ = BlockZ - 1;
|
BlockZ = BlockZ - 1;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user