Merge pull request #995 from argonui/flipped-tokens

Updated damage/horror XML to detect if object spawns flipped
This commit is contained in:
dscarpac 2024-11-18 08:03:06 -06:00 committed by GitHub
commit ac8d5ace69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,6 +44,13 @@ function createXml()
if not params then return end if not params then return end
local uiColor, uiFontSize, uiVal = getUiColorSizeAndVal() local uiColor, uiFontSize, uiVal = getUiColorSizeAndVal()
local pos = params.posX .. " " .. params.posY .. " -6"
local rot = "0 0 180"
if self.is_face_down then
pos = params.posX .. " " .. params.posY .. " 6"
rot = "0 180 180"
end
local xml = { local xml = {
{ {
tag = "Button", tag = "Button",
@ -53,12 +60,12 @@ function createXml()
onClick = "addOrSubtract", onClick = "addOrSubtract",
scale = "0.35 0.35 1", scale = "0.35 0.35 1",
colors = uiColor, colors = uiColor,
position = params.posX .. " " .. params.posY .. " -6", position = pos,
rotation = "0 0 180", rotation = rot,
height = params.size, height = params.size,
width = params.size width = params.size
}, },
children = { children = {
{ {
tag = "Text", tag = "Text",
attributes = { attributes = {
@ -77,7 +84,7 @@ end
function onRotate(_, flip, _, _, oldFlip) function onRotate(_, flip, _, _, oldFlip)
if flip == oldFlip then return end if flip == oldFlip then return end
if flip == 180 then if flip == 180 then
self.UI.setAttribute("xmlBtn", "position", params.posX .. " " .. params.posY .. " 6") self.UI.setAttribute("xmlBtn", "position", params.posX .. " " .. params.posY .. " 6")
self.UI.setAttribute("xmlBtn", "rotation", "0 180 180") self.UI.setAttribute("xmlBtn", "rotation", "0 180 180")
@ -99,7 +106,7 @@ function getUiColorSizeAndVal()
end end
function getColorBlock(hexColor) function getColorBlock(hexColor)
return table.concat({hexColor, hexColor, hexColor}, "|") return table.concat({ hexColor, hexColor, hexColor }, "|")
end end
function updateLabel() function updateLabel()