added rounding

This commit is contained in:
Chr1Z93 2024-11-22 01:40:50 +01:00
parent dc8e9ba05f
commit 24545fc389

View File

@ -2856,6 +2856,9 @@ 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
@ -2961,3 +2964,7 @@ function removeTokensFromObject(params)
end end
end end
end end
function roundToMultiple(num, mult)
return math.floor((num + mult / 2) / mult) * mult
end