Merge pull request #666 from argonui/token-manager

Bugfix for spawning a single damage / horror
This commit is contained in:
BootleggerFinn 2024-05-03 00:51:24 -05:00 committed by GitHub
commit 834bffb1eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -172,8 +172,7 @@ do
end end
end end
-- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror tokens.
-- tokens.
---@param card tts__Object Card to spawn tokens on ---@param card tts__Object Card to spawn tokens on
---@param tokenType string type of token to spawn, valid values are "damage" and "horror". Other ---@param tokenType string type of token to spawn, valid values are "damage" and "horror". Other
-- types should use spawnMultipleTokens() -- types should use spawnMultipleTokens()
@ -183,7 +182,12 @@ do
local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown)) local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))
local rot = card.getRotation() local rot = card.getRotation()
TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end) TokenManager.spawnToken(pos, tokenType, rot, function(spawned)
-- token starts in state 1, so don't attempt to change it to avoid error
if tokenValue ~= 1 then
spawned.setState(tokenValue)
end
end)
end end
TokenManager.spawnResourceCounterToken = function(card, tokenCount) TokenManager.spawnResourceCounterToken = function(card, tokenCount)