added player color initializing

This commit is contained in:
Chr1Z93 2024-07-04 21:50:00 +02:00
parent 5c53ca9c9c
commit d7dd8b3223
2 changed files with 11 additions and 9 deletions

View File

@ -228,15 +228,6 @@ function onObjectNumberTyped(hoveredObject, playerColor, number)
-- only continue for decks or cards
if hoveredObject.type ~= "Deck" and hoveredObject.type ~= "Card" then return end
-- check whether the hovered object is part of a players draw objects
for _, color in ipairs(playermatApi.getUsedMatColors()) do
local deckAreaObjects = playermatApi.getDeckAreaObjects(color)
if deckAreaObjects.topCard == hoveredObject or deckAreaObjects.draw == hoveredObject then
playermatApi.drawCardsWithReshuffle(color, number)
return true
end
end
-- check if this is a card with states (and then change state instead of drawing it)
local states = hoveredObject.getStates()
if states ~= nil and #states > 0 then
@ -246,6 +237,15 @@ function onObjectNumberTyped(hoveredObject, playerColor, number)
return true
end
end
-- check whether the hovered object is part of a players draw objects
for _, color in ipairs(playermatApi.getUsedMatColors()) do
local deckAreaObjects = playermatApi.getDeckAreaObjects(color)
if deckAreaObjects.topCard == hoveredObject or deckAreaObjects.draw == hoveredObject then
playermatApi.drawCardsWithReshuffle(color, number)
return true
end
end
end
-- TTS event, used to redraw the playermat slot symbols after a small delay to account for the custom font loading

View File

@ -128,6 +128,8 @@ function onLoad(savedData)
slotData = loadedData.slotData
end
updateMessageColor(playerColor)
self.interactable = false
-- get object references to owned objects