expanded custom token support

This commit is contained in:
Chr1Z93 2024-04-03 21:24:30 +02:00
parent 5eb5b1e840
commit a95dc0ea58

View File

@ -298,8 +298,8 @@ function drawChaosToken(params)
tokenOffset[1] = tokenOffset[1] + (0.17 * #chaosTokens)
local token
if params.guidToBeResolved then -- resolve a sealed token from a card
-- resolve a sealed token from a card
if params.guidToBeResolved then
token = getObjectFromGUID(params.guidToBeResolved)
token.setPositionSmooth(params.mat.positionToWorld(tokenOffset))
local guid = token.getGUID()
@ -308,7 +308,8 @@ function drawChaosToken(params)
blessCurseManagerApi.releasedToken(tokenType, guid)
end
tokenArrangerApi.layout()
else -- take a token from the bag, either specified or random
-- take a token from the bag, either specified or random
else
local takeParameters = {
position = params.mat.positionToWorld(tokenOffset),
rotation = params.mat.getRotation()
@ -316,7 +317,7 @@ function drawChaosToken(params)
if params.tokenType then
for i, lookedForToken in ipairs(chaosBag.getObjects()) do
if lookedForToken.name == params.tokenType then
if lookedForToken.nickname == params.tokenType then
takeParameters.index = i - 1
end
end
@ -324,8 +325,11 @@ function drawChaosToken(params)
token = chaosBag.takeObject(takeParameters)
end
-- get data for token description
local name = token.getName()
if name == "" then name = "Custom" end
local tokenData = mythosAreaApi.returnTokenData().tokenData or {}
local specificData = tokenData[name] or {}
token.setDescription(specificData.description or "")