first iteration
This commit is contained in:
parent
da9f955a59
commit
cccfc3a3dc
@ -129,8 +129,8 @@ do
|
|||||||
local playerCardData
|
local playerCardData
|
||||||
local locationData
|
local locationData
|
||||||
|
|
||||||
local TokenManager = { }
|
local TokenManager = {}
|
||||||
local internal = { }
|
local internal = {}
|
||||||
|
|
||||||
-- Spawns tokens for the card. This function is built to just throw a card at it and let it do
|
-- Spawns tokens for the card. This function is built to just throw a card at it and let it do
|
||||||
-- the work once a card has hit an area where it might spawn tokens. It will check to see if
|
-- the work once a card has hit an area where it might spawn tokens. It will check to see if
|
||||||
@ -221,7 +221,7 @@ do
|
|||||||
if shiftDown ~= nil then
|
if shiftDown ~= nil then
|
||||||
-- Copy the offsets to make sure we don't change the static values
|
-- Copy the offsets to make sure we don't change the static values
|
||||||
local baseOffsets = offsets
|
local baseOffsets = offsets
|
||||||
offsets = { }
|
offsets = {}
|
||||||
|
|
||||||
-- get a vector for the shifting (downwards local to the card)
|
-- get a vector for the shifting (downwards local to the card)
|
||||||
local shiftDownVector = Vector(0, 0, shiftDown):rotateOver("y", card.getRotation().y)
|
local shiftDownVector = Vector(0, 0, shiftDown):rotateOver("y", card.getRotation().y)
|
||||||
@ -272,9 +272,7 @@ do
|
|||||||
local tokenTemplate = tokenTemplates[loadTokenType]
|
local tokenTemplate = tokenTemplates[loadTokenType]
|
||||||
|
|
||||||
-- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag
|
-- 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,
|
local rot = Vector(tokenTemplate.Transform.rotX, 270, tokenTemplate.Transform.rotZ)
|
||||||
270,
|
|
||||||
tokenTemplate.Transform.rotZ)
|
|
||||||
if rotation ~= nil then
|
if rotation ~= nil then
|
||||||
rot.y = rotation.y
|
rot.y = rotation.y
|
||||||
end
|
end
|
||||||
@ -435,7 +433,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
if ((card.is_face_down and locationData.clueSide == 'back')
|
if ((card.is_face_down and locationData.clueSide == 'back')
|
||||||
or (not card.is_face_down and locationData.clueSide == 'front')) then
|
or (not card.is_face_down and locationData.clueSide == 'front')) then
|
||||||
if locationData.type == 'fixed' then
|
if locationData.type == 'fixed' then
|
||||||
return locationData.value
|
return locationData.value
|
||||||
elseif locationData.type == 'perPlayer' then
|
elseif locationData.type == 'perPlayer' then
|
||||||
@ -449,7 +447,7 @@ do
|
|||||||
-- Gets the right uses structure for this card, based on metadata and face up/down state
|
-- Gets the right uses structure for this card, based on metadata and face up/down state
|
||||||
---@param card tts__Object Card to pull the uses from
|
---@param card tts__Object Card to pull the uses from
|
||||||
internal.getUses = function(card)
|
internal.getUses = function(card)
|
||||||
local metadata = JSON.decode(card.getGMNotes()) or { }
|
local metadata = JSON.decode(card.getGMNotes()) or {}
|
||||||
if metadata.type == "Location" then
|
if metadata.type == "Location" then
|
||||||
if card.is_face_down and metadata.locationBack ~= nil then
|
if card.is_face_down and metadata.locationBack ~= nil then
|
||||||
return metadata.locationBack.uses
|
return metadata.locationBack.uses
|
||||||
@ -469,11 +467,20 @@ do
|
|||||||
---@return table: Array of global positions to spawn the clues at
|
---@return table: Array of global positions to spawn the clues at
|
||||||
internal.buildClueOffsets = function(card, count)
|
internal.buildClueOffsets = function(card, count)
|
||||||
local pos = card.getPosition()
|
local pos = card.getPosition()
|
||||||
local cluePositions = { }
|
local rot = card.getRotation()
|
||||||
|
local cluePositions = {}
|
||||||
for i = 1, count do
|
for i = 1, count do
|
||||||
local row = math.floor(1 + (i - 1) / 4)
|
local row = math.floor(1 + (i - 1) / 4)
|
||||||
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))
|
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
|
end
|
||||||
return cluePositions
|
return cluePositions
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user