From 018adc3153500f84a2f416399c22f6c5f437c661 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 7 Jun 2013 19:58:02 +0000 Subject: ProtectionAreas: Fixed cCommandState's detection of not-selected git-svn-id: http://mc-server.googlecode.com/svn/trunk@1562 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/ProtectionAreas/CommandState.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'MCServer/Plugins/ProtectionAreas') diff --git a/MCServer/Plugins/ProtectionAreas/CommandState.lua b/MCServer/Plugins/ProtectionAreas/CommandState.lua index dacf04599..2911688a8 100644 --- a/MCServer/Plugins/ProtectionAreas/CommandState.lua +++ b/MCServer/Plugins/ProtectionAreas/CommandState.lua @@ -21,7 +21,8 @@ cCommandState = { m_Coords1 = {x = 0, z = 0}; -- lclk coords m_Coords2 = {x = 0, z = 0}; -- rclk coords m_LastCoords = 0; -- When Coords1 or Coords2 is set, this gets set to 1 or 2, signifying the last changed set of coords - m_HasCoords = 1; -- Set to 0, 1, 2 or 3, based on which set of coords has been set (bitmask) + m_HasCoords1 = false; -- Set to true when m_Coords1 has been set by the user + m_HasCoords2 = false; -- Set to true when m_Coords2 has been set by the user }; g_CommandStates = {}; @@ -43,14 +44,14 @@ end --- Returns the current coord pair as a cCuboid object function cCommandState:GetCurrentCuboid() - if (self.m_HasCoords ~= 3) then + if (not(self.m_HasCoords1) or not(self.m_HasCoords2)) then -- Some of the coords haven't been set yet return nil; end local res = cCuboid( - self.m_Coords1.x, self.m_Coords1.y, self.m_Coords1.z, - self.m_Coords2.x, self.m_Coords2.y, self.m_Coords2.z + self.m_Coords1.x, 0, self.m_Coords1.z, + self.m_Coords2.x, 255, self.m_Coords2.z ); res:Sort(); return res; @@ -86,6 +87,7 @@ function cCommandState:SetCoords1(a_BlockX, a_BlockZ) self.m_Coords1.x = a_BlockX; self.m_Coords1.z = a_BlockZ; self.m_LastCoords = 1; + self.m_HasCoords1 = true; end @@ -97,6 +99,7 @@ function cCommandState:SetCoords2(a_BlockX, a_BlockZ) self.m_Coords2.x = a_BlockX; self.m_Coords2.z = a_BlockZ; self.m_LastCoords = 2; + self.m_HasCoords2 = true; end -- cgit v1.2.3