Merge pull request #996 from dscarpac/move-objects
Bugfix: Added token movement for "move to threat area" button
This commit is contained in:
commit
3c398fd4cf
@ -357,7 +357,23 @@ function discardOrMove(_, playerColor, isRightClick)
|
|||||||
|
|
||||||
for _, obj in ipairs(searchResult) do
|
for _, obj in ipairs(searchResult) do
|
||||||
if obj.type == "Card" or obj.type == "Deck" then
|
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)
|
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
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user