Skip to content

Commit

Permalink
Merge pull request #869 from dscarpac/flipped-tokens
Browse files Browse the repository at this point in the history
Added new font and flippable capability to damage / horror tokens
  • Loading branch information
Chr1Z93 authored Sep 18, 2024
2 parents d768324 + 9c3f78e commit c20d747
Show file tree
Hide file tree
Showing 25 changed files with 67 additions and 48 deletions.
5 changes: 5 additions & 0 deletions modsettings/CustomUIAssets.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
"Type": 1,
"URL": "https://steamusercontent-a.akamaihd.net/ugc/2027213118467703445/89328E273B4C5180BF491516CE998DE3C604E162/"
},
{
"Name": "font_arkham-numbers",
"Type": 1,
"URL": "https://steamusercontent-a.akamaihd.net/ugc/2424714310444718103/C96BEC602A96F3D302A6442B2EB8129AA4F814A1/"
},
{
"Name": "header_cover",
"Type": 0,
Expand Down
2 changes: 1 addition & 1 deletion objects/Damage.1f5a0a.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"posZ": 29.089,
"rotX": 0,
"rotY": 10,
"rotZ": 1,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3
Expand Down
2 changes: 1 addition & 1 deletion objects/Damage.591a45.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"posZ": -29.078,
"rotX": 0,
"rotY": 190,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3
Expand Down
2 changes: 1 addition & 1 deletion objects/Damage.e64eec.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"posZ": -22.894,
"rotX": 0,
"rotY": 280,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3
Expand Down
2 changes: 1 addition & 1 deletion objects/Damage.eb08d6.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"posZ": 9.273,
"rotX": 0,
"rotY": 280,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3
Expand Down
2 changes: 1 addition & 1 deletion objects/Damagetokens.480bda.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"SpecularIntensity": 0.05,
"SpecularSharpness": 3.000001
},
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357113311/C9A5F7E450A6845D0D09D7407AA38E9319697D74/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2424714310447304520/C242946D58154EB5F81733A922408623660BE86A/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",
Expand Down
2 changes: 1 addition & 1 deletion objects/Damagetokens.480bda/Damage.cd2a02.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1615094763857974350/E16168497E847B690A16F1C0914E4F5C872555B6/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"WidthScale": 0
},
"CustomUIAssets": [
Expand Down
2 changes: 1 addition & 1 deletion objects/Damagetokens.93f4a0.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"SpecularIntensity": 0.05,
"SpecularSharpness": 3.000001
},
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357113311/C9A5F7E450A6845D0D09D7407AA38E9319697D74/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2424714310447304520/C242946D58154EB5F81733A922408623660BE86A/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",
Expand Down
2 changes: 1 addition & 1 deletion objects/Damagetokens.93f4a0/Damage.cd2a02.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1615094763857974350/E16168497E847B690A16F1C0914E4F5C872555B6/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"WidthScale": 0
},
"CustomUIAssets": [
Expand Down
2 changes: 1 addition & 1 deletion objects/Damagetokens.b0ef6c.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"SpecularIntensity": 0.05,
"SpecularSharpness": 3.000001
},
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357113311/C9A5F7E450A6845D0D09D7407AA38E9319697D74/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2424714310447304520/C242946D58154EB5F81733A922408623660BE86A/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",
Expand Down
2 changes: 1 addition & 1 deletion objects/Damagetokens.b0ef6c/Damage.cd2a02.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1615094763857974350/E16168497E847B690A16F1C0914E4F5C872555B6/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"WidthScale": 0
},
"CustomUIAssets": [
Expand Down
2 changes: 1 addition & 1 deletion objects/Horror.0257d9.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"posZ": -24.928,
"rotX": 0,
"rotY": 280,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3
Expand Down
2 changes: 1 addition & 1 deletion objects/Horror.468e88.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"posZ": 7.229,
"rotX": 0,
"rotY": 280,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3
Expand Down
2 changes: 1 addition & 1 deletion objects/Horror.7b5729.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"posZ": 29.487,
"rotX": 0,
"rotY": 10,
"rotZ": 1,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3
Expand Down
2 changes: 1 addition & 1 deletion objects/Horror.beb964.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"posZ": -29.42,
"rotX": 0,
"rotY": 190,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3
Expand Down
2 changes: 1 addition & 1 deletion objects/Horrortokens.7bd2a0.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"CastShadows": true,
"ColliderURL": "",
"Convex": true,
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357109766/6D35F3D98A4C89696895FACA788F54005B1688D3/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2505779553882482465/D5E50127E1B511C7944940D62586973A66F87046/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",
Expand Down
2 changes: 1 addition & 1 deletion objects/Horrortokens.7bd2a0/Horror.36be72.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396423416/9CC783AD03275AAB3443A1DACA7A58A892AAB632/",
"WidthScale": 0
},
"CustomUIAssets": [
Expand Down
2 changes: 1 addition & 1 deletion objects/Horrortokens.ae1a4e.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"CastShadows": true,
"ColliderURL": "",
"Convex": true,
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357109766/6D35F3D98A4C89696895FACA788F54005B1688D3/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2505779553882482465/D5E50127E1B511C7944940D62586973A66F87046/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",
Expand Down
2 changes: 1 addition & 1 deletion objects/Horrortokens.ae1a4e/Horror.36be72.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396423416/9CC783AD03275AAB3443A1DACA7A58A892AAB632/",
"WidthScale": 0
},
"CustomUIAssets": [
Expand Down
2 changes: 1 addition & 1 deletion objects/Horrortokens.c3ecf4.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"CastShadows": true,
"ColliderURL": "",
"Convex": true,
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357109766/6D35F3D98A4C89696895FACA788F54005B1688D3/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2505779553882482465/D5E50127E1B511C7944940D62586973A66F87046/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",
Expand Down
2 changes: 1 addition & 1 deletion objects/Horrortokens.c3ecf4/Horror.36be72.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396423416/9CC783AD03275AAB3443A1DACA7A58A892AAB632/",
"WidthScale": 0
},
"CustomUIAssets": [
Expand Down
2 changes: 1 addition & 1 deletion objects/TokenSource.124381/Damage.cd2a02.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1615094763857974350/E16168497E847B690A16F1C0914E4F5C872555B6/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"WidthScale": 0
},
"CustomUIAssets": [
Expand Down
2 changes: 1 addition & 1 deletion objects/TokenSource.124381/Horror.36be72.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396423416/9CC783AD03275AAB3443A1DACA7A58A892AAB632/",
"WidthScale": 0
},
"CustomUIAssets": [
Expand Down
55 changes: 32 additions & 23 deletions src/core/DamageHorrorCounter.ttslua
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ function getXmlParameters()
local tokenType = self.getMemo()
if tokenType == "damage" then
return {
size = 550,
fontSize = 700,
offsetXY = "-5 5",
color = "#fe1b17fc"
size = 600,
posX = "10",
posY = "5",
color = "#FA2A19FC"
}
elseif tokenType == "horror" then
return {
size = 550,
fontSize = 700,
offsetXY = "30 -5",
color = "#273784fc"
size = 600,
posX = "-18",
posY = "-5",
color = "#302F6DFC"
}
else
printToAll("Invalid token type")
Expand All @@ -43,7 +43,7 @@ function createXml()
params = getXmlParameters()
if not params then return end

local uiColor, uiVal = getUiColorAndVal()
local uiColor, uiFontSize, uiVal = getUiColorSizeAndVal()
local xml = {
{
tag = "Button",
Expand All @@ -53,20 +53,18 @@ function createXml()
onClick = "addOrSubtract",
scale = "0.35 0.35 1",
colors = uiColor,
position = "0 0 -6",
position = params.posX .. " " .. params.posY .. " -6",
rotation = "0 0 180",
height = params.size,
width = params.size,
offsetXY = params.offsetXY
width = params.size
},
children = {
{
tag = "Text",
attributes = {
id = "xmlTxt",
fontStyle = "Bold",
fontSize = params.fontSize,
font = "font_teutonic-arkham",
fontSize = uiFontSize,
font = "font_arkham-numbers",
text = uiVal,
color = "#FFFFFF"
}
Expand All @@ -77,17 +75,26 @@ function createXml()
self.UI.setXmlTable(xml)
end

-- rotate to face-up when dropped
function onDrop()
self.setRotation(self.getRotation():setAt("z", 0))
function onRotate(_, flip, _, _, oldFlip)
if flip == oldFlip then return end

if flip == 180 then
self.UI.setAttribute("xmlBtn", "position", params.posX .. " " .. params.posY .. " 6")
self.UI.setAttribute("xmlBtn", "rotation", "0 180 180")
else
self.UI.setAttribute("xmlBtn", "position", params.posX .. " " .. params.posY .. " -6")
self.UI.setAttribute("xmlBtn", "rotation", "0 0 180")
end
end

-- value == 1 and unlocked -> no label/background
function getUiColorAndVal()
-- value == 1 -> no label/background
function getUiColorSizeAndVal()
if val == 1 then
return getColorBlock("#00000000"), ""
return getColorBlock("#00000000"), "700", ""
elseif val < 10 then
return getColorBlock(params.color), "700", val
else
return getColorBlock(params.color), val
return getColorBlock(params.color), "350", val
end
end

Expand All @@ -96,8 +103,10 @@ function getColorBlock(hexColor)
end

function updateLabel()
local uiColor, uiVal = getUiColorAndVal()
local uiColor, uiFontSize, uiVal = getUiColorSizeAndVal()

self.UI.setAttribute("xmlBtn", "colors", uiColor)
self.UI.setAttribute("xmlTxt", "fontSize", uiFontSize)
self.UI.setAttribute("xmlTxt", "text", uiVal)
end

Expand Down
11 changes: 8 additions & 3 deletions src/core/GenericCounter.ttslua
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ function onLoad(savedData)
local position = { 0, 0.06, 0 }

-- set position of label depending on object
if tokenType == "damage" or tokenType == "resource" or tokenType == "resourceCounter" then
position = { 0, 0.06, 0.1 }
if tokenType == "damage" then
position = { 0.1, -0.07, 0.1 }
rotation = { 180, 180, 0}
elseif tokenType == "horror" then
position = { -0.025, 0.06, -0.025 }
position = { -0.025, -0.07, 0.025 }
rotation = { 180, 180, 0}
elseif tokenType == "resource" or tokenType == "resourceCounter" then
position = { 0, 0.06, 0.1 }
elseif tokenType == "ElderSignCounter" or tokenType == "AutofailCounter" then
position = { 0, 0.1, 0 }
end
Expand All @@ -27,6 +31,7 @@ function onLoad(savedData)
click_function = "addOrSubtract",
function_owner = self,
position = position,
rotation = rotation or { 0, 0, 0 },
height = 600,
width = 1000,
scale = { 1.5, 1.5, 1.5 },
Expand Down

0 comments on commit c20d747

Please sign in to comment.