Fixed detecting tokens on dropping cards
This commit is contained in:
parent
fc60f509fe
commit
e66dbc19a5
@ -264,7 +264,7 @@ function removeOneUse(playerColor, hoveredObject)
|
|||||||
local indexByMemo = {}
|
local indexByMemo = {}
|
||||||
local distanceByMemo = {}
|
local distanceByMemo = {}
|
||||||
for _, obj in ipairs(searchResult) do
|
for _, obj in ipairs(searchResult) do
|
||||||
if not obj.locked then
|
if obj.memo or not obj.locked then
|
||||||
local objPos = obj.getPosition()
|
local objPos = obj.getPosition()
|
||||||
local distance = Vector.between(cardPos, objPos):magnitude()
|
local distance = Vector.between(cardPos, objPos):magnitude()
|
||||||
local memo = obj.memo or "NO_MEMO"
|
local memo = obj.memo or "NO_MEMO"
|
||||||
|
@ -2930,6 +2930,20 @@ function stopTokenTransformUpdating(card)
|
|||||||
card.use_hands = true
|
card.use_hands = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function unregisterTokenFromCard(params)
|
||||||
|
local card = params.card
|
||||||
|
local token = params.token
|
||||||
|
|
||||||
|
if cardTokens[card] == nil then return end
|
||||||
|
|
||||||
|
for i, tokenData in ipairs(cardTokens[card] or {}) do
|
||||||
|
if tokenData.token == token then
|
||||||
|
table.remove(cardTokens[card], i)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- removes tokens from the provided card/deck
|
-- removes tokens from the provided card/deck
|
||||||
function removeTokensFromObject(params)
|
function removeTokensFromObject(params)
|
||||||
local object = params.object
|
local object = params.object
|
||||||
|
@ -68,6 +68,13 @@ do
|
|||||||
Global.call("moveCardWithTokens", { card = card, position = position, rotation = rotation })
|
Global.call("moveCardWithTokens", { card = card, position = position, rotation = rotation })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- unregisters a token from a card
|
||||||
|
---@param card tts__Object Card that might have this token added
|
||||||
|
---@param token tts__Object Token that should get unregistered
|
||||||
|
function GlobalApi.unregisterTokenFromCard(card, token)
|
||||||
|
Global.call("unregisterTokenFromCard", { card = card, token = token })
|
||||||
|
end
|
||||||
|
|
||||||
-- loads saved options
|
-- loads saved options
|
||||||
---@param options table Set a new state for the option table
|
---@param options table Set a new state for the option table
|
||||||
function GlobalApi.loadOptionPanelSettings(options)
|
function GlobalApi.loadOptionPanelSettings(options)
|
||||||
|
@ -297,7 +297,7 @@ function discardListOfObjects(objList)
|
|||||||
elseif tokenChecker.isChaosToken(obj) then
|
elseif tokenChecker.isChaosToken(obj) then
|
||||||
-- put chaos tokens back into bag (e.g. Unrelenting)
|
-- put chaos tokens back into bag (e.g. Unrelenting)
|
||||||
chaosBagApi.returnChaosTokenToBag(obj, false)
|
chaosBagApi.returnChaosTokenToBag(obj, false)
|
||||||
elseif not obj.getLock() and not obj.hasTag("DontDiscard") then
|
elseif (obj.memo or not obj.getLock()) and not obj.hasTag("DontDiscard") then
|
||||||
-- don't touch locked objects (like the table etc.) or specific objects (like key tokens)
|
-- don't touch locked objects (like the table etc.) or specific objects (like key tokens)
|
||||||
ownedObjects.Trash.putObject(obj)
|
ownedObjects.Trash.putObject(obj)
|
||||||
end
|
end
|
||||||
|
@ -6,7 +6,7 @@ do
|
|||||||
isCardOrDeck = function(x) return x.type == "Card" or x.type == "Deck" end,
|
isCardOrDeck = function(x) return x.type == "Card" or x.type == "Deck" end,
|
||||||
isClue = function(x) return x.memo == "clueDoom" and x.is_face_down == false end,
|
isClue = function(x) return x.memo == "clueDoom" and x.is_face_down == false end,
|
||||||
isDoom = function(x) return x.memo == "clueDoom" and x.is_face_down == true end,
|
isDoom = function(x) return x.memo == "clueDoom" and x.is_face_down == true end,
|
||||||
isTileOrToken = function(x) return x.type == "Tile" or x.type == "Generic" end,
|
isTileOrToken = function(x) return (x.type == "Tile" or x.type == "Generic") and x.interactable end,
|
||||||
isUniversalToken = function(x) return x.getMemo() == "universalActionAbility" end,
|
isUniversalToken = function(x) return x.getMemo() == "universalActionAbility" end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user