first iteration

This commit is contained in:
Chr1Z93 2024-03-04 19:05:05 +01:00
parent da9f955a59
commit cccfc3a3dc

View File

@ -272,9 +272,7 @@ do
local tokenTemplate = tokenTemplates[loadTokenType]
-- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag
local rot = Vector(tokenTemplate.Transform.rotX,
270,
tokenTemplate.Transform.rotZ)
local rot = Vector(tokenTemplate.Transform.rotX, 270, tokenTemplate.Transform.rotZ)
if rotation ~= nil then
rot.y = rotation.y
end
@ -469,11 +467,20 @@ do
---@return table: Array of global positions to spawn the clues at
internal.buildClueOffsets = function(card, count)
local pos = card.getPosition()
local rot = card.getRotation()
local cluePositions = {}
for i = 1, count do
local row = math.floor(1 + (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))
local cluePos = Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column)
-- rotate clue offsets to card rotation
local lCluePos = card.positionToLocal(cluePos)
lCluePos:rotateOver("y", 270 - rot.y)
cluePos = card.positionToWorld(lCluePos)
-- add clue position to table
table.insert(cluePositions, cluePos)
end
return cluePositions
end