added code to prevent multiple collisions
This commit is contained in:
parent
b6abd43345
commit
4c2ce6f6ed
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user