correctly rotates cards when placing them

This commit is contained in:
Chr1Z93 2023-05-16 10:33:53 +02:00
parent bf2352f79b
commit ac5788ef75

View File

@ -1,8 +1,8 @@
local playAreaApi = require("core/PlayAreaApi") local playAreaApi = require("core/PlayAreaApi")
local pendingCall = false local pendingCall = false
local messageSent = {} local messageSent = {}
local missingData = {} local missingData = {}
local countedVP = {} local countedVP = {}
local highlightMissing = false local highlightMissing = false
local highlightCounted = false local highlightCounted = false
@ -156,7 +156,7 @@ function updateCount()
table.insert(countedVP, obj) table.insert(countedVP, obj)
end end
-- handling for stacked cards -- handling for stacked cards
elseif obj.tag == "Deck" then elseif obj.tag == "Deck" then
local VP = 0 local VP = 0
for _, deepObj in ipairs(obj.getObjects()) do for _, deepObj in ipairs(obj.getObjects()) do
@ -231,7 +231,7 @@ function highlightCountedVP()
self.editButton({ self.editButton({
index = 4, index = 4,
tooltip = (highlightCounted and "Enable" or "Disable") .. tooltip = (highlightCounted and "Enable" or "Disable") ..
" highlighting of cards with VP." " highlighting of cards with VP."
}) })
for _, obj in pairs(countedVP) do for _, obj in pairs(countedVP) do
if obj ~= nil then if obj ~= nil then
@ -270,7 +270,9 @@ function placeCard(card)
local name = card.getName() or "Unnamed card" local name = card.getName() or "Unnamed card"
for i = 1, 10 do for i = 1, 10 do
if fullSlots[i] ~= true then if fullSlots[i] ~= true then
local rot = { 0, 270, card.getRotation().z }
card.setPositionSmooth(positions[i], false, true) card.setPositionSmooth(positions[i], false, true)
card.setRotation(rot)
broadcastToAll("Victory Display: " .. name .. " placed into slot " .. i .. ".", "Green") broadcastToAll("Victory Display: " .. name .. " placed into slot " .. i .. ".", "Green")
return return
end end