From 4c064e741d69fea29a10c8ef3e01e064fe5a0bcf Mon Sep 17 00:00:00 2001 From: Henrik K Date: Fri, 5 Nov 2021 20:27:18 +0100 Subject: [PATCH] Fixed card switching after dealing of a "7" --- Global.-1.ttslua | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Global.-1.ttslua b/Global.-1.ttslua index 29b5ac5..8982181 100644 --- a/Global.-1.ttslua +++ b/Global.-1.ttslua @@ -610,21 +610,17 @@ function clickTakeHandButton(obj, color) local currentPlayer_Hand = lastCardPlayedBy.getHandObjects() local chosenPlayer_Hand = chosenPlayer.getHandObjects() - for i, chosenCard in ipairs(chosenPlayer_Hand) - do - pos = {lastCardPlayedBy.getPlayerHand()['pos_x'], lastCardPlayedBy.getPlayerHand()['pos_y'], lastCardPlayedBy.getPlayerHand()['pos_z']} - chosenCard.setPosition(pos) - cardRot = lastCardPlayedBy.getPlayerHand()['rot_y'] + 180 - chosenCard.setRotation({0, cardRot, 0}) - end - for i, playerCard in ipairs(currentPlayer_Hand) do - pos = {chosenPlayer.getPlayerHand()['pos_x'], chosenPlayer.getPlayerHand()['pos_y'], chosenPlayer.getPlayerHand()['pos_z']} - playerCard.setPosition(pos) - cardRot = chosenPlayer.getPlayerHand()['rot_y'] + 180 - playerCard.setRotation({0, cardRot, 0}) + playerCard.deal(1, chosenPlayer.color) end + + Wait.condition(function() + for i, chosenCard in ipairs(chosenPlayer_Hand) + do + chosenCard.deal(1, lastCardPlayedBy.color) + end + end, function() return #lastCardPlayedBy.getHandObjects() == 0 end) end coroutine.resume(nextTurn) showDrawButton()