implementing further usage of playmatAPI
This commit is contained in:
parent
d974532072
commit
f464e5f0ff
@ -6,14 +6,13 @@ end
|
|||||||
|
|
||||||
-- called by context menu entry
|
-- called by context menu entry
|
||||||
function shortSupply(color)
|
function shortSupply(color)
|
||||||
local cardPos = self.getPosition()
|
local matColor = playmatAPI.getMatColorbyPosition(self.getPosition())
|
||||||
local mat = playmatAPI.getMatbyPosition(cardPos)
|
|
||||||
if mat == nil then return end
|
|
||||||
|
|
||||||
-- get draw deck and discard pile
|
-- get draw deck and discard position
|
||||||
mat.call("getDrawDiscardDecks")
|
local drawDeck = playmatAPI.getDrawDeck(matColor)
|
||||||
local drawDeck = mat.getVar("drawDeck")
|
local discardPos = playmatAPI.getDiscardPosition(matColor)
|
||||||
local discardPos = mat.getTable("DISCARD_PILE_POSITION")
|
|
||||||
|
-- error handling
|
||||||
if discardPos == nil then
|
if discardPos == nil then
|
||||||
broadcastToAll("Couldn't retrieve discard position from playermat!", "Red")
|
broadcastToAll("Couldn't retrieve discard position from playermat!", "Red")
|
||||||
return
|
return
|
||||||
@ -31,9 +30,6 @@ function shortSupply(color)
|
|||||||
discardPos.y = 0.5
|
discardPos.y = 0.5
|
||||||
for i = 1, 10 do
|
for i = 1, 10 do
|
||||||
discardPos.y = discardPos.y + 0.05 * i
|
discardPos.y = discardPos.y + 0.05 * i
|
||||||
drawDeck.takeObject({
|
drawDeck.takeObject({ flip = true, position = discardPos })
|
||||||
flip = true,
|
|
||||||
position = discardPos
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,24 +3,24 @@ do
|
|||||||
local internal = { }
|
local internal = { }
|
||||||
|
|
||||||
local MAT_IDS = {
|
local MAT_IDS = {
|
||||||
White = "8b081b",
|
White = "8b081b",
|
||||||
Orange = "bd0ff4",
|
Orange = "bd0ff4",
|
||||||
Green = "383d8b",
|
Green = "383d8b",
|
||||||
Red = "0840d5"
|
Red = "0840d5"
|
||||||
}
|
}
|
||||||
|
|
||||||
local CLUE_COUNTER_GUIDS = {
|
local CLUE_COUNTER_GUIDS = {
|
||||||
White = "37be78",
|
White = "37be78",
|
||||||
Orange = "1769ed",
|
Orange = "1769ed",
|
||||||
Green = "032300",
|
Green = "032300",
|
||||||
Red = "d86b7c"
|
Red = "d86b7c"
|
||||||
}
|
}
|
||||||
|
|
||||||
local CLUE_CLICKER_GUIDS = {
|
local CLUE_CLICKER_GUIDS = {
|
||||||
White = "db85d6",
|
White = "db85d6",
|
||||||
Orange = "3f22e5",
|
Orange = "3f22e5",
|
||||||
Green = "891403",
|
Green = "891403",
|
||||||
Red = "4111de"
|
Red = "4111de"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Returns the by color requested playermat as object
|
-- Returns the by color requested playermat as object
|
||||||
@ -34,29 +34,36 @@ do
|
|||||||
return mat
|
return mat
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the by position requested playermat as object
|
-- Returns the color of the by position requested playermat as string
|
||||||
---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat
|
---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat
|
||||||
PlaymatApi.getMatbyPosition = function(startPos)
|
PlaymatApi.getMatColorbyPosition = function(startPos)
|
||||||
local matColor
|
|
||||||
if startPos.x < -42 then
|
if startPos.x < -42 then
|
||||||
if startPos.z > 0 then
|
if startPos.z > 0 then
|
||||||
matColor = "White"
|
return "White"
|
||||||
else
|
else
|
||||||
matColor = "Orange"
|
return "Orange"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if startPos.z > 0 then
|
if startPos.z > 0 then
|
||||||
matColor = "Green"
|
return "Green"
|
||||||
else
|
else
|
||||||
matColor = "Red"
|
return "Red"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
|
||||||
|
|
||||||
if mat == nil then
|
-- Returns the draw deck of the requested playmat
|
||||||
broadcastToAll(playerColor .. " playermat could not be found!", "Yellow")
|
---@param matColor String Color of the playermat
|
||||||
end
|
PlaymatApi.getDrawDeck = function(matColor)
|
||||||
return mat
|
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||||
|
mat.call("getDrawDiscardDecks")
|
||||||
|
return mat.getVar("drawDeck")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Returns the position of the discard pile of the requested playmat
|
||||||
|
---@param matColor String Color of the playermat
|
||||||
|
PlaymatApi.getDiscardPosition = function(matColor)
|
||||||
|
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||||
|
return mat.getTable("DISCARD_PILE_POSITION")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Sets the requested playermat's snap points to limit snapping to matching card types or not. If
|
-- Sets the requested playermat's snap points to limit snapping to matching card types or not. If
|
||||||
|
Loading…
Reference in New Issue
Block a user