fix clue offset for 16+
This commit is contained in:
parent
351f73ff84
commit
22877c7bb4
@ -462,17 +462,27 @@ do
|
||||
---@return table: Array of global positions to spawn the clues at
|
||||
internal.buildClueOffsets = function(card, count)
|
||||
-- make sure clues always spawn from left to right
|
||||
local modifier = -1
|
||||
if card.is_face_down then
|
||||
modifier = 1
|
||||
end
|
||||
local modifier = card.is_face_down and 1 or -1
|
||||
|
||||
local cluePositions = {}
|
||||
for i = 1, count do
|
||||
local row = math.floor(1 + (i - 1) / 4)
|
||||
local column = (i - 1) % 4
|
||||
-- get the set number (1 for clue 1-16, 2 for 17-32 etc.)
|
||||
local set = math.floor((i - 1) / 16) + 1
|
||||
|
||||
-- get the local index (always number from 1-16)
|
||||
local localIndex = (i - 1) % 16
|
||||
|
||||
-- get row and column for this clue
|
||||
local row = math.floor(localIndex / 4) + 1
|
||||
local column = localIndex % 4
|
||||
|
||||
-- calculate local position
|
||||
local localPos = Vector((-0.825 + 0.55 * column) * modifier, 0, -1.5 + 0.55 * row)
|
||||
local cluePos = card.positionToWorld(localPos) + Vector(0, 0.03, 0)
|
||||
|
||||
-- get the global clue position (higher y-position for each set)
|
||||
local cluePos = card.positionToWorld(localPos) + Vector(0, 0.03 + 0.103 * (set - 1), 0)
|
||||
|
||||
-- add position to table
|
||||
table.insert(cluePositions, cluePos)
|
||||
end
|
||||
return cluePositions
|
||||
|
Loading…
x
Reference in New Issue
Block a user