diff --git a/src/core/MythosArea.ttslua b/src/core/MythosArea.ttslua index b437d1eb..20857a27 100644 --- a/src/core/MythosArea.ttslua +++ b/src/core/MythosArea.ttslua @@ -26,6 +26,9 @@ local isReshuffling = false local collisionEnabled = false local currentScenario, useFrontData, tokenData, scenarioCard +-- for stopping multiple collisions of the same object +local collisionTable = {} + function updateSave() local data = { currentScenario = currentScenario, @@ -92,6 +95,11 @@ function onCollisionEnter(collisionInfo) -- early exit for better performance if object.type ~= "Card" then return end + -- only continue if card didn't already collide + if collisionTable[object] ~= nil then return end + collisionTable[object] = 1 + Wait.frames(function() collisionTable[object] = nil end, 1) + local localPos = self.positionToLocal(object.getPosition()) if inArea(localPos, ENCOUNTER_DECK_AREA) or inArea(localPos, ENCOUNTER_DISCARD_AREA) then diff --git a/src/playermat/Playermat.ttslua b/src/playermat/Playermat.ttslua index 72d015d7..f8d023c6 100644 --- a/src/playermat/Playermat.ttslua +++ b/src/playermat/Playermat.ttslua @@ -45,6 +45,9 @@ optionPanelData.slotEditing = false local collisionEnabled = false local currentlyEditingSlots = false +-- for stopping multiple collisions of the same object +local collisionTable = {} + -- x-Values for discard buttons local DISCARD_BUTTON_X_START = -1.365 local DISCARD_BUTTON_X_OFFSET = 0.455 @@ -1261,6 +1264,11 @@ function onCollisionEnter(collisionInfo) -- only continue for cards if object.type ~= "Card" then return end + -- only continue if card didn't already collide + if collisionTable[object] ~= nil then return end + collisionTable[object] = 1 + Wait.frames(function() collisionTable[object] = nil end, 1) + local md = JSON.decode(object.getGMNotes()) or {} syncCustomizableMetadata(object, md)