fixed token discarding

This commit is contained in:
Chr1Z93 2024-11-19 19:03:20 +01:00
parent a7dcf7c893
commit 47e491913f

View File

@ -2929,14 +2929,24 @@ function removeTokensFromObject(params)
end end
end end
for _, obj in ipairs(searchLib.onObject(object, "isTileOrToken")) do if cardTokens[object] then
if tokenChecker.isChaosToken(obj) then -- check if this card was moved with tokens on it
returnChaosTokenToBag({ token = obj, fromBag = false }) for _, tokenData in ipairs(cardTokens[object]) do
elseif obj.getGUID() ~= "4ee1f2" and -- table tokenData.token.locked = false
obj ~= self and trash.putObject(tokenData.token)
obj.memo ~= nil and end
obj.getLock() == false then cardTokens[object] = nil
trash.putObject(obj) else
-- search area for tokens
for _, obj in ipairs(searchLib.onObject(object, "isTileOrToken")) do
if tokenChecker.isChaosToken(obj) then
returnChaosTokenToBag({ token = obj, fromBag = false })
elseif obj.getGUID() ~= "4ee1f2" and -- table
obj ~= self and
obj.memo ~= nil and
obj.getLock() == false then
trash.putObject(obj)
end
end end
end end
end end