Finish some missed cleanup and fix a bug with deck size
This commit is contained in:
parent
a516175177
commit
fa4d1f428d
@ -32,7 +32,7 @@ inputParameters.width = 1200
|
|||||||
inputParameters.height = 130
|
inputParameters.height = 130
|
||||||
inputParameters.font_size = 107
|
inputParameters.font_size = 107
|
||||||
|
|
||||||
local allCardsBag = getObjectFromGUID("15bb07")
|
local ALL_CARDS_GUID = "15bb07"
|
||||||
|
|
||||||
-- main code
|
-- main code
|
||||||
function onSave() return JSON.encode({ spawnAll, searchExact, inputParameters.value }) end
|
function onSave() return JSON.encode({ spawnAll, searchExact, inputParameters.value }) end
|
||||||
@ -102,6 +102,7 @@ function search()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local allCardsBag = getObjectFromGUID(ALL_CARDS_GUID)
|
||||||
if allCardsBag == nil then
|
if allCardsBag == nil then
|
||||||
printToAll("Player card bag couldn't be found.", "Red")
|
printToAll("Player card bag couldn't be found.", "Red")
|
||||||
return
|
return
|
||||||
@ -113,6 +114,10 @@ function search()
|
|||||||
printToAll("No match found.", "Red")
|
printToAll("No match found.", "Red")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if (#cardList > 100) then
|
||||||
|
printToAll("Matched more than 100 cards, please try a more specific search.", "Yellow")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- sort table by name (reverse for multiple results, because bottom card spawns first)
|
-- sort table by name (reverse for multiple results, because bottom card spawns first)
|
||||||
table.sort(cardList, function(k1, k2) return spawnAll == (k1.data.Nickname > k2.data.Nickname) end)
|
table.sort(cardList, function(k1, k2) return spawnAll == (k1.data.Nickname > k2.data.Nickname) end)
|
||||||
@ -120,17 +125,4 @@ function search()
|
|||||||
local rot = self.getRotation()
|
local rot = self.getRotation()
|
||||||
local pos = self.positionToWorld(Vector(0, 2, -0.225))
|
local pos = self.positionToWorld(Vector(0, 2, -0.225))
|
||||||
Spawner.spawnCards(cardList, pos, rot, true)
|
Spawner.spawnCards(cardList, pos, rot, true)
|
||||||
-- for _, card in ipairs(cardList) do
|
|
||||||
-- pos[2] = pos[2] + 0.1
|
|
||||||
-- spawnObjectData({
|
|
||||||
-- data = card.data,
|
|
||||||
-- position = pos,
|
|
||||||
-- rotation = rot
|
|
||||||
-- })
|
|
||||||
-- if not spawnAll then return end
|
|
||||||
-- if i == 100 then
|
|
||||||
-- printToAll("Only first 100 results of " .. #cardList .. " total results spawned.", "Yellow")
|
|
||||||
-- return
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
|
@ -51,7 +51,6 @@ Spawner.spawn = function(cardList, pos, rot, callback)
|
|||||||
end
|
end
|
||||||
-- Spawn a single card directly
|
-- Spawn a single card directly
|
||||||
if (#cardList == 1) then
|
if (#cardList == 1) then
|
||||||
log(pos)
|
|
||||||
spawnObjectData({
|
spawnObjectData({
|
||||||
data = cardList[1].data,
|
data = cardList[1].data,
|
||||||
position = pos,
|
position = pos,
|
||||||
@ -62,6 +61,13 @@ Spawner.spawn = function(cardList, pos, rot, callback)
|
|||||||
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 deck = Spawner.buildDeckDataTemplate()
|
||||||
|
-- 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 = {
|
||||||
|
scaleX = cardList[1].data.Transform.scaleX,
|
||||||
|
scaleY = 1,
|
||||||
|
scaleZ = cardList[1].data.Transform.scaleZ,
|
||||||
|
}
|
||||||
for _, spawnCard in ipairs(cardList) do
|
for _, spawnCard in ipairs(cardList) do
|
||||||
Spawner.addCardToDeck(deck, spawnCard.data)
|
Spawner.addCardToDeck(deck, spawnCard.data)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user