Merge pull request #713 from argonui/updated-investigator-scaling
Updated investigator scaling
This commit is contained in:
commit
718ce79dbc
@ -33,8 +33,8 @@ Spawner.spawnCards = function(cardList, pos, rot, sort, callback)
|
|||||||
table.insert(standardCards, card)
|
table.insert(standardCards, card)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Spawn each of the three types individually. Each Y position shift accounts for the thickness
|
|
||||||
-- of the spawned deck
|
-- Spawn each of the three types individually. Y position accounts for the thickness of the spawned deck
|
||||||
local position = { x = pos.x, y = pos.y, z = pos.z }
|
local position = { x = pos.x, y = pos.y, z = pos.z }
|
||||||
Spawner.spawn(investigatorCards, position, rot, callback)
|
Spawner.spawn(investigatorCards, position, rot, callback)
|
||||||
|
|
||||||
@ -90,25 +90,18 @@ Spawner.spawn = function(cardList, pos, rot, callback)
|
|||||||
if cardList[1].data.SidewaysCard then
|
if cardList[1].data.SidewaysCard then
|
||||||
rot = { rot.x, rot.y - 90, rot.z }
|
rot = { rot.x, rot.y - 90, rot.z }
|
||||||
end
|
end
|
||||||
spawnObjectData({
|
return spawnObjectData({
|
||||||
data = cardList[1].data,
|
data = cardList[1].data,
|
||||||
position = pos,
|
position = pos,
|
||||||
rotation = rot,
|
rotation = rot,
|
||||||
callback_function = callback
|
callback_function = callback
|
||||||
})
|
})
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- For multiple cards, construct a deck and spawn that
|
-- For multiple cards, construct a deck and spawn that
|
||||||
local deck = Spawner.buildDeckDataTemplate()
|
local deckScaleX = cardList[1].data.Transform.scaleX
|
||||||
|
local deckScaleZ = cardList[1].data.Transform.scaleZ
|
||||||
-- Decks won't inherently scale to the cards in them. The card list being spawned should be all
|
local deck = Spawner.buildDeckDataTemplate(deckScaleX, deckScaleZ)
|
||||||
-- the same type/size by this point, so use the first card to set the size
|
|
||||||
deck.Transform = {
|
|
||||||
scaleX = cardList[1].data.Transform.scaleX,
|
|
||||||
scaleY = 1,
|
|
||||||
scaleZ = cardList[1].data.Transform.scaleZ
|
|
||||||
}
|
|
||||||
|
|
||||||
local sidewaysDeck = true
|
local sidewaysDeck = true
|
||||||
for _, spawnCard in ipairs(cardList) do
|
for _, spawnCard in ipairs(cardList) do
|
||||||
@ -123,7 +116,7 @@ Spawner.spawn = function(cardList, pos, rot, callback)
|
|||||||
rot = { rot.x, rot.y - 90, rot.z }
|
rot = { rot.x, rot.y - 90, rot.z }
|
||||||
end
|
end
|
||||||
|
|
||||||
spawnObjectData({
|
return spawnObjectData({
|
||||||
data = deck,
|
data = deck,
|
||||||
position = pos,
|
position = pos,
|
||||||
rotation = rot,
|
rotation = rot,
|
||||||
@ -176,7 +169,7 @@ end
|
|||||||
-- creates a new table on each call without using metatables or previous
|
-- creates a new table on each call without using metatables or previous
|
||||||
-- definitions because we can't be sure that TTS doesn't modify the structure
|
-- definitions because we can't be sure that TTS doesn't modify the structure
|
||||||
---@return table deck Table containing the minimal TTS deck data structure
|
---@return table deck Table containing the minimal TTS deck data structure
|
||||||
Spawner.buildDeckDataTemplate = function()
|
Spawner.buildDeckDataTemplate = function(deckScaleX, deckScaleZ)
|
||||||
local deck = {}
|
local deck = {}
|
||||||
deck.Name = "Deck"
|
deck.Name = "Deck"
|
||||||
|
|
||||||
@ -186,10 +179,12 @@ Spawner.buildDeckDataTemplate = function()
|
|||||||
deck.CustomDeck = {}
|
deck.CustomDeck = {}
|
||||||
|
|
||||||
-- Transform is required, Position and Rotation will be overridden by the spawn call so can be omitted here
|
-- Transform is required, Position and Rotation will be overridden by the spawn call so can be omitted here
|
||||||
|
-- Decks won't inherently scale to the cards in them. The card list being spawned should be all
|
||||||
|
-- the same type/size by this point, so use the first card to set the size
|
||||||
deck.Transform = {
|
deck.Transform = {
|
||||||
scaleX = 1,
|
scaleX = deckScaleX or 1,
|
||||||
scaleY = 1,
|
scaleY = 1,
|
||||||
scaleZ = 1,
|
scaleZ = deckScaleZ or 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
return deck
|
return deck
|
||||||
|
@ -887,8 +887,15 @@ function maybeUpdateActiveInvestigator(card)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set proper scale for the card
|
-- set proper scale for investigators
|
||||||
|
local cardData = card.getData()
|
||||||
|
if cardData["SidewaysCard"] == true then
|
||||||
|
-- 115% for easier readability
|
||||||
card.setScale({ 1.15, 1, 1.15 })
|
card.setScale({ 1.15, 1, 1.15 })
|
||||||
|
else
|
||||||
|
-- Zoop-exported investigators are horizontal cards and TTS scales them differently
|
||||||
|
card.setScale({ 0.8214, 1, 0.8214 })
|
||||||
|
end
|
||||||
|
|
||||||
-- remove old action tokens
|
-- remove old action tokens
|
||||||
for _, obj in ipairs(searchAroundSelf("isUniversalToken")) do
|
for _, obj in ipairs(searchAroundSelf("isUniversalToken")) do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user