From 2d828ee4dbebb97196577ec6186164903a410609 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Mon, 8 Jul 2024 17:55:18 +0200 Subject: [PATCH] updated hand zone handling for heleprs --- src/core/Global.ttslua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 63bc24b6..fe90e66d 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -201,15 +201,19 @@ function onObjectEnterZone(zone, object) local trash = guidReferenceApi.getObjectByOwnerAndType(matcolor, "Trash") trash.putObject(object) elseif zone.type == "Hand" and object.type == "Card" then + -- make sure the card is face-up if object.is_face_down then object.flip() end + + -- disable any helpers on the card if object.hasTag("CardWithHelper") then - object.clearContextMenu() - object.call("shutOff") + object.call("setHelperState", false) end + + -- maybe reset data about sealed tokens (if that function exists) if object.hasTag("CardThatSeals") then - local func = object.getVar("resetSealedTokens") -- check if function exists (it won't for older custom content) + local func = object.getVar("resetSealedTokens") if func ~= nil then object.call("resetSealedTokens") end @@ -222,9 +226,12 @@ function onObjectLeaveZone(zone, object) -- 1 frame delay to avoid error messages when exiting the game Wait.frames( function() + -- end here if one of the objects doesn't exist if zone.isDestroyed() or object.isDestroyed() then return end + + -- resync the state of the helper on the card with the option panel if zone.type == "Hand" and object.hasTag("CardWithHelper") then - object.call("updateDisplay") + object.call("syncDisplayWithOptionPanel") end end, 1) end