Merge pull request #494 from argonui/deckimport

Added missing tag to imported decks
This commit is contained in:
Entrox-Licher 2023-12-03 13:54:06 -05:00 committed by GitHub
commit 10cc3d2fe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,6 +154,7 @@ function deckSpawned(deck, playerColor)
local player = Player[playmatApi.getPlayerColor(playerColor)]
local handPos = player.getHandTransform(1).position -- Only one hand zone per player
local deckCards = deck.getData().ContainedObjects
-- Process in reverse order so taking cards out doesn't upset the indexing
for i = #deckCards, 1, -1 do
local cardMetadata = JSON.decode(deckCards[i].GMNotes) or { }
@ -161,6 +162,11 @@ function deckSpawned(deck, playerColor)
deck.takeObject({ index = i - 1, position = handPos, flip = true, smooth = true})
end
end
-- add the "PlayerCard" tag to the deck
if deck and deck.type == "Deck" and deck.getQuantity() > 1 then
deck.addTag("PlayerCard")
end
end
-- Converts the Raven Quill's selections from card IDs to card names. This could be more elegant