From 85f449ce4bf613bff80f144b4eb1f68d0b01e6a5 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sun, 22 Oct 2023 10:24:54 +0200 Subject: [PATCH] implemented token removal below hand zone --- objects/HandTrigger.0285cc.json | 6 +++--- objects/HandTrigger.5fe087.json | 6 +++--- objects/HandTrigger.a70eee.json | 6 +++--- objects/HandTrigger.be2f17.json | 6 +++--- objects/Playermat2Orange.bd0ff4.json | 4 ++-- src/playermat/Playmat.ttslua | 22 ++++++++++++++++++++++ 6 files changed, 36 insertions(+), 14 deletions(-) diff --git a/objects/HandTrigger.0285cc.json b/objects/HandTrigger.0285cc.json index d8eff7f5..68ad32ce 100644 --- a/objects/HandTrigger.0285cc.json +++ b/objects/HandTrigger.0285cc.json @@ -32,13 +32,13 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": -30.5, + "posX": -30.35, "posY": 6, - "posZ": 36.053, + "posZ": 36.6, "rotX": 0, "rotY": 180, "rotZ": 0, - "scaleX": 21.96, + "scaleX": 22, "scaleY": 7, "scaleZ": 5 }, diff --git a/objects/HandTrigger.5fe087.json b/objects/HandTrigger.5fe087.json index 0ea988e6..a919b3b1 100644 --- a/objects/HandTrigger.5fe087.json +++ b/objects/HandTrigger.5fe087.json @@ -32,13 +32,13 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": -65.7, + "posX": -65, "posY": 6, - "posZ": -15.5, + "posZ": -16.1, "rotX": 0, "rotY": 90, "rotZ": 0, - "scaleX": 22.96, + "scaleX": 22, "scaleY": 7, "scaleZ": 5 }, diff --git a/objects/HandTrigger.a70eee.json b/objects/HandTrigger.a70eee.json index 9fcb112a..89cc2fa1 100644 --- a/objects/HandTrigger.a70eee.json +++ b/objects/HandTrigger.a70eee.json @@ -32,13 +32,13 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": -65.7, + "posX": -65, "posY": 6, - "posZ": 15.5, + "posZ": 16.1, "rotX": 0, "rotY": 90, "rotZ": 0, - "scaleX": 22.96, + "scaleX": 22, "scaleY": 7, "scaleZ": 5 }, diff --git a/objects/HandTrigger.be2f17.json b/objects/HandTrigger.be2f17.json index ac40365c..b741630b 100644 --- a/objects/HandTrigger.be2f17.json +++ b/objects/HandTrigger.be2f17.json @@ -32,13 +32,13 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": -30.5, + "posX": -30.35, "posY": 6, - "posZ": -36.364, + "posZ": -36.6, "rotX": 0, "rotY": 0, "rotZ": 0, - "scaleX": 21.96, + "scaleX": 22, "scaleY": 7, "scaleZ": 5 }, diff --git a/objects/Playermat2Orange.bd0ff4.json b/objects/Playermat2Orange.bd0ff4.json index a0c7a9a1..a11274e2 100644 --- a/objects/Playermat2Orange.bd0ff4.json +++ b/objects/Playermat2Orange.bd0ff4.json @@ -353,9 +353,9 @@ "Sticky": true, "Tooltip": false, "Transform": { - "posX": -54.999, + "posX": -55, "posY": 1.45, - "posZ": -16.098, + "posZ": -16.1, "rotX": 0, "rotY": 270, "rotZ": 0, diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index 5465a9cf..00274ff4 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -89,6 +89,9 @@ local matColor = self.getMemo() -- variable to track the status of the "Show Draw Button" option local isDrawButtonVisible = false +-- limit search calls if multiple cards enter the hand +local pendingHandSearch = false + -- global variable to report "Dream-Enhancing Serum" status isDES = false @@ -182,6 +185,10 @@ function isCard(x) return x.type == 'Card' end function isDeck(x) return x.type == 'Deck' end function isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end +function isUnlockedTokenOrTileWithMemo(x) + return (x.type == "Token" or x.type == "Tile") and x.getMemo() and x.getLock() == false +end + -- finds all objects on the playmat and associated set aside zone. function searchAroundSelf(filter) local bounds = self.getBoundsNormalized() @@ -811,6 +818,21 @@ function resetSkillTracker() end end +-- removal of tokens when a card enters the hand by searching the area below the handzone for tokens/tiles +function onObjectEnterZone(zone) + if pendingHandSearch == false and zone == ownedObjects.HandZone then + pendingHandSearch = true + Wait.time(function() + local searchPos = zone.getPosition():setAt("y", 1.5) + local searchSize = zone.getScale():setAt("y", 1) + for _, obj in ipairs(searchArea(searchPos, searchSize, isUnlockedTokenOrTileWithMemo)) do + ownedObjects.Trash.putObject(obj) + end + pendingHandSearch = false + end, 1) + end +end + --------------------------------------------------------- -- calls to 'Global' / functions for calls from outside ---------------------------------------------------------