fix(cbs/cursor): only accept input when cursor stand still

This commit is contained in:
Kazhnuz 2019-08-31 11:25:26 +02:00
parent b38d478d5a
commit 7927146864

View file

@ -26,11 +26,12 @@ function Cursor:set(x, y, signal, subSignal)
self.y = math.max(math.min(y, 07), 1) self.y = math.max(math.min(y, 07), 1)
self.initialx = self.x self.initialx = self.x
self.initialy = self.y self.initialy = self.y
self.tx = self.x
self.ty = self.y
self:placeInGrid() self:placeInGrid()
self.tx = self.x
self.ty = self.y
self.isActive = true self.isActive = true
self.signal = signal or "" self.signal = signal or ""
self.subSignal = subSignal or "" self.subSignal = subSignal or ""
@ -73,9 +74,6 @@ function Cursor:placeInGrid()
end end
end end
end end
self.tx = self.x
self.ty = self.y
end end
function Cursor:setGrid(ox, oy, shape, size, direction, whitelistedEntity) function Cursor:setGrid(ox, oy, shape, size, direction, whitelistedEntity)
@ -179,7 +177,7 @@ function Cursor:update(dt)
end end
end end
if (keys["A"].isPressed) then if (keys["A"].isPressed and self.x == self.tx and self.y == self.ty) then
self.world:sendSignalToCurrentBattler(self.signal, self.subSignal) self.world:sendSignalToCurrentBattler(self.signal, self.subSignal)
end end