Merge pull request #906 from dscarpac/temporary-highlighting

Added teal highlighting to temporary tokens
This commit is contained in:
Chr1Z 2024-10-07 19:20:26 +02:00 committed by GitHub
commit f2279c55bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 2 deletions

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2467486908540932616/8370C75D2789E1332836D8C2A31D32542153DE85/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2503529021846579660/223F10EFA8B08AB25EC22181C3371161B5301F08/",
"WidthScale": 0
},
"Description": "Press a numpad key to spawn the indicated token.",

View File

@ -2580,7 +2580,7 @@ end
function updateUniversalActionAbilityToken(obj, params)
obj.call("updateClassAndSymbol", params)
if params.addTag then
obj.addTag(params.addTag)
obj.call("addTemporaryStatus")
end
end

View File

@ -52,6 +52,8 @@ local colorsForClasses = {
Survivor = Color.new(190 / 255, 30 / 255, 45 / 255)
}
local highlightColor = { 0, 200 / 255, 200 / 255 }
function onSave()
return JSON.encode({ class = class, symbol = symbol })
end
@ -63,6 +65,9 @@ function onLoad(savedData)
updateDisplay()
addContextMenu()
if self.hasTag("Temporary") then
self.highlightOn(highlightColor)
end
-- get random seed from Global so all are different
math.randomseed(Global.call("getRandomSeed"))
@ -272,6 +277,11 @@ function updateClassAndSymbol(params)
updateDisplay()
end
function addTemporaryStatus()
self.addTag("Temporary")
self.highlightOn(highlightColor)
end
function isClassName(str)
for _, className in ipairs(listOfClasses) do
if className == str then

View File

@ -4,6 +4,7 @@ local tokenManagerApi = require("core/token/TokenManagerApi")
local TOKEN_INDEX = {}
TOKEN_INDEX[1] = "universalActionAbility"
TOKEN_INDEX[2] = "universalActionAbility"
TOKEN_INDEX[3] = "resourceCounter"
TOKEN_INDEX[4] = "damage"
TOKEN_INDEX[5] = "path"
@ -66,6 +67,9 @@ function onScriptingButtonDown(index, playerColor)
rotation = playermatApi.returnRotation(matColor)
callbackName = "updateUniversalActionAbilityToken"
callbackParams = { class = activeInvestigatorData.class, symbol = activeInvestigatorData.class }
if index == 2 then -- temporary version
callbackParams.addTag = "Temporary"
end
end
tokenManagerApi.spawnToken(position, tokenType, rotation, callbackName, callbackParams)