Removed token moving from TTS events
This commit is contained in:
parent
71cd5886f7
commit
6af1831d48
@ -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 obj.memo or not obj.locked then
|
if 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"
|
||||||
|
@ -180,18 +180,6 @@ function getRandomSeed()
|
|||||||
return math.random(999)
|
return math.random(999)
|
||||||
end
|
end
|
||||||
|
|
||||||
function onObjectDrop(_, object)
|
|
||||||
if object.type == "Card" or object.type == "Deck" then
|
|
||||||
moveCardWithTokens({ card = object })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function onObjectRotate(object, _, flip, _, _, oldFlip)
|
|
||||||
if flip ~= oldFlip then
|
|
||||||
stopTokenTransformUpdating(object)
|
|
||||||
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.
|
||||||
@ -312,12 +300,6 @@ function onPlayerAction(player, action, targets)
|
|||||||
trash.putObject(target)
|
trash.putObject(target)
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
elseif action == Player.Action.PickUp then
|
|
||||||
for _, target in ipairs(targets) do
|
|
||||||
if target.type == "Card" or target.type == "Deck" then
|
|
||||||
storeTokenTransform(target)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2897,7 +2879,7 @@ function storeTokenTransform(card)
|
|||||||
cardTokens[card] = {}
|
cardTokens[card] = {}
|
||||||
local cardRot = card.getRotation()
|
local cardRot = card.getRotation()
|
||||||
for _, token in ipairs(searchLib.onObject(card, "isTileOrToken", 0.95)) do
|
for _, token in ipairs(searchLib.onObject(card, "isTileOrToken", 0.95)) do
|
||||||
if token.memo or not token.locked then
|
if not token.locked then
|
||||||
-- offset to stop the token from colliding with the card
|
-- offset to stop the token from colliding with the card
|
||||||
local tokenPos = token.getPosition() + Vector(0, 0.05, 0)
|
local tokenPos = token.getPosition() + Vector(0, 0.05, 0)
|
||||||
token.setPosition(tokenPos)
|
token.setPosition(tokenPos)
|
||||||
@ -2933,24 +2915,6 @@ function stopTokenTransformUpdating(card)
|
|||||||
card.use_hands = true
|
card.use_hands = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function unregisterCard(card)
|
|
||||||
cardTokens[card] = nil
|
|
||||||
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,13 +68,6 @@ 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 (obj.memo or not obj.getLock()) and not obj.hasTag("DontDiscard") then
|
elseif 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
|
||||||
|
@ -9,17 +9,3 @@ function emptyTrash()
|
|||||||
self.takeObject().destruct()
|
self.takeObject().destruct()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function onObjectLeaveContainer(container, object)
|
|
||||||
if container == self then
|
|
||||||
object.locked = false
|
|
||||||
|
|
||||||
if object.type == "Card" then
|
|
||||||
object.use_hands = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if object.type == "Card" or object.type == "Deck" then
|
|
||||||
Global.call("unregisterCard", object)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
Loading…
Reference in New Issue
Block a user