unselect objects after searching

This commit is contained in:
Chr1Z93 2024-07-08 12:47:03 +02:00
parent bf4fcd6051
commit a2e07964e3

View File

@ -160,8 +160,8 @@ function getRandomSeed()
return math.random(999) return math.random(999)
end end
-- Event hook for any object search. When chaos tokens are manipulated while the chaos bag -- Event hook for any object search. When chaos tokens are manipulated while the chaos bag
-- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the -- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the
-- chaos bag during search operations to avoid this. -- chaos bag during search operations to avoid this.
function onObjectSearchStart(object, playerColor) function onObjectSearchStart(object, playerColor)
local chaosBag = findChaosBag() local chaosBag = findChaosBag()
@ -170,14 +170,15 @@ function onObjectSearchStart(object, playerColor)
end end
end end
-- Event hook for any object search. When chaos tokens are manipulated while the chaos bag -- Event hook for any object search. When chaos tokens are manipulated while the chaos bag
-- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the -- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the
-- chaos bag during search operations to avoid this. -- chaos bag during search operations to avoid this.
function onObjectSearchEnd(object, playerColor) function onObjectSearchEnd(object, playerColor)
local chaosBag = findChaosBag() local chaosBag = findChaosBag()
if object == chaosBag then if object == chaosBag then
bagSearchers[playerColor] = nil bagSearchers[playerColor] = nil
end end
Player[playerColor].clearSelectedObjects()
end end
-- Pass object enter container events to the PlayArea to clear vector lines from dragged cards. -- Pass object enter container events to the PlayArea to clear vector lines from dragged cards.
@ -457,8 +458,8 @@ function returnAndRedraw(_, tokenGUID)
return chaosTokens[indexOfReturnedToken] return chaosTokens[indexOfReturnedToken]
end end
-- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens
-- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the
-- contents of the bag should check this method before doing so. -- contents of the bag should check this method before doing so.
-- This method will broadcast a message to all players if the bag is being searched. -- This method will broadcast a message to all players if the bag is being searched.
---@return boolean: True if the bag is manipulated, false if it should be blocked. ---@return boolean: True if the bag is manipulated, false if it should be blocked.
@ -558,9 +559,9 @@ end
-- token spawning -- token spawning
--------------------------------------------------------- ---------------------------------------------------------
-- DEPRECATED. Use TokenManager instead. -- DEPRECATED. Use TokenManager instead.
-- Spawns a single token. -- Spawns a single token.
---@param params table Array with arguments to the method. 1 = position, 2 = type, 3 = rotation ---@param params table Array with arguments to the method. 1 = position, 2 = type, 3 = rotation
function spawnToken(params) function spawnToken(params)
return tokenManager.spawnToken(params[1], params[2], params[3]) return tokenManager.spawnToken(params[1], params[2], params[3])
end end