diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 90fe6246..d6fa4c84 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -2933,6 +2933,10 @@ function stopTokenTransformUpdating(card) card.use_hands = true end +function unregisterCard(card) + cardTokens[card] = nil +end + function unregisterTokenFromCard(params) local card = params.card local token = params.token diff --git a/src/util/Trashcan.ttslua b/src/util/Trashcan.ttslua index 6a5a6625..a98ea78b 100644 --- a/src/util/Trashcan.ttslua +++ b/src/util/Trashcan.ttslua @@ -9,3 +9,17 @@ function emptyTrash() self.takeObject().destruct() end end + +function onObjectLeaveContainer(container, object) + if container == self then + object.locked = false + + if object.type == "Card" then + object.use_hands = true + end + + if object.type == "Card" or object.type == "Deck" then + Global.call("unregisterCard", object) + end + end +end