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
|
-- forward declaration of variables that are used across functions
|
||||||
local matColor, handColor, setAsidePosition, setAsideRotation, drawDeckPosition, topCardDetected
|
local matColor, handColor, setAsidePosition, setAsideRotation, drawDeckPosition, topCardDetected
|
||||||
local addedVectorLines, addedSnapPoint
|
local addedVectorLines, addedSnapPoint
|
||||||
|
local ongoingSearch = false
|
||||||
|
|
||||||
local quickParameters = {}
|
local quickParameters = {}
|
||||||
quickParameters.function_owner = self
|
quickParameters.function_owner = self
|
||||||
@ -21,6 +22,7 @@ end
|
|||||||
|
|
||||||
-- regular view with search box
|
-- regular view with search box
|
||||||
function normalView()
|
function normalView()
|
||||||
|
ongoingSearch = false
|
||||||
self.clearButtons()
|
self.clearButtons()
|
||||||
|
|
||||||
-- create buttons to search 3, 6 or 9 cards
|
-- 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
|
-- view during a search with "done" buttons
|
||||||
function searchView()
|
function searchView()
|
||||||
|
ongoingSearch = true
|
||||||
self.clearButtons()
|
self.clearButtons()
|
||||||
|
|
||||||
-- create the "End Search" button
|
-- create the "End Search" button
|
||||||
@ -75,6 +78,7 @@ end
|
|||||||
|
|
||||||
-- start the search (change UI, set handCards aside, draw cards)
|
-- start the search (change UI, set handCards aside, draw cards)
|
||||||
function startSearch(messageColor, number)
|
function startSearch(messageColor, number)
|
||||||
|
if ongoingSearch then return end
|
||||||
matColor = playermatApi.getMatColorByPosition(self.getPosition())
|
matColor = playermatApi.getMatColorByPosition(self.getPosition())
|
||||||
handColor = playermatApi.getPlayerColor(matColor)
|
handColor = playermatApi.getPlayerColor(matColor)
|
||||||
topCardDetected = false
|
topCardDetected = false
|
||||||
@ -106,10 +110,7 @@ function startSearch(messageColor, number)
|
|||||||
printToColor("Place target(s) of search on set aside spot.", messageColor, "Green")
|
printToColor("Place target(s) of search on set aside spot.", messageColor, "Green")
|
||||||
|
|
||||||
-- get playermat orientation
|
-- get playermat orientation
|
||||||
local offset = -15
|
local offset = self.getBoundsNormalized().center.z < 0 and 15 or -15
|
||||||
if matColor == "Orange" or matColor == "Red" then
|
|
||||||
offset = 15
|
|
||||||
end
|
|
||||||
|
|
||||||
-- get position and rotation for set aside cards
|
-- get position and rotation for set aside cards
|
||||||
local handData = Player[handColor].getHandTransform()
|
local handData = Player[handColor].getHandTransform()
|
||||||
|
Loading…
Reference in New Issue
Block a user