Merge pull request #144 from argonui/handhelper-fix

Hand Helper: Fix playmat api connection
This commit is contained in:
Chr1Z 2023-01-03 22:08:11 +01:00 committed by GitHub
commit 405033af79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,6 +153,7 @@ end
--------------------------------------------------------- ---------------------------------------------------------
-- discards a random card from hand -- discards a random card from hand
--------------------------------------------------------- ---------------------------------------------------------
function discardRandom() function discardRandom()
if not playerExists(playerColor) then return end if not playerExists(playerColor) then return end
@ -162,10 +163,8 @@ function discardRandom()
broadcastToAll("Cannot discard from empty hand!", "Red") broadcastToAll("Cannot discard from empty hand!", "Red")
else else
local searchPos = Player[playerColor].getHandTransform().position local searchPos = Player[playerColor].getHandTransform().position
local mat = playmatAPI.getMatbyPosition(searchPos)
if mat == nil then return end
local discardPos = mat.getTable("DISCARD_PILE_POSITION") local discardPos = playmatAPI.getDiscardPosition(playmatAPI.getMatColorByPosition(searchPos))
if discardPos == nil then if discardPos == nil then
broadcastToAll("Couldn't retrieve discard position from playermat!", "Red") broadcastToAll("Couldn't retrieve discard position from playermat!", "Red")
return return