Merge pull request #838 from argonui/search-assistant
Search Assistant: Added flag to avoid double searches
This commit is contained in:
commit
7f4eae4cda
@ -5,6 +5,7 @@ local searchLib = require("util/SearchLib")
|
||||
-- forward declaration of variables that are used across functions
|
||||
local matColor, handColor, setAsidePosition, setAsideRotation, drawDeckPosition, topCardDetected
|
||||
local addedVectorLines, addedSnapPoint
|
||||
local ongoingSearch = false
|
||||
|
||||
local quickParameters = {}
|
||||
quickParameters.function_owner = self
|
||||
@ -21,6 +22,7 @@ end
|
||||
|
||||
-- regular view with search box
|
||||
function normalView()
|
||||
ongoingSearch = false
|
||||
self.clearButtons()
|
||||
|
||||
-- create buttons to search 3, 6 or 9 cards
|
||||
@ -53,6 +55,7 @@ function search12(_, playerColor) startSearch(playerColor, 12) end
|
||||
|
||||
-- view during a search with "done" buttons
|
||||
function searchView()
|
||||
ongoingSearch = true
|
||||
self.clearButtons()
|
||||
|
||||
-- create the "End Search" button
|
||||
@ -75,6 +78,7 @@ end
|
||||
|
||||
-- start the search (change UI, set handCards aside, draw cards)
|
||||
function startSearch(messageColor, number)
|
||||
if ongoingSearch then return end
|
||||
matColor = playermatApi.getMatColorByPosition(self.getPosition())
|
||||
handColor = playermatApi.getPlayerColor(matColor)
|
||||
topCardDetected = false
|
||||
@ -106,10 +110,7 @@ function startSearch(messageColor, number)
|
||||
printToColor("Place target(s) of search on set aside spot.", messageColor, "Green")
|
||||
|
||||
-- get playermat orientation
|
||||
local offset = -15
|
||||
if matColor == "Orange" or matColor == "Red" then
|
||||
offset = 15
|
||||
end
|
||||
local offset = self.getBoundsNormalized().center.z < 0 and 15 or -15
|
||||
|
||||
-- get position and rotation for set aside cards
|
||||
local handData = Player[handColor].getHandTransform()
|
||||
|
Loading…
Reference in New Issue
Block a user