Merge pull request #388 from argonui/clue-spawning

Bugfix for clue counts > 12
This commit is contained in:
Entrox-Licher 2023-10-05 12:49:58 -04:00 committed by GitHub
commit 8e01a70d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,14 +204,15 @@ do
---@param shiftDown Number An offset for the z-value of this group of tokens ---@param shiftDown Number An offset for the z-value of this group of tokens
---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens
TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType) TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)
if tokenCount < 1 or tokenCount > 12 then -- not checking the max at this point since clue offsets are calculated dynamically
return if tokenCount < 1 then return end
end
local offsets = {} local offsets = {}
if tokenType == "clue" then if tokenType == "clue" then
offsets = internal.buildClueOffsets(card, tokenCount) offsets = internal.buildClueOffsets(card, tokenCount)
else else
-- only up to 12 offset tables defined
if tokenCount > 12 then return end
for i = 1, tokenCount do for i = 1, tokenCount do
offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i]) offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])
-- Fix the y-position for the spawn, since positionToWorld considers rotation which can -- Fix the y-position for the spawn, since positionToWorld considers rotation which can
@ -479,7 +480,6 @@ do
local column = (i - 1) % 4 local column = (i - 1) % 4
table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column)) table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))
end end
return cluePositions return cluePositions
end end