added token movement
This commit is contained in:
parent
ac8d5ace69
commit
17f047a15c
@ -357,7 +357,23 @@ function discardOrMove(_, playerColor, isRightClick)
|
||||
|
||||
for _, obj in ipairs(searchResult) do
|
||||
if obj.type == "Card" or obj.type == "Deck" then
|
||||
-- initialize list of objects to move (and store local position + rotation)
|
||||
local additionalObjects = {}
|
||||
for _, tokenOnCard in ipairs(searchLib.onObject(obj, "isTileOrToken")) do
|
||||
if not tokenOnCard.locked then
|
||||
local data = {
|
||||
object = tokenOnCard,
|
||||
localPos = obj.positionToLocal(tokenOnCard.getPosition()),
|
||||
}
|
||||
table.insert(additionalObjects, data)
|
||||
end
|
||||
end
|
||||
|
||||
obj.setPosition(threatAreaPos)
|
||||
-- move tokens/tiles (to new global position)
|
||||
for _, data in ipairs(additionalObjects) do
|
||||
data.object.setPosition(obj.positionToWorld(data.localPos))
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user