Merge pull request #684 from argonui/search-assistant

Implemented deckLib for SearchAssistent
This commit is contained in:
dscarpac 2024-05-15 11:10:14 -05:00 committed by GitHub
commit ebd9f24722
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 14 deletions

View File

@ -15,7 +15,7 @@
"MergeDistancePixels": 15,
"Stackable": false,
"StandUp": false,
"Thickness": 0.2
"Thickness": 0.1
},
"ImageScalar": 1,
"ImageSecondaryURL": "",

View File

@ -1,5 +1,6 @@
local searchLib = require("util/SearchLib")
local deckLib = require("util/DeckLib")
local playmatApi = require("playermat/PlaymatApi")
local searchLib = require("util/SearchLib")
-- forward declaration of variables that are used across functions
local matColor, handColor, setAsidePosition, setAsideRotation, drawDeckPosition, topCardDetected
@ -154,9 +155,10 @@ end
function endSearch(_, _, isRightClick)
local handCards = Player[handColor].getHandObjects()
local j = 0
for i = #handCards, 1, -1 do
handCards[i].setPosition(drawDeckPosition + Vector(0, (#handCards - i) * 0.1, 0))
handCards[i].setRotation(setAsideRotation)
j = j + 1
Wait.time(function() deckLib.placeOrMergeIntoDeck(handCards[i], drawDeckPosition, setAsideRotation) end, j * 0.1)
end
-- draw set aside cards (from the ground!)
@ -178,11 +180,11 @@ function endSearch(_, _, isRightClick)
if deckAreaObjects.draw then
deckAreaObjects.draw.shuffle()
end
end, #handCards * 0.1)
end, (#handCards + 2.5) * 0.2)
end
-- Norman Withers handling
if topCardDetected then
Wait.time(function() playmatApi.flipTopCardFromDeck(matColor) end, #handCards * 0.1)
Wait.time(function() playmatApi.flipTopCardFromDeck(matColor) end, #handCards * 0.2)
end
end

View File

@ -1451,7 +1451,7 @@ function applyOptionPanelChange(id, state)
-- option: Show clean up helper
elseif id == "showCleanUpHelper" then
spawnOrRemoveHelper(state, "Clean Up Helper", { -66, 1.6, 46 })
spawnOrRemoveHelper(state, "Clean Up Helper", { -66, 1.53, 46 })
-- option: Show hand helper for each player
elseif id == "showHandHelper" then
@ -1471,7 +1471,7 @@ function applyOptionPanelChange(id, state)
-- option: Show displacement tool
elseif id == "showDisplacementTool" then
spawnOrRemoveHelper(state, "Displacement Tool", { -57, 1.6, 46 })
spawnOrRemoveHelper(state, "Displacement Tool", { -57, 1.53, 46 })
end
end
@ -1522,12 +1522,10 @@ function spawnHelperObject(name, position, rotation)
spawnTable.rotation = rotation
end
for _, obj in ipairs(sourceBag.getData().ContainedObjects) do
if obj["Nickname"] == name then
spawnTable.data = obj
spawnTable.callback_function = function(spawnedObj)
Wait.time(function() spawnedObj.setLock(true) end, 2)
end
for _, objData in ipairs(sourceBag.getData().ContainedObjects) do
if objData["Nickname"] == name then
objData["Locked"] = true
spawnTable.data = objData
return spawnObjectData(spawnTable)
end
end