rotation fixed

This commit is contained in:
Chr1Z93 2024-11-22 01:43:14 +01:00
parent 24545fc389
commit c3cdd2f050
2 changed files with 1 additions and 8 deletions

View File

@ -85,7 +85,7 @@ function takeCardIntoThreatArea(playerColor, hoveredObject)
-- work out the new rotation -- work out the new rotation
local matRotation = playermatApi.returnRotation(matColor) local matRotation = playermatApi.returnRotation(matColor)
local newCardRot = cardRot:setAt("y", matRotation.y + cardRot.y - ownerRotation.y) local newCardRot = cardRot:setAt("y", roundToMultiple(matRotation.y + cardRot.y - ownerRotation.y, 45))
-- move the main card to threat area -- move the main card to threat area
GlobalApi.moveCardWithTokens(hoveredObject, threatAreaPos, newCardRot) GlobalApi.moveCardWithTokens(hoveredObject, threatAreaPos, newCardRot)

View File

@ -2856,9 +2856,6 @@ function moveCardWithTokens(params)
if rotation then if rotation then
card.setRotation(rotation) card.setRotation(rotation)
else
local rot = card.getRotation()
card.setRotation(rot:setAt("y", roundToMultiple(rot.y, 45)))
end end
if position then if position then
@ -2964,7 +2961,3 @@ function removeTokensFromObject(params)
end end
end end
end end
function roundToMultiple(num, mult)
return math.floor((num + mult / 2) / mult) * mult
end