made naming consistent to "playermat"

This commit is contained in:
Chr1Z93 2024-06-23 19:49:56 +02:00
parent 718ce79dbc
commit 11165fe7a3
37 changed files with 276 additions and 276 deletions

View File

@ -141,7 +141,7 @@
"ArkhamDBDeckImporter.a28140", "ArkhamDBDeckImporter.a28140",
"Configuration.03804b", "Configuration.03804b",
"DrawingTool.280086", "DrawingTool.280086",
"PlaymatImageSwapper.b7b45b", "PlayAreaImageSwapper.b7b45b",
"AllPlayerCards.15bb07", "AllPlayerCards.15bb07",
"InvestigatorSkillTracker.af7ed7", "InvestigatorSkillTracker.af7ed7",
"InvestigatorSkillTracker.e598c2", "InvestigatorSkillTracker.e598c2",

View File

@ -22,7 +22,7 @@
"ImageURL": "https://i.imgur.com/SBE8GR5.png", "ImageURL": "https://i.imgur.com/SBE8GR5.png",
"WidthScale": 0 "WidthScale": 0
}, },
"Description": "Only tracks tokens that actually hit the playmat.\n\nAll credit goes to TadGH!", "Description": "",
"DragSelectable": true, "DragSelectable": true,
"GMNotes": "", "GMNotes": "",
"GUID": "766620", "GUID": "766620",

View File

@ -22,7 +22,7 @@
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1915746489209870095/5F6A6F2946DBEB81667C15B112F9E35943E61A97/", "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1915746489209870095/5F6A6F2946DBEB81667C15B112F9E35943E61A97/",
"WidthScale": 0 "WidthScale": 0
}, },
"Description": "Moves all objects on the playmat in the chosen direction.", "Description": "Moves all objects on the playermat in the chosen direction.",
"DragSelectable": true, "DragSelectable": true,
"GMNotes": "", "GMNotes": "",
"GUID": "0f1374", "GUID": "0f1374",

View File

@ -22,7 +22,7 @@
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1838053776205435595/ECFB88938ADBD1EF7AEF713111A11330FD9FAA5A/", "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1838053776205435595/ECFB88938ADBD1EF7AEF713111A11330FD9FAA5A/",
"WidthScale": 0 "WidthScale": 0
}, },
"Description": "Searches the top X cards of the nearest playmat by setting your hand aside and putting the cards into your hand.\n\nPut the target of your search on your set aside hand.", "Description": "Searches the top X cards of the nearest playermat by setting your hand aside and putting the cards into your hand.\n\nPut the target of your search on your set aside hand.",
"DragSelectable": true, "DragSelectable": true,
"GMNotes": "", "GMNotes": "",
"GUID": "17aed0", "GUID": "17aed0",

View File

@ -22,7 +22,7 @@
"ImageURL": "https://i.imgur.com/gs1mtXJ.png", "ImageURL": "https://i.imgur.com/gs1mtXJ.png",
"WidthScale": 0 "WidthScale": 0
}, },
"Description": "Allows changing of the playmat image. Provide URL to the image or leave empty for default image.", "Description": "Allows changing of the playarea image. Provide URL to the image or leave empty for default image.",
"DragSelectable": true, "DragSelectable": true,
"GMNotes": "", "GMNotes": "",
"GUID": "b7b45b", "GUID": "b7b45b",
@ -37,7 +37,7 @@
"LuaScriptState": "{\"selectionIndex\":1,\"typeIndex\":1}", "LuaScriptState": "{\"selectionIndex\":1,\"typeIndex\":1}",
"MeasureMovement": false, "MeasureMovement": false,
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Playmat Image Swapper", "Nickname": "PlayArea Image Swapper",
"Snap": true, "Snap": true,
"Sticky": true, "Sticky": true,
"Tags": [ "Tags": [
@ -59,4 +59,4 @@
}, },
"Value": 0, "Value": 0,
"XmlUI": "" "XmlUI": ""
} }

View File

@ -353,7 +353,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "require(\"playermat/Playmat\")", "LuaScript": "require(\"playermat/Playermat\")",
"LuaScriptState_path": "Playermat1White.8b081b.luascriptstate", "LuaScriptState_path": "Playermat1White.8b081b.luascriptstate",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "White", "Memo": "White",

View File

@ -353,7 +353,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "require(\"playermat/Playmat\")", "LuaScript": "require(\"playermat/Playermat\")",
"LuaScriptState_path": "Playermat2Orange.bd0ff4.luascriptstate", "LuaScriptState_path": "Playermat2Orange.bd0ff4.luascriptstate",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "Orange", "Memo": "Orange",

View File

@ -353,7 +353,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "require(\"playermat/Playmat\")", "LuaScript": "require(\"playermat/Playermat\")",
"LuaScriptState_path": "Playermat3Green.383d8b.luascriptstate", "LuaScriptState_path": "Playermat3Green.383d8b.luascriptstate",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "Green", "Memo": "Green",

View File

@ -353,7 +353,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "require(\"playermat/Playmat\")", "LuaScript": "require(\"playermat/Playermat\")",
"LuaScriptState_path": "Playermat4Red.0840d5.luascriptstate", "LuaScriptState_path": "Playermat4Red.0840d5.luascriptstate",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "Red", "Memo": "Red",

View File

@ -4,7 +4,7 @@ local deckImporterApi = require("arkhamdb/DeckImporterApi")
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local optionPanelApi = require("core/OptionPanelApi") local optionPanelApi = require("core/OptionPanelApi")
local playAreaApi = require("core/PlayAreaApi") local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
-- base data for token creation -- base data for token creation
local campaignTokenData = { local campaignTokenData = {
@ -190,10 +190,10 @@ function restoreCampaignData(importData, coin)
playAreaApi.updateSurface(importData["playarea"]) playAreaApi.updateSurface(importData["playarea"])
playAreaApi.setInvestigatorCount(importData["clueCount"]) playAreaApi.setInvestigatorCount(importData["clueCount"])
-- restore Playmat slots -- restore playermat slots
if importData["slotData"] then if importData["slotData"] then
for matColor, slotData in pairs(importData["slotData"]) do for matColor, slotData in pairs(importData["slotData"]) do
playmatApi.loadSlotData(matColor, slotData) playermatApi.loadSlotData(matColor, slotData)
end end
end end
@ -272,10 +272,10 @@ function createCampaignToken(_, playerColor, _)
table.insert(campaignTokenData.ContainedObjects, indexData) table.insert(campaignTokenData.ContainedObjects, indexData)
end end
-- get the slot symbol data for each playmat (use GUIDReferenceApi to only get this for existing playmats) -- get the slot symbol data for each playermat (use GUIDReferenceApi to only get this for existing playermats)
campaignData.slotData = {} campaignData.slotData = {}
for matColor, _ in pairs(guidReferenceApi.getObjectsByType("Playermat")) do for matColor, _ in pairs(guidReferenceApi.getObjectsByType("Playermat")) do
local slotData = playmatApi.getSlotData(matColor) local slotData = playermatApi.getSlotData(matColor)
campaignData.slotData[matColor] = slotData campaignData.slotData[matColor] = slotData
end end
@ -306,7 +306,7 @@ end
function setTrauma(trauma) function setTrauma(trauma)
for i, matColor in ipairs({ "White", "Orange", "Green", "Red" }) do for i, matColor in ipairs({ "White", "Orange", "Green", "Red" }) do
playmatApi.updateCounter(matColor, "DamageCounter", trauma[i]) playermatApi.updateCounter(matColor, "DamageCounter", trauma[i])
playmatApi.updateCounter(matColor, "HorrorCounter", trauma[i + 4]) playermatApi.updateCounter(matColor, "HorrorCounter", trauma[i + 4])
end end
end end

View File

@ -1,6 +1,6 @@
-- Cleans up the table for the next scenario in a campaign: -- Cleans up the table for the next scenario in a campaign:
-- sets counters to default values (resources and doom) or trauma values (health and sanity, if not disabled) from campaign log -- sets counters to default values (resources and doom) or trauma values (health and sanity, if not disabled) from campaign log
-- puts everything on playmats and hands into respective trashcans -- puts everything on playermats and hands into respective trashcans
-- use the IGNORE_TAG to exclude objects from tidying (default: "CleanUpHelper_Ignore") -- use the IGNORE_TAG to exclude objects from tidying (default: "CleanUpHelper_Ignore")
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi") local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
@ -8,7 +8,7 @@ local chaosBagApi = require("chaosbag/ChaosBagApi")
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local mythosAreaApi = require("core/MythosAreaApi") local mythosAreaApi = require("core/MythosAreaApi")
local playAreaApi = require("core/PlayAreaApi") local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
local soundCubeApi = require("core/SoundCubeApi") local soundCubeApi = require("core/SoundCubeApi")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi") local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
@ -28,7 +28,7 @@ options["importTrauma"] = true
options["tidyPlayermats"] = true options["tidyPlayermats"] = true
options["removeDrawnLines"] = false options["removeDrawnLines"] = false
-- don't clean playmats for preludes -- don't clean playermats for preludes
local scenarioName local scenarioName
local preludeList = { local preludeList = {
["Prelude: Welcome to Hemlock Vale!"] = true ["Prelude: Welcome to Hemlock Vale!"] = true
@ -149,13 +149,13 @@ end
function updateCounters() function updateCounters()
if not getOptionValue() then return end if not getOptionValue() then return end
playmatApi.updateCounter("All", "ResourceCounter", 5) playermatApi.updateCounter("All", "ResourceCounter", 5)
playmatApi.updateCounter("All", "ClickableClueCounter", 0) playermatApi.updateCounter("All", "ClickableClueCounter", 0)
playmatApi.resetSkillTracker("All") playermatApi.resetSkillTracker("All")
for i = 1, 4 do for i = 1, 4 do
playmatApi.updateCounter(COLORS[i], "DamageCounter", RESET_VALUES.Damage[i]) playermatApi.updateCounter(COLORS[i], "DamageCounter", RESET_VALUES.Damage[i])
playmatApi.updateCounter(COLORS[i], "HorrorCounter", RESET_VALUES.Horror[i]) playermatApi.updateCounter(COLORS[i], "HorrorCounter", RESET_VALUES.Horror[i])
end end
end end
@ -272,7 +272,7 @@ function discardHands()
for i = 1, 4 do for i = 1, 4 do
local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Trash") local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Trash")
if trash == nil then return end if trash == nil then return end
local hand = Player[playmatApi.getPlayerColor(COLORS[i])].getHandObjects() local hand = Player[playermatApi.getPlayerColor(COLORS[i])].getHandObjects()
for j = #hand, 1, -1 do for j = #hand, 1, -1 do
trash.putObject(hand[j]) trash.putObject(hand[j])
end end
@ -340,7 +340,7 @@ function tidyPlayerMatCoroutine()
-- get respective trash -- get respective trash
local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Trash") local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Trash")
if trash == nil then if trash == nil then
printToAll("Trashcan for " .. COLORS[i] .. " playmat could not be found! Skipping this playermat.", "Yellow") printToAll("Trashcan for " .. COLORS[i] .. " playermat could not be found! Skipping this playermat.", "Yellow")
goto continue goto continue
end end
@ -351,7 +351,7 @@ function tidyPlayerMatCoroutine()
local objList local objList
if i < 5 then if i < 5 then
objList = playmatApi.searchAroundPlaymat(COLORS[i]) objList = playermatApi.searchAroundPlayermat(COLORS[i])
else else
-- Victory Display + Mythos Area -- Victory Display + Mythos Area
objList = searchLib.inArea({ -2, 2, 10 }, { 0, 270, 0 }, { 55, 1, 13.5 }) objList = searchLib.inArea({ -2, 2, 10 }, { 0, 270, 0 }, { 55, 1, 13.5 })

View File

@ -1,4 +1,4 @@
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
-- forward declaration of variables that are used across functions -- forward declaration of variables that are used across functions
local matColor, handColor, hovering local matColor, handColor, hovering
@ -36,7 +36,7 @@ function onLoad()
updateColors() updateColors()
-- start loop to update card count -- start loop to update card count
playmatApi.checkForDES(matColor) playermatApi.checkForDES(matColor)
Wait.time(updateValue, 1, -1) Wait.time(updateValue, 1, -1)
end end
@ -49,7 +49,7 @@ function onObjectHover(hoverColor, object)
if object == self then if object == self then
hovering = true hovering = true
playmatApi.checkForDES(matColor) playermatApi.checkForDES(matColor)
updateValue() updateValue()
else else
hovering = false hovering = false
@ -58,8 +58,8 @@ end
-- updates the matcolor and handcolor variable -- updates the matcolor and handcolor variable
function updateColors() function updateColors()
matColor = playmatApi.getMatColorByPosition(self.getPosition()) matColor = playermatApi.getMatColorByPosition(self.getPosition())
handColor = playmatApi.getPlayerColor(matColor) handColor = playermatApi.getPlayerColor(matColor)
self.setName(handColor .. " Hand Helper") self.setName(handColor .. " Hand Helper")
end end
@ -74,7 +74,7 @@ function updateValue()
if Player[handColor].getHandCount() == 0 then return end if Player[handColor].getHandCount() == 0 then return end
-- get state of "Dream-Enhancing Serum" from playermat -- get state of "Dream-Enhancing Serum" from playermat
local hasDES = playmatApi.hasDES(matColor) local hasDES = playermatApi.hasDES(matColor)
-- default to regular count if hovered -- default to regular count if hovered
if hovering then if hovering then
@ -113,5 +113,5 @@ end
-- discards a random non-hidden card from hand -- discards a random non-hidden card from hand
function discardRandom() function discardRandom()
playmatApi.doDiscardOne(matColor) playermatApi.doDiscardOne(matColor)
end end

View File

@ -1,5 +1,5 @@
local deckLib = require("util/DeckLib") local deckLib = require("util/DeckLib")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
-- forward declaration of variables that are used across functions -- forward declaration of variables that are used across functions
@ -101,12 +101,12 @@ 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)
matColor = playmatApi.getMatColorByPosition(self.getPosition()) matColor = playermatApi.getMatColorByPosition(self.getPosition())
handColor = playmatApi.getPlayerColor(matColor) handColor = playermatApi.getPlayerColor(matColor)
topCardDetected = false topCardDetected = false
-- get draw deck -- get draw deck
local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor) local deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
if deckAreaObjects.draw == nil then if deckAreaObjects.draw == nil then
printToColor(matColor .. " draw deck could not be found!", messageColor, "Red") printToColor(matColor .. " draw deck could not be found!", messageColor, "Red")
return return
@ -117,7 +117,7 @@ function startSearch(messageColor, number)
drawDeckPosition = bounds.center + Vector(0, bounds.size.y / 2 + 0.2, 0) drawDeckPosition = bounds.center + Vector(0, bounds.size.y / 2 + 0.2, 0)
printToColor("Place target(s) of search on set aside hand.", messageColor, "Green") printToColor("Place target(s) of search on set aside hand.", messageColor, "Green")
-- get playmat orientation -- get playermat orientation
local offset = -15 local offset = -15
if matColor == "Orange" or matColor == "Red" then if matColor == "Orange" or matColor == "Red" then
offset = 15 offset = 15
@ -146,7 +146,7 @@ function startSearch(messageColor, number)
searchView() searchView()
Wait.time(function() Wait.time(function()
deckAreaObjects = playmatApi.getDeckAreaObjects(matColor) deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
deckAreaObjects.draw.deal(number, handColor) deckAreaObjects.draw.deal(number, handColor)
end, 1) end, 1)
end end
@ -175,7 +175,7 @@ function endSearch(_, _, isRightClick)
-- delay is to wait for cards to enter deck -- delay is to wait for cards to enter deck
if not isRightClick then if not isRightClick then
Wait.time(function() Wait.time(function()
local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor) local deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
if deckAreaObjects.draw then if deckAreaObjects.draw then
deckAreaObjects.draw.shuffle() deckAreaObjects.draw.shuffle()
end end
@ -184,6 +184,6 @@ function endSearch(_, _, isRightClick)
-- Norman Withers handling -- Norman Withers handling
if topCardDetected then if topCardDetected then
Wait.time(function() playmatApi.flipTopCardFromDeck(matColor) end, #handCards * 0.3 + 0.75) Wait.time(function() playermatApi.flipTopCardFromDeck(matColor) end, #handCards * 0.3 + 0.75)
end end
end end

View File

@ -3,7 +3,7 @@ require("playercards/PlayerCardSpawner")
local allCardsBagApi = require("playercards/AllCardsBagApi") local allCardsBagApi = require("playercards/AllCardsBagApi")
local arkhamDb = require("arkhamdb/ArkhamDb") local arkhamDb = require("arkhamdb/ArkhamDb")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local zones = require("playermat/Zones") local zones = require("playermat/Zones")
local startsInPlayCount = 0 local startsInPlayCount = 0
@ -158,7 +158,7 @@ end
---@param deck tts__Object Callback-provided spawned deck object ---@param deck tts__Object Callback-provided spawned deck object
---@param playerColor string Color of the player to draw the cards to ---@param playerColor string Color of the player to draw the cards to
function deckSpawned(deck, playerColor) function deckSpawned(deck, playerColor)
local player = Player[playmatApi.getPlayerColor(playerColor)] local player = Player[playermatApi.getPlayerColor(playerColor)]
local handPos = player.getHandTransform(1).position -- Only one hand zone per player local handPos = player.getHandTransform(1).position -- Only one hand zone per player
local deckCards = deck.getData().ContainedObjects local deckCards = deck.getData().ContainedObjects

View File

@ -1,5 +1,5 @@
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local ZONE, TRASH local ZONE, TRASH
local doomURL = "https://i.imgur.com/EoL7yaZ.png" local doomURL = "https://i.imgur.com/EoL7yaZ.png"
@ -66,7 +66,7 @@ end
-- removes doom from playermats / playarea -- removes doom from playermats / playarea
function removeDoom(options) function removeDoom(options)
if options.Playermats then if options.Playermats then
local count = removeDoomFromList(playmatApi.searchAroundPlaymat("All")) local count = removeDoomFromList(playermatApi.searchAroundPlayermat("All"))
if count > 0 then if count > 0 then
broadcastToAll(count .. " doom removed from playermats.", "White") broadcastToAll(count .. " doom removed from playermats.", "White")
end end

View File

@ -2,7 +2,7 @@ local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local navigationOverlayApi = require("core/NavigationOverlayApi") local navigationOverlayApi = require("core/NavigationOverlayApi")
local optionPanelApi = require("core/OptionPanelApi") local optionPanelApi = require("core/OptionPanelApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
local victoryDisplayApi = require("core/VictoryDisplayApi") local victoryDisplayApi = require("core/VictoryDisplayApi")
@ -26,28 +26,28 @@ function onLoad()
addHotkey("Upkeep (Multi-handed)", triggerUpkeepMultihanded) addHotkey("Upkeep (Multi-handed)", triggerUpkeepMultihanded)
end end
-- triggers the "Upkeep" function of the calling player's playmat -- triggers the "Upkeep" function of the calling player's playermat
function triggerUpkeep(playerColor) function triggerUpkeep(playerColor)
if playerColor == "Black" then if playerColor == "Black" then
broadcastToColor("Triggering 'Upkeep (Multihanded)' instead", playerColor, "Yellow") broadcastToColor("Triggering 'Upkeep (Multihanded)' instead", playerColor, "Yellow")
triggerUpkeepMultihanded(playerColor) triggerUpkeepMultihanded(playerColor)
return return
end end
local matColor = playmatApi.getMatColor(playerColor) local matColor = playermatApi.getMatColor(playerColor)
playmatApi.doUpkeepFromHotkey(matColor, playerColor) playermatApi.doUpkeepFromHotkey(matColor, playerColor)
end end
-- triggers the "Upkeep" function of the calling player's playmat AND -- triggers the "Upkeep" function of the calling player's playermat AND
-- for all playmats that don't have a seated player, but an investigator card -- for all playermats that don't have a seated player, but an investigator card
function triggerUpkeepMultihanded(playerColor) function triggerUpkeepMultihanded(playerColor)
if playerColor ~= "Black" then if playerColor ~= "Black" then
triggerUpkeep(playerColor) triggerUpkeep(playerColor)
end end
local colors = Player.getAvailableColors() local colors = Player.getAvailableColors()
for _, handColor in ipairs(colors) do for _, handColor in ipairs(colors) do
local matColor = playmatApi.getMatColor(handColor) local matColor = playermatApi.getMatColor(handColor)
if playmatApi.returnInvestigatorId(matColor) ~= "00000" and Player[handColor].seated == false then if playermatApi.returnInvestigatorId(matColor) ~= "00000" and Player[handColor].seated == false then
playmatApi.doUpkeepFromHotkey(matColor, playerColor) playermatApi.doUpkeepFromHotkey(matColor, playerColor)
end end
end end
end end
@ -69,11 +69,11 @@ function takeCardIntoThreatArea(playerColor, hoveredObject)
return return
end end
local matColor = playmatApi.getMatColor(playerColor) local matColor = playermatApi.getMatColor(playerColor)
local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat") local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat")
-- do not continue if the threat area is already full -- do not continue if the threat area is already full
if playmatApi.getEncounterCardDrawPosition(matColor, false) == playmatApi.getEncounterCardDrawPosition(matColor, true) then if playermatApi.getEncounterCardDrawPosition(matColor, false) == playermatApi.getEncounterCardDrawPosition(matColor, true) then
broadcastToColor("Threat area is full.", playerColor, "Yellow") broadcastToColor("Threat area is full.", playerColor, "Yellow")
return return
end end
@ -84,10 +84,10 @@ function takeCardIntoThreatArea(playerColor, hoveredObject)
table.insert(moveTheseObjects, obj) table.insert(moveTheseObjects, obj)
end end
-- find out if the original card is on the green or red playmats -- find out if the original card is on the green or red playermats
local originalMatColor = guidReferenceApi.getOwnerOfObject(hoveredObject) local originalMatColor = guidReferenceApi.getOwnerOfObject(hoveredObject)
-- determine modifiers for the playmats -- determine modifiers for the playermats
local modifierY = 0 local modifierY = 0
if originalMatColor == "Red" then if originalMatColor == "Red" then
modifierY = 90 modifierY = 90
@ -103,7 +103,7 @@ function takeCardIntoThreatArea(playerColor, hoveredObject)
end end
-- move the main card -- move the main card
local pos = playmatApi.getEncounterCardDrawPosition(matColor, false) local pos = playermatApi.getEncounterCardDrawPosition(matColor, false)
hoveredObject.setPosition(pos) hoveredObject.setPosition(pos)
hoveredObject.setRotation(hoveredObject.getRotation() - Vector(0, 270 - mat.getRotation().y - modifierY, 0)) hoveredObject.setRotation(hoveredObject.getRotation() - Vector(0, 270 - mat.getRotation().y - modifierY, 0))
@ -156,7 +156,7 @@ function performDiscard(playerColor, hoveredObject)
end end
local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor) local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor)
playmatApi.discardListOfObjects(discardForMatColor, discardTheseObjects) playermatApi.discardListOfObjects(discardForMatColor, discardTheseObjects)
end end
-- discard the top card of hovered deck, calling discardObject function -- discard the top card of hovered deck, calling discardObject function
@ -180,22 +180,22 @@ end
-- helper function to get the player to trigger the discard function for -- helper function to get the player to trigger the discard function for
function getColorToDiscardFor(hoveredObject, playerColor) function getColorToDiscardFor(hoveredObject, playerColor)
local pos = hoveredObject.getPosition() local pos = hoveredObject.getPosition()
local closestMatColor = playmatApi.getMatColorByPosition(pos) local closestMatColor = playermatApi.getMatColorByPosition(pos)
-- check if actually on the closest playmat -- check if actually on the closest playermat
local closestMat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat") local closestMat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat")
local bounds = closestMat.getBounds() local bounds = closestMat.getBounds()
-- define the area "near" the playmat -- define the area "near" the playermat
local bufferAroundPlaymat = 2 local bufferAroundPlayermat = 2
local areaNearPlaymat = {} local areaNearPlayermat = {}
areaNearPlaymat.minX = bounds.center.x - bounds.size.x / 2 - bufferAroundPlaymat areaNearPlayermat.minX = bounds.center.x - bounds.size.x / 2 - bufferAroundPlayermat
areaNearPlaymat.maxX = bounds.center.x + bounds.size.x / 2 + bufferAroundPlaymat areaNearPlayermat.maxX = bounds.center.x + bounds.size.x / 2 + bufferAroundPlayermat
areaNearPlaymat.minZ = bounds.center.z - bounds.size.z / 2 - bufferAroundPlaymat areaNearPlayermat.minZ = bounds.center.z - bounds.size.z / 2 - bufferAroundPlayermat
areaNearPlaymat.maxZ = bounds.center.z + bounds.size.z / 2 + bufferAroundPlaymat areaNearPlayermat.maxZ = bounds.center.z + bounds.size.z / 2 + bufferAroundPlayermat
-- discard to closest mat if near it -- discard to closest mat if near it
if inArea(pos, areaNearPlaymat) then if inArea(pos, areaNearPlayermat) then
return closestMatColor return closestMatColor
end end
@ -208,7 +208,7 @@ function getColorToDiscardFor(hoveredObject, playerColor)
end end
-- discard to triggering mat if previous conditions weren't met -- discard to triggering mat if previous conditions weren't met
return playmatApi.getMatColor(playerColor) return playermatApi.getMatColor(playerColor)
end end
-- moves the hovered card to the victory display -- moves the hovered card to the victory display
@ -286,7 +286,7 @@ function removeOneUse(playerColor, hoveredObject)
broadcastToAll(playerName .. " removed a token: " .. tokenName, playerColor) broadcastToAll(playerName .. " removed a token: " .. tokenName, playerColor)
local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor) local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor)
playmatApi.discardListOfObjects(discardForMatColor, { targetObject }) playermatApi.discardListOfObjects(discardForMatColor, { targetObject })
end end
-- switches the triggering player to the next seat (clockwise) -- switches the triggering player to the next seat (clockwise)
@ -314,7 +314,7 @@ function switchSeat(playerColor, direction)
end end
-- get used playermats -- get used playermats
local usedColors = playmatApi.getUsedMatColors() local usedColors = playermatApi.getUsedMatColors()
table.sort(usedColors, sortByHandPosition) table.sort(usedColors, sortByHandPosition)
-- get current seat index -- get current seat index
@ -407,7 +407,7 @@ function takeClueFromLocation(playerColor, hoveredObject)
local playerName, matColor, pos local playerName, matColor, pos
if Player[playerColor] and Player[playerColor].seated then if Player[playerColor] and Player[playerColor].seated then
playerName = Player[playerColor].steam_name playerName = Player[playerColor].steam_name
matColor = playmatApi.getMatColor(playerColor) matColor = playermatApi.getMatColor(playerColor)
else else
playerName = playerColor playerName = playerColor
matColor = playerColor matColor = playerColor
@ -415,12 +415,12 @@ function takeClueFromLocation(playerColor, hoveredObject)
if clickableClues then if clickableClues then
pos = { x = 0.49, y = 2.66, z = 0.00 } pos = { x = 0.49, y = 2.66, z = 0.00 }
playmatApi.updateCounter(matColor, "ClickableClueCounter", _, 1) playermatApi.updateCounter(matColor, "ClickableClueCounter", _, 1)
else else
pos = playmatApi.transformLocalPosition({ x = -1.12, y = 0.05, z = 0.7 }, matColor) pos = playermatApi.transformLocalPosition({ x = -1.12, y = 0.05, z = 0.7 }, matColor)
end end
local rot = playmatApi.returnRotation(matColor) local rot = playermatApi.returnRotation(matColor)
-- check if found clue is a stack or single token -- check if found clue is a stack or single token
if clue.getQuantity() > 1 then if clue.getQuantity() > 1 then

View File

@ -3,7 +3,7 @@ local guidReferenceApi = require("core/GUIDReferenceApi")
local mythosAreaApi = require("core/MythosAreaApi") local mythosAreaApi = require("core/MythosAreaApi")
local navigationOverlayApi = require("core/NavigationOverlayApi") local navigationOverlayApi = require("core/NavigationOverlayApi")
local playAreaApi = require("core/PlayAreaApi") local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
local soundCubeApi = require("core/SoundCubeApi") local soundCubeApi = require("core/SoundCubeApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi") local tokenArrangerApi = require("accessories/TokenArrangerApi")
@ -194,7 +194,7 @@ function onObjectEnterZone(zone, enteringObj)
if tokenChecker.isChaosToken(enteringObj) then return end if tokenChecker.isChaosToken(enteringObj) then return end
if enteringObj.type == "Tile" and enteringObj.getMemo() and enteringObj.getLock() == false then if enteringObj.type == "Tile" and enteringObj.getMemo() and enteringObj.getLock() == false then
local matcolor = playmatApi.getMatColorByPosition(enteringObj.getPosition()) local matcolor = playermatApi.getMatColorByPosition(enteringObj.getPosition())
local trash = guidReferenceApi.getObjectByOwnerAndType(matcolor, "Trash") local trash = guidReferenceApi.getObjectByOwnerAndType(matcolor, "Trash")
trash.putObject(enteringObj) trash.putObject(enteringObj)
end end
@ -207,10 +207,10 @@ function onObjectNumberTyped(hoveredObject, playerColor, number)
if hoveredObject.type ~= "Deck" and hoveredObject.type ~= "Card" then return end if hoveredObject.type ~= "Deck" and hoveredObject.type ~= "Card" then return end
-- check whether the hovered object is part of a players draw objects -- check whether the hovered object is part of a players draw objects
for _, color in ipairs(playmatApi.getUsedMatColors()) do for _, color in ipairs(playermatApi.getUsedMatColors()) do
local deckAreaObjects = playmatApi.getDeckAreaObjects(color) local deckAreaObjects = playermatApi.getDeckAreaObjects(color)
if deckAreaObjects.topCard == hoveredObject or deckAreaObjects.draw == hoveredObject then if deckAreaObjects.topCard == hoveredObject or deckAreaObjects.draw == hoveredObject then
playmatApi.drawCardsWithReshuffle(color, number) playermatApi.drawCardsWithReshuffle(color, number)
return true return true
end end
end end
@ -226,9 +226,9 @@ function onObjectNumberTyped(hoveredObject, playerColor, number)
end end
end end
-- TTS event, used to redraw the playmat slot symbols after a small delay to account for the custom font loading -- TTS event, used to redraw the playermat slot symbols after a small delay to account for the custom font loading
function onPlayerConnect() function onPlayerConnect()
Wait.time(function() playmatApi.redrawSlotSymbols("All") end, 0.2) Wait.time(function() playermatApi.redrawSlotSymbols("All") end, 0.2)
end end
--------------------------------------------------------- ---------------------------------------------------------
@ -321,7 +321,7 @@ function drawChaosToken(params)
local tokenOffset = { -1.55, 0.25, -0.58 } local tokenOffset = { -1.55, 0.25, -0.58 }
local matGUID = params.mat.getGUID() local matGUID = params.mat.getGUID()
-- return token(s) on other playmat first -- return token(s) on other playermat first
if chaosTokensLastMatGUID ~= nil and chaosTokensLastMatGUID ~= matGUID and #chaosTokens ~= 0 then if chaosTokensLastMatGUID ~= nil and chaosTokensLastMatGUID ~= matGUID and #chaosTokens ~= 0 then
returnChaosTokens() returnChaosTokens()
chaosTokensLastMatGUID = nil chaosTokensLastMatGUID = nil
@ -440,8 +440,8 @@ function handleStatTrackerClick(_, _, isRightClick)
playerName = "Overall" playerName = "Overall"
else else
-- get mat color -- get mat color
local matColor = playmatApi.getMatColorByPosition(getObjectFromGUID(key).getPosition()) local matColor = playermatApi.getMatColorByPosition(getObjectFromGUID(key).getPosition())
playerColor = playmatApi.getPlayerColor(matColor) playerColor = playermatApi.getPlayerColor(matColor)
playerName = Player[playerColor].steam_name or playerColor playerName = Player[playerColor].steam_name or playerColor
local playerSquidCount = personalStats["Auto-fail"] or 0 local playerSquidCount = personalStats["Auto-fail"] or 0
@ -1391,7 +1391,7 @@ function removePlayermat(matColor)
if not matObjects.Playermat then return end if not matObjects.Playermat then return end
-- remove action tokens -- remove action tokens
local actionTokens = playmatApi.searchAroundPlaymat(matColor, "isUniversalToken") local actionTokens = playermatApi.searchAroundPlayermat(matColor, "isUniversalToken")
for _, obj in ipairs(actionTokens) do for _, obj in ipairs(actionTokens) do
obj.destruct() obj.destruct()
end end
@ -1431,15 +1431,15 @@ function applyOptionPanelChange(id, state)
-- option: Snap tags -- option: Snap tags
if id == "useSnapTags" then if id == "useSnapTags" then
playmatApi.setLimitSnapsByType(state, "All") playermatApi.setLimitSnapsByType(state, "All")
-- option: Draw 1 button -- option: Draw 1 button
elseif id == "showDrawButton" then elseif id == "showDrawButton" then
playmatApi.showDrawButton(state, "All") playermatApi.showDrawButton(state, "All")
-- option: Clickable clue counters -- option: Clickable clue counters
elseif id == "useClueClickers" then elseif id == "useClueClickers" then
playmatApi.clickableClues(state, "All") playermatApi.clickableClues(state, "All")
-- update master clue counter -- update master clue counter
local counter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "MasterClueCounter") local counter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "MasterClueCounter")
@ -1488,7 +1488,7 @@ end
---@param helperName string Name of the helper object ---@param helperName string Name of the helper object
---@param state boolean Contains the state of the option: true = spawn it, false = remove it ---@param state boolean Contains the state of the option: true = spawn it, false = remove it
function spawnOrRemoveHelperForPlayermats(helperName, state) function spawnOrRemoveHelperForPlayermats(helperName, state)
for color, data in pairs(playmatApi.getHelperSpawnData("All", helperName)) do for color, data in pairs(playermatApi.getHelperSpawnData("All", helperName)) do
spawnOrRemoveHelper(state, helperName, data.position, data.rotation, color) spawnOrRemoveHelper(state, helperName, data.position, data.rotation, color)
end end
end end

View File

@ -1,4 +1,4 @@
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
-- variables are intentionally global to be accessible -- variables are intentionally global to be accessible
count = 0 count = 0
@ -31,12 +31,12 @@ end
-- removes all player clues by calling the respective function from the counting bowls / clickers -- removes all player clues by calling the respective function from the counting bowls / clickers
function removeAllPlayerClues() function removeAllPlayerClues()
printToAll(count .. " clue(s) from playermats removed.", "White") printToAll(count .. " clue(s) from playermats removed.", "White")
playmatApi.removeClues("All") playermatApi.removeClues("All")
self.editButton({ index = 0, label = "0" }) self.editButton({ index = 0, label = "0" })
end end
-- gets the counted values from the counting bowls / clickers and sums them up -- gets the counted values from the counting bowls / clickers and sums them up
function sumClues() function sumClues()
count = playmatApi.getClueCount(useClickableCounters, "All") count = playermatApi.getClueCount(useClickableCounters, "All")
self.editButton({ index = 0, label = tostring(count) }) self.editButton({ index = 0, label = tostring(count) })
end end

View File

@ -1,7 +1,7 @@
local deckLib = require("util/DeckLib") local deckLib = require("util/DeckLib")
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local playAreaApi = require("core/PlayAreaApi") local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
local tokenArrangerApi = require("accessories/TokenArrangerApi") local tokenArrangerApi = require("accessories/TokenArrangerApi")
local tokenChecker = require("core/token/TokenChecker") local tokenChecker = require("core/token/TokenChecker")
@ -179,7 +179,7 @@ function drawEncounterCard(params)
end end
end end
-- draw the provided card to the requesting playmat -- draw the provided card to the requesting playermat
function actualEncounterCardDraw(card, params) function actualEncounterCardDraw(card, params)
local metadata = JSON.decode(card.getGMNotes()) or {} local metadata = JSON.decode(card.getGMNotes()) or {}
@ -189,7 +189,7 @@ function actualEncounterCardDraw(card, params)
faceUpRotation = 180 faceUpRotation = 180
end end
local rot = playmatApi.returnRotation(params.matColor):setAt("z", faceUpRotation) local rot = playermatApi.returnRotation(params.matColor):setAt("z", faceUpRotation)
deckLib.placeOrMergeIntoDeck(card, params.position, rot) deckLib.placeOrMergeIntoDeck(card, params.position, rot)
end end

View File

@ -1,4 +1,4 @@
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
fullButtonData = { fullButtonData = {
{ id = "1", width = "84", height = "33", offset = "1 2" }, -- 1. Act/Agenda { id = "1", width = "84", height = "33", offset = "1 2" }, -- 1. Act/Agenda
@ -44,10 +44,10 @@ playButtonData = {
cameraData = { cameraData = {
{ position = { -1.6, 1.55, 0 }, distance = 18 }, -- 1. Act/Agenda { position = { -1.6, 1.55, 0 }, distance = 18 }, -- 1. Act/Agenda
{ position = { -28, 1.55, 0 }, distance = -1 }, -- 2. Map { position = { -28, 1.55, 0 }, distance = -1 }, -- 2. Map
{ position = { -31.6, 1.55, 26.4 }, distance = -1 }, -- 3. Green playmat { position = { -31.6, 1.55, 26.4 }, distance = -1 }, -- 3. Green playermat
{ position = { -55, 1.55, 12.05 }, distance = -1 }, -- 4. White playmat { position = { -55, 1.55, 12.05 }, distance = -1 }, -- 4. White playermat
{ position = { -55, 1.55, -11.48 }, distance = -1 }, -- 5. Orange playmat { position = { -55, 1.55, -11.48 }, distance = -1 }, -- 5. Orange playermat
{ position = { -31.6, 1.55, -26.4 }, distance = -1 }, -- 6. Red playmat { position = { -31.6, 1.55, -26.4 }, distance = -1 }, -- 6. Red playermat
{ position = { -3, 1.55, 30 }, distance = 16 }, -- 7. Victory / SetAside { position = { -3, 1.55, 30 }, distance = 16 }, -- 7. Victory / SetAside
{ position = { -3, 1.55, -26.76 }, distance = 16 }, -- 8. Guide { position = { -3, 1.55, -26.76 }, distance = 16 }, -- 8. Guide
{ position = { -11.83, 1.55, 0 }, distance = 10 }, -- 9. Player count { position = { -11.83, 1.55, 0 }, distance = 10 }, -- 9. Player count
@ -338,19 +338,19 @@ function loadCamera(player, camera)
end end
-- swap to that color if it isn't claimed by someone else and it's currently unoccopied -- swap to that color if it isn't claimed by someone else and it's currently unoccopied
if #getSeatedPlayers() == 1 or (not isClaimed and isPlaymatAvailable(matColor)) then if #getSeatedPlayers() == 1 or (not isClaimed and isPlayermatAvailable(matColor)) then
local newPlayerColor = playmatApi.getPlayerColor(matColor) local newPlayerColor = playermatApi.getPlayerColor(matColor)
copyVisibility({ startColor = player.color, targetColor = newPlayerColor }) copyVisibility({ startColor = player.color, targetColor = newPlayerColor })
player.changeColor(newPlayerColor) player.changeColor(newPlayerColor)
player = Player[newPlayerColor] player = Player[newPlayerColor]
end end
-- search on the playmat for objects -- search on the playermat for objects
local bounds = getDynamicViewBounds(playmatApi.searchAroundPlaymat(matColor)) local bounds = getDynamicViewBounds(playermatApi.searchAroundPlayermat(matColor))
lookHere = { lookHere = {
position = { bounds.middleX, 0, bounds.middleZ }, position = { bounds.middleX, 0, bounds.middleZ },
yaw = playmatApi.returnRotation(matColor).y + 180, yaw = playermatApi.returnRotation(matColor).y + 180,
distance = 0.42 * math.max(bounds.diffX, bounds.diffZ) + 7 distance = 0.42 * math.max(bounds.diffX, bounds.diffZ) + 7
} }
end end
@ -371,9 +371,9 @@ function loadCamera(player, camera)
Wait.frames(function() player.lookAt(lookHere) end, 2) Wait.frames(function() player.lookAt(lookHere) end, 2)
end end
-- helper function to check if a playmat is available for a color swap -- helper function to check if a playermat is available for a color swap
function isPlaymatAvailable(matColor) function isPlayermatAvailable(matColor)
local newPlayerColor = playmatApi.getPlayerColor(matColor) local newPlayerColor = playermatApi.getPlayerColor(matColor)
for _, color in ipairs(getSeatedPlayers()) do for _, color in ipairs(getSeatedPlayers()) do
if color == newPlayerColor then if color == newPlayerColor then
return false return false

View File

@ -10,13 +10,13 @@ do
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "InvestigatorCounter") return guidReferenceApi.getObjectByOwnerAndType("Mythos", "InvestigatorCounter")
end end
-- Returns the current value of the investigator counter from the playmat -- Returns the current value of the investigator counter from the playermat
---@return number: Number of investigators currently set on the counter ---@return number: Number of investigators currently set on the counter
PlayAreaApi.getInvestigatorCount = function() PlayAreaApi.getInvestigatorCount = function()
return getInvestigatorCounter().getVar("val") return getInvestigatorCounter().getVar("val")
end end
-- Updates the current value of the investigator counter from the playmat -- Updates the current value of the investigator counter from the playermat
---@param count number Number of investigators to set on the counter ---@param count number Number of investigators to set on the counter
PlayAreaApi.setInvestigatorCount = function(count) PlayAreaApi.setInvestigatorCount = function(count)
getInvestigatorCounter().call("updateVal", count) getInvestigatorCounter().call("updateVal", count)
@ -57,7 +57,7 @@ do
getPlayArea().call("onScenarioChanged", scenarioName) getPlayArea().call("onScenarioChanged", scenarioName)
end end
-- Sets this playmat's snap points to limit snapping to locations or not. -- Sets this playermat's snap points to limit snapping to locations or not.
-- If matchTypes is false, snap points will be reset to snap all cards. -- If matchTypes is false, snap points will be reset to snap all cards.
---@param matchCardTypes boolean Whether snap points should only snap for the matching card types ---@param matchCardTypes boolean Whether snap points should only snap for the matching card types
PlayAreaApi.setLimitSnapsByType = function(matchCardTypes) PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)

View File

@ -2,7 +2,7 @@ do
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local optionPanelApi = require("core/OptionPanelApi") local optionPanelApi = require("core/OptionPanelApi")
local playAreaApi = require("core/PlayAreaApi") local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi") local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
@ -133,13 +133,13 @@ do
local TokenManager = {} local TokenManager = {}
local internal = {} local internal = {}
-- Spawns tokens for the card. This function is built to just throw a card at it and let it do -- Spawns tokens for the card. This function is built to just throw a card at it and let it do
-- the work once a card has hit an area where it might spawn tokens. It will check to see if -- the work once a card has hit an area where it might spawn tokens. It will check to see if
-- the card has already spawned, find appropriate data from either the uses metadata or the Data -- the card has already spawned, find appropriate data from either the uses metadata or the Data
-- Helper, and spawn the tokens. -- Helper, and spawn the tokens.
---@param card tts__Object Card to maybe spawn tokens for ---@param card tts__Object Card to maybe spawn tokens for
---@param extraUses table A table of <use type>=<count> which will modify the number of tokens ---@param extraUses table A table of <use type>=<count> which will modify the number of tokens
--- spawned for that type. e.g. Akachi's playmat should pass "Charge"=1 --- spawned for that type. e.g. Akachi's playermat should pass "Charge"=1
TokenManager.spawnForCard = function(card, extraUses) TokenManager.spawnForCard = function(card, extraUses)
if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then
return return
@ -155,10 +155,10 @@ do
-- Spawns a set of tokens on the given card. -- Spawns a set of tokens on the given card.
---@param card tts__Object Card to spawn tokens on ---@param card tts__Object Card to spawn tokens on
---@param tokenType string Type of token to spawn (template needs to be in source bag) ---@param tokenType string Type of token to spawn (template needs to be in source bag)
---@param tokenCount number How many tokens to spawn. For damage or horror this value will be set to the ---@param tokenCount number How many tokens to spawn. For damage or horror this value will be set to the
-- spawned state object rather than spawning multiple tokens -- spawned state object rather than spawning multiple tokens
---@param shiftDown? number An offset for the z-value of this group of tokens ---@param shiftDown? number An offset for the z-value of this group of tokens
---@param subType? string Subtype of token to spawn. This will only differ from the tokenName for resource tokens ---@param subType? string Subtype of token to spawn. This will only differ from the tokenName for resource tokens
TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType) TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)
local optionPanel = optionPanelApi.getOptions() local optionPanel = optionPanelApi.getOptions()
@ -244,8 +244,8 @@ do
if tokenType == "resource" and stateID ~= nil and stateID ~= 1 then if tokenType == "resource" and stateID ~= nil and stateID ~= 1 then
callback = function(spawned) spawned.setState(stateID) end callback = function(spawned) spawned.setState(stateID) end
elseif tokenType == "universalActionAbility" then elseif tokenType == "universalActionAbility" then
local matColor = playmatApi.getMatColorByPosition(card.getPosition()) local matColor = playermatApi.getMatColorByPosition(card.getPosition())
local class = playmatApi.returnInvestigatorClass(matColor) local class = playermatApi.returnInvestigatorClass(matColor)
callback = function(spawned) spawned.call("updateClassAndSymbol", { class = class, symbol = subType or class }) end callback = function(spawned) spawned.call("updateClassAndSymbol", { class = class, symbol = subType or class }) end
end end
@ -294,7 +294,7 @@ do
-- Checks a card for metadata to maybe replenish it -- Checks a card for metadata to maybe replenish it
---@param card tts__Object Card object to be replenished ---@param card tts__Object Card object to be replenished
---@param uses table The already decoded metadata.uses (to avoid decoding again) ---@param uses table The already decoded metadata.uses (to avoid decoding again)
---@param mat tts__Object The playmat the card is placed on (for rotation and casting) ---@param mat tts__Object The playermat the card is placed on (for rotation and casting)
TokenManager.maybeReplenishCard = function(card, uses, mat) TokenManager.maybeReplenishCard = function(card, uses, mat)
-- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that) -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)
if uses[1].count and uses[1].replenish then if uses[1].count and uses[1].replenish then
@ -302,7 +302,7 @@ do
end end
end end
-- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some
-- callers. -- callers.
---@param card tts__Object Card object to reset the tokens for ---@param card tts__Object Card object to reset the tokens for
TokenManager.resetTokensSpawned = function(card) TokenManager.resetTokensSpawned = function(card)
@ -347,7 +347,7 @@ do
end end
end end
-- Copies the data from the DataHelper. Will only happen once. -- Copies the data from the DataHelper. Will only happen once.
internal.initDataHelperData = function() internal.initDataHelperData = function()
if playerCardData ~= nil then if playerCardData ~= nil then
return return
@ -357,11 +357,11 @@ do
locationData = dataHelper.getTable('LOCATIONS_DATA') locationData = dataHelper.getTable('LOCATIONS_DATA')
end end
-- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state
-- of the card for both locations and standard cards. -- of the card for both locations and standard cards.
---@param card tts__Object Card to maybe spawn tokens for ---@param card tts__Object Card to maybe spawn tokens for
---@param extraUses table A table of <use type>=<count> which will modify the number of tokens ---@param extraUses table A table of <use type>=<count> which will modify the number of tokens
--- spawned for that type. e.g. Akachi's playmat should pass "Charge"=1 --- spawned for that type. e.g. Akachi's playermat should pass "Charge"=1
internal.spawnTokensFromUses = function(card, extraUses) internal.spawnTokensFromUses = function(card, extraUses)
local uses = internal.getUses(card) local uses = internal.getUses(card)
if uses == nil then return end if uses == nil then return end
@ -380,7 +380,7 @@ do
tokenSpawnTrackerApi.markTokensSpawned(card.getGUID()) tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())
end end
-- Spawn tokens for a card based on the data helper data. This will consider the face up/down state -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state
-- of the card for both locations and standard cards. -- of the card for both locations and standard cards.
---@param card tts__Object Card to maybe spawn tokens for ---@param card tts__Object Card to maybe spawn tokens for
internal.spawnTokensFromDataHelper = function(card) internal.spawnTokensFromDataHelper = function(card)
@ -397,7 +397,7 @@ do
-- Spawn tokens for a player card using data retrieved from the Data Helper. -- Spawn tokens for a player card using data retrieved from the Data Helper.
---@param card tts__Object Card to maybe spawn tokens for ---@param card tts__Object Card to maybe spawn tokens for
---@param playerData table Player card data structure retrieved from the DataHelper. Should be ---@param playerData table Player card data structure retrieved from the DataHelper. Should be
-- the right data for this card. -- the right data for this card.
internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData) internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)
local token = playerData.tokenType local token = playerData.tokenType
@ -408,7 +408,7 @@ do
-- Spawn tokens for a location using data retrieved from the Data Helper. -- Spawn tokens for a location using data retrieved from the Data Helper.
---@param card tts__Object Card to maybe spawn tokens for ---@param card tts__Object Card to maybe spawn tokens for
---@param locationData table Location data structure retrieved from the DataHelper. Should be ---@param locationData table Location data structure retrieved from the DataHelper. Should be
-- the right data for this card. -- the right data for this card.
internal.spawnLocationTokensFromDataHelper = function(card, locationData) internal.spawnLocationTokensFromDataHelper = function(card, locationData)
local clueCount = internal.getClueCountFromData(card, locationData) local clueCount = internal.getClueCountFromData(card, locationData)
@ -481,7 +481,7 @@ do
---@param card tts__Object Card object to be replenished ---@param card tts__Object Card object to be replenished
---@param uses table The already decoded metadata.uses (to avoid decoding again) ---@param uses table The already decoded metadata.uses (to avoid decoding again)
---@param mat tts__Object The playmat the card is placed on (for rotation and casting) ---@param mat tts__Object The playermat the card is placed on (for rotation and casting)
internal.replenishTokens = function(card, uses, mat) internal.replenishTokens = function(card, uses, mat)
local cardPos = card.getPosition() local cardPos = card.getPosition()

View File

@ -76,7 +76,7 @@ Thus it should be implemented like this:
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi") local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local chaosBagApi = require("chaosbag/ChaosBagApi") local chaosBagApi = require("chaosbag/ChaosBagApi")
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi") local tokenArrangerApi = require("accessories/TokenArrangerApi")
local sealedTokens = {} local sealedTokens = {}
@ -280,7 +280,7 @@ function resolveSealed()
broadcastToAll("No tokens sealed.", "Red") broadcastToAll("No tokens sealed.", "Red")
return return
end end
local closestMatColor = playmatApi.getMatColorByPosition(self.getPosition()) local closestMatColor = playermatApi.getMatColorByPosition(self.getPosition())
local mat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat") local mat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat")
local guidToBeResolved = table.remove(sealedTokens) local guidToBeResolved = table.remove(sealedTokens)
chaosBagApi.drawChaosToken(mat, true, _, guidToBeResolved) chaosBagApi.drawChaosToken(mat, true, _, guidToBeResolved)

View File

@ -1,6 +1,6 @@
local chaosBagApi = require("chaosbag/ChaosBagApi") local chaosBagApi = require("chaosbag/ChaosBagApi")
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
function onLoad(savedData) function onLoad(savedData)
self.addContextMenuItem("Enable Helper", createButtons) self.addContextMenuItem("Enable Helper", createButtons)
@ -35,9 +35,9 @@ end
function resolveToken(player, _, tokenType) function resolveToken(player, _, tokenType)
local matColor local matColor
if player.color == "Black" then if player.color == "Black" then
matColor = playmatApi.getMatColorByPosition(self.getPosition()) matColor = playermatApi.getMatColorByPosition(self.getPosition())
else else
matColor = playmatApi.getMatColor(player.color) matColor = playermatApi.getMatColor(player.color)
end end
local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat") local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat")

View File

@ -1,6 +1,6 @@
-- this helper creates buttons to help the user track which hypothesis has been chosen each round -- this helper creates buttons to help the user track which hypothesis has been chosen each round
-- (if user forgot to choose one at round start, the old one stays active) -- (if user forgot to choose one at round start, the old one stays active)
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local upgradeSheetLibrary = require("playercards/customizable/UpgradeSheetLibrary") local upgradeSheetLibrary = require("playercards/customizable/UpgradeSheetLibrary")
-- common button parameters -- common button parameters
@ -104,8 +104,8 @@ function createButtons()
end end
function findUpgradeSheet() function findUpgradeSheet()
local matColor = playmatApi.getMatColorByPosition(self.getPosition()) local matColor = playermatApi.getMatColorByPosition(self.getPosition())
local result = playmatApi.searchAroundPlaymat(matColor, "isCard") local result = playermatApi.searchAroundPlayermat(matColor, "isCard")
for j, card in ipairs(result) do for j, card in ipairs(result) do
local metadata = JSON.decode(card.getGMNotes()) or {} local metadata = JSON.decode(card.getGMNotes()) or {}
if metadata.id == "09041-c" then if metadata.id == "09041-c" then

View File

@ -1,4 +1,4 @@
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
local tokenManager = require("core/token/TokenManager") local tokenManager = require("core/token/TokenManager")
@ -46,8 +46,8 @@ end
function takeAll(playerColor) function takeAll(playerColor)
searchSelf() searchSelf()
local matColor = playmatApi.getMatColorByPosition(self.getPosition()) local matColor = playermatApi.getMatColorByPosition(self.getPosition())
playmatApi.updateCounter(matColor, "ResourceCounter", _, foundTokens) playermatApi.updateCounter(matColor, "ResourceCounter", _, foundTokens)
if clickableResourceCounter then if clickableResourceCounter then
clickableResourceCounter.call("updateVal", 0) clickableResourceCounter.call("updateVal", 0)

View File

@ -1,6 +1,6 @@
local chaosBagApi = require("chaosbag/ChaosBagApi") local chaosBagApi = require("chaosbag/ChaosBagApi")
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
-- XML background color for each token -- XML background color for each token
local tokenColor = { local tokenColor = {
@ -170,7 +170,7 @@ end
function drawSigil(player, tokenGUID) function drawSigil(player, tokenGUID)
local returnedToken = getObjectFromGUID(tokenGUID) local returnedToken = getObjectFromGUID(tokenGUID)
local matColor = playmatApi.getMatColorByPosition(returnedToken.getPosition()) local matColor = playermatApi.getMatColorByPosition(returnedToken.getPosition())
local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat") local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat")
chaosBagApi.drawChaosToken(mat, true, sigil, _, returnedToken) chaosBagApi.drawChaosToken(mat, true, sigil, _, returnedToken)

View File

@ -1,6 +1,6 @@
-- this script is shared between the lvl 0 and lvl 3 versions of Scroll of Secrets -- this script is shared between the lvl 0 and lvl 3 versions of Scroll of Secrets
local mythosAreaApi = require("core/MythosAreaApi") local mythosAreaApi = require("core/MythosAreaApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
-- get class via metadata and create context menu accordingly -- get class via metadata and create context menu accordingly
function onLoad() function onLoad()
@ -30,8 +30,8 @@ function contextFunc(playerColor, amount)
-- check for players with a deck and only display them as option -- check for players with a deck and only display them as option
for _, color in ipairs(Player.getAvailableColors()) do for _, color in ipairs(Player.getAvailableColors()) do
local matColor = playmatApi.getMatColor(color) local matColor = playermatApi.getMatColor(color)
local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor) local deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
if deckAreaObjects.draw or deckAreaObjects.topCard then if deckAreaObjects.draw or deckAreaObjects.topCard then
table.insert(options, color) table.insert(options, color)
@ -52,8 +52,8 @@ function drawCardsFromBottom(playerColor, owner, amount)
if owner == "Encounter Deck" then if owner == "Encounter Deck" then
deck = mythosAreaApi.getEncounterDeck() deck = mythosAreaApi.getEncounterDeck()
else else
local matColor = playmatApi.getMatColor(owner) local matColor = playermatApi.getMatColor(owner)
deckAreaObjects = playmatApi.getDeckAreaObjects(matColor) deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
deck = deckAreaObjects.draw deck = deckAreaObjects.draw
end end

View File

@ -1,4 +1,4 @@
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
function onLoad() function onLoad()
self.addContextMenuItem("Discard 10 cards", shortSupply) self.addContextMenuItem("Discard 10 cards", shortSupply)
@ -6,12 +6,12 @@ end
-- called by context menu entry -- called by context menu entry
function shortSupply(color) function shortSupply(color)
local matColor = playmatApi.getMatColorByPosition(self.getPosition()) local matColor = playermatApi.getMatColorByPosition(self.getPosition())
-- get draw deck and discard position -- get draw deck and discard position
local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor) local deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
local drawDeck = deckAreaObjects.draw local drawDeck = deckAreaObjects.draw
local discardPos = playmatApi.getDiscardPosition(matColor) local discardPos = playermatApi.getDiscardPosition(matColor)
-- error handling -- error handling
if discardPos == nil then if discardPos == nil then

View File

@ -1,5 +1,5 @@
local deckLib = require("util/DeckLib") local deckLib = require("util/DeckLib")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
function onLoad() function onLoad()
self.addContextMenuItem("Return this card", returnSelf) self.addContextMenuItem("Return this card", returnSelf)
@ -18,9 +18,9 @@ end
-- places this card below the deck of the player that triggered it -- places this card below the deck of the player that triggered it
function placeBelowDeck(playerColor) function placeBelowDeck(playerColor)
local matColor = playmatApi.getMatColor(playerColor) local matColor = playermatApi.getMatColor(playerColor)
local deckPos = playmatApi.getDrawPosition(matColor) local deckPos = playermatApi.getDrawPosition(matColor)
local deckRot = playmatApi.returnRotation(matColor) local deckRot = playermatApi.returnRotation(matColor)
deckRot = deckRot:setAt("z", 180) deckRot = deckRot:setAt("z", 180)
deckLib.placeOrMergeIntoDeck(self, Vector(deckPos), deckRot, true) deckLib.placeOrMergeIntoDeck(self, Vector(deckPos), deckRot, true)
end end

View File

@ -1,5 +1,5 @@
-- this script is shared between both the level 0 and the upgraded level 3 version of the card -- this script is shared between both the level 0 and the upgraded level 3 version of the card
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local modValue, loopId local modValue, loopId
local buttonParameters = { local buttonParameters = {
@ -46,8 +46,8 @@ function toggleCounter()
end end
function updateDisplay() function updateDisplay()
local matColor = playmatApi.getMatColorByPosition(self.getPosition()) local matColor = playermatApi.getMatColorByPosition(self.getPosition())
local resources = playmatApi.getCounterValue(matColor, "ResourceCounter") local resources = playermatApi.getCounterValue(matColor, "ResourceCounter")
local count = tostring(math.floor(resources / modValue)) local count = tostring(math.floor(resources / modValue))
self.editButton({ index = 0, label = count }) self.editButton({ index = 0, label = count })
end end

View File

@ -19,7 +19,7 @@
-- selectedUpgrades holds the state of checkboxes and text input, each element being: -- selectedUpgrades holds the state of checkboxes and text input, each element being:
-- selectedUpgrades[row] = { xp = #, text = "" } -- selectedUpgrades[row] = { xp = #, text = "" }
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object -- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object
-- when not selected. -- when not selected.
@ -230,7 +230,7 @@ function clickCheckbox(row, col)
selectedUpgrades[row].xp = col selectedUpgrades[row].xp = col
end end
updateCheckboxes(row) updateCheckboxes(row)
playmatApi.syncAllCustomizableCards() playermatApi.syncAllCustomizableCards()
end end
-- Updates saved value for given text box when it loses focus -- Updates saved value for given text box when it loses focus

View File

@ -1,10 +1,10 @@
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
exposedValue = 0 exposedValue = 0
local playmat local playermat
local searchParam = {} local searchParam = {}
function onLoad() function onLoad()
@ -19,14 +19,14 @@ function onLoad()
font_size = 2000 font_size = 2000
}) })
-- get closest playmat -- get closest playermat
local matColor = playmatApi.getMatColorByPosition(self.getPosition()) local matColor = playermatApi.getMatColorByPosition(self.getPosition())
playmat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat") playermat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat")
-- get search parameters (threat area excluded) -- get search parameters (threat area excluded)
local localPos = playmat.positionToLocal(playmat.getPosition()) local localPos = playermat.positionToLocal(playermat.getPosition())
searchParam.pos = playmat.positionToWorld(localPos + Vector(0, 0, 0.4)) searchParam.pos = playermat.positionToWorld(localPos + Vector(0, 0, 0.4))
searchParam.rot = playmat.getRotation() + Vector(0, 90, 0) searchParam.rot = playermat.getRotation() + Vector(0, 90, 0)
searchParam.size = Vector(8, 1, 27) searchParam.size = Vector(8, 1, 27)
searchParam.filter = "isClue" searchParam.filter = "isClue"
@ -34,7 +34,7 @@ function onLoad()
Wait.time(countItems, 1.5, -1) Wait.time(countItems, 1.5, -1)
end end
-- activated once per second, counts clues on the playmat -- activated once per second, counts clues on the playermat
function countItems() function countItems()
local totalValue = 0 local totalValue = 0
for _, item in ipairs(getClues()) do for _, item in ipairs(getClues()) do

View File

@ -46,7 +46,7 @@ local DRAWN_ENCOUNTER_POSITION = { x = 1.365, y = 0.5, z = -0.625 }
-- global position of encounter discard pile -- global position of encounter discard pile
local ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38 } local ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38 }
-- used for the buttons on the right side of the playmat -- used for the buttons on the right side of the playermat
-- starts off with the data for the "Upkeep" button and will then be changed -- starts off with the data for the "Upkeep" button and will then be changed
local buttonParameters = { local buttonParameters = {
label = "Upkeep", label = "Upkeep",
@ -169,7 +169,7 @@ function searchArea(origin, size, filter)
return searchLib.inArea(origin, self.getRotation(), size, filter) return searchLib.inArea(origin, self.getRotation(), size, filter)
end end
-- finds all objects on the playmat and associated set aside zone. -- finds all objects on the playermat and associated set aside zone.
function searchAroundSelf(filter) function searchAroundSelf(filter)
local scale = self.getScale() local scale = self.getScale()
local bounds = self.getBoundsNormalized() local bounds = self.getBoundsNormalized()
@ -180,11 +180,11 @@ function searchAroundSelf(filter)
bounds.size.z = bounds.size.z + SEARCH_AROUND_SELF_Z_BUFFER bounds.size.z = bounds.size.z + SEARCH_AROUND_SELF_Z_BUFFER
-- 'setAsideDirection' accounts for the set aside zone being on the left or right, -- 'setAsideDirection' accounts for the set aside zone being on the left or right,
-- depending on the table position of the playmat -- depending on the table position of the playermat
local setAsideDirection = bounds.center.z > 0 and 1 or -1 local setAsideDirection = bounds.center.z > 0 and 1 or -1
-- Since the cast is centered on the position, shift left or right to keep -- Since the cast is centered on the position, shift left or right to keep
-- the non-set aside edge of the cast at the edge of the playmat -- the non-set aside edge of the cast at the edge of the playermat
local localCenter = self.positionToLocal(bounds.center) local localCenter = self.positionToLocal(bounds.center)
localCenter.x = localCenter.x + setAsideDirection * SEARCH_AROUND_SELF_X_BUFFER / 2 / scale.x localCenter.x = localCenter.x + setAsideDirection * SEARCH_AROUND_SELF_X_BUFFER / 2 / scale.x
localCenter.z = localCenter.z - SEARCH_AROUND_SELF_Z_BUFFER / 2 / scale.z localCenter.z = localCenter.z - SEARCH_AROUND_SELF_Z_BUFFER / 2 / scale.z
@ -723,7 +723,7 @@ function changeColor(clickedByColor)
end end
--------------------------------------------------------- ---------------------------------------------------------
-- playmat token spawning -- playermat token spawning
--------------------------------------------------------- ---------------------------------------------------------
-- Finds all customizable cards in this play area and updates their metadata based on the selections -- Finds all customizable cards in this play area and updates their metadata based on the selections
@ -981,7 +981,7 @@ function resetSkillTracker()
if obj ~= nil then if obj ~= nil then
obj.call("updateStats", { 1, 1, 1, 1 }) obj.call("updateStats", { 1, 1, 1, 1 })
else else
printToAll("Skill tracker for " .. matColor .. " playmat could not be found.", "Yellow") printToAll("Skill tracker for " .. matColor .. " playermat could not be found.", "Yellow")
end end
end end
@ -1051,7 +1051,7 @@ function showDrawButton(visible)
end end
end end
-- shows / hides a clickable clue counter for this playmat and sets the correct amount of clues -- shows / hides a clickable clue counter for this playermat and sets the correct amount of clues
---@param showCounter boolean Whether the clickable clue counter should be visible ---@param showCounter boolean Whether the clickable clue counter should be visible
function clickableClues(showCounter) function clickableClues(showCounter)
local clickerPos = ownedObjects.ClickableClueCounter.getPosition() local clickerPos = ownedObjects.ClickableClueCounter.getPosition()

View File

@ -1,11 +1,11 @@
do do
local PlaymatApi = {} local PlayermatApi = {}
local guidReferenceApi = require("core/GUIDReferenceApi") local guidReferenceApi = require("core/GUIDReferenceApi")
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
-- Convenience function to look up a mat's object by color, or get all mats. -- Convenience function to look up a mat's object by color, or get all mats.
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
---@return table: Single-element if only single playmat is requested ---@return table: Single-element if only single playermat is requested
local function getMatForColor(matColor) local function getMatForColor(matColor)
if matColor == "All" then if matColor == "All" then
return guidReferenceApi.getObjectsByType("Playermat") return guidReferenceApi.getObjectsByType("Playermat")
@ -14,9 +14,9 @@ do
end end
end end
-- Returns the color of the closest playmat -- Returns the color of the closest playermat
---@param startPos table Starting position to get the closest mat from ---@param startPos table Starting position to get the closest mat from
PlaymatApi.getMatColorByPosition = function(startPos) PlayermatApi.getMatColorByPosition = function(startPos)
local result, smallestDistance local result, smallestDistance
for matColor, mat in pairs(getMatForColor("All")) do for matColor, mat in pairs(getMatForColor("All")) do
local distance = Vector.between(startPos, mat.getPosition()):magnitude() local distance = Vector.between(startPos, mat.getPosition()):magnitude()
@ -28,17 +28,17 @@ do
return result return result
end end
-- Returns the color of the player's hand that is seated next to the playmat -- Returns the color of the player's hand that is seated next to the playermat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlaymatApi.getPlayerColor = function(matColor) PlayermatApi.getPlayerColor = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.getVar("playerColor") return mat.getVar("playerColor")
end end
end end
-- Returns the color of the playmat that owns the playercolor's hand -- Returns the color of the playermat that owns the playercolor's hand
---@param handColor string Color of the playmat ---@param handColor string Color of the playermat
PlaymatApi.getMatColor = function(handColor) PlayermatApi.getMatColor = function(handColor)
for matColor, mat in pairs(getMatForColor("All")) do for matColor, mat in pairs(getMatForColor("All")) do
local playerColor = mat.getVar("playerColor") local playerColor = mat.getVar("playerColor")
if playerColor == handColor then if playerColor == handColor then
@ -47,35 +47,35 @@ do
end end
end end
-- Instructs a playmat to check for DES -- Instructs a playermat to check for DES
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlaymatApi.checkForDES = function(matColor) PlayermatApi.checkForDES = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("checkForDES") mat.call("checkForDES")
end end
end end
-- Returns if there is the card "Dream-Enhancing Serum" on the requested playmat -- Returns if there is the card "Dream-Enhancing Serum" on the requested playermat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
---@return boolean: whether DES is present on the playmat ---@return boolean: whether DES is present on the playermat
PlaymatApi.hasDES = function(matColor) PlayermatApi.hasDES = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.getVar("hasDES") return mat.getVar("hasDES")
end end
end end
-- gets the slot data for the playmat -- gets the slot data for the playermat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlaymatApi.getSlotData = function(matColor) PlayermatApi.getSlotData = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.getTable("slotData") return mat.getTable("slotData")
end end
end end
-- sets the slot data for the playmat -- sets the slot data for the playermat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
---@param newSlotData table New slot data for the playmat ---@param newSlotData table New slot data for the playermat
PlaymatApi.loadSlotData = function(matColor, newSlotData) PlayermatApi.loadSlotData = function(matColor, newSlotData)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.setTable("slotData", newSlotData) mat.setTable("slotData", newSlotData)
mat.call("redrawSlotSymbols") mat.call("redrawSlotSymbols")
@ -83,33 +83,33 @@ do
end end
end end
-- Performs a search of the deck area of the requested playmat and returns the result as table -- Performs a search of the deck area of the requested playermat and returns the result as table
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlaymatApi.getDeckAreaObjects = function(matColor) PlayermatApi.getDeckAreaObjects = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.call("getDeckAreaObjects") return mat.call("getDeckAreaObjects")
end end
end end
-- Flips the top card of the deck (useful after deck manipulation for Norman Withers) -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlaymatApi.flipTopCardFromDeck = function(matColor) PlayermatApi.flipTopCardFromDeck = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.call("flipTopCardFromDeck") return mat.call("flipTopCardFromDeck")
end end
end end
-- Returns the position of the discard pile of the requested playmat -- Returns the position of the discard pile of the requested playermat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlaymatApi.getDiscardPosition = function(matColor) PlayermatApi.getDiscardPosition = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.call("returnGlobalDiscardPosition") return mat.call("returnGlobalDiscardPosition")
end end
end end
-- Returns the position of the draw pile of the requested playmat -- Returns the position of the draw pile of the requested playermat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlaymatApi.getDrawPosition = function(matColor) PlayermatApi.getDrawPosition = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.call("returnGlobalDrawPosition") return mat.call("returnGlobalDrawPosition")
end end
@ -117,25 +117,25 @@ do
-- Transforms a local position into a global position -- Transforms a local position into a global position
---@param localPos table Local position to be transformed ---@param localPos table Local position to be transformed
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlaymatApi.transformLocalPosition = function(localPos, matColor) PlayermatApi.transformLocalPosition = function(localPos, matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.positionToWorld(localPos) return mat.positionToWorld(localPos)
end end
end end
-- Returns the rotation of the requested playmat -- Returns the rotation of the requested playermat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlaymatApi.returnRotation = function(matColor) PlayermatApi.returnRotation = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.getRotation() return mat.getRotation()
end end
end end
-- Returns a table with spawn data (position and rotation) for a helper object -- Returns a table with spawn data (position and rotation) for a helper object
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
---@param helperName string Name of the helper object ---@param helperName string Name of the helper object
PlaymatApi.getHelperSpawnData = function(matColor, helperName) PlayermatApi.getHelperSpawnData = function(matColor, helperName)
local resultTable = {} local resultTable = {}
local localPositionTable = { local localPositionTable = {
["Hand Helper"] = {0.05, 0, -1.182}, ["Hand Helper"] = {0.05, 0, -1.182},
@ -152,90 +152,90 @@ do
end end
-- Triggers the Upkeep for the requested playmat -- Triggers the Upkeep for the requested playermat
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
---@param playerColor string Color of the calling player (for messages) ---@param playerColor string Color of the calling player (for messages)
PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor) PlayermatApi.doUpkeepFromHotkey = function(matColor, playerColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("doUpkeepFromHotkey", playerColor) mat.call("doUpkeepFromHotkey", playerColor)
end end
end end
-- Handles discarding for the requested playmat for the provided list of objects -- Handles discarding for the requested playermat for the provided list of objects
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
---@param objList table List of objects to discard ---@param objList table List of objects to discard
PlaymatApi.discardListOfObjects = function(matColor, objList) PlayermatApi.discardListOfObjects = function(matColor, objList)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("discardListOfObjects", objList) mat.call("discardListOfObjects", objList)
end end
end end
-- Returns the active investigator id -- Returns the active investigator id
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlaymatApi.returnInvestigatorId = function(matColor) PlayermatApi.returnInvestigatorId = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.getVar("activeInvestigatorId") return mat.getVar("activeInvestigatorId")
end end
end end
-- Returns the class of the active investigator -- Returns the class of the active investigator
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlaymatApi.returnInvestigatorClass = function(matColor) PlayermatApi.returnInvestigatorClass = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.getVar("activeInvestigatorClass") return mat.getVar("activeInvestigatorClass")
end end
end end
-- Returns the position for encounter card drawing -- Returns the position for encounter card drawing
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
---@param stack boolean If true, returns the leftmost position instead of the first empty from the right ---@param stack boolean If true, returns the leftmost position instead of the first empty from the right
PlaymatApi.getEncounterCardDrawPosition = function(matColor, stack) PlayermatApi.getEncounterCardDrawPosition = function(matColor, stack)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return Vector(mat.call("getEncounterCardDrawPosition", stack)) return Vector(mat.call("getEncounterCardDrawPosition", stack))
end end
end end
-- Sets the requested playmat'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
-- matchTypes is true, the main card slot snap points will only snap assets, while the -- matchTypes is true, the main card slot snap points will only snap assets, while the
-- investigator area point will only snap Investigators. If matchTypes is false, snap points will -- investigator area point will only snap Investigators. If matchTypes is false, snap points will
-- be reset to snap all cards. -- be reset to snap all cards.
---@param matchCardTypes boolean Whether snap points should only snap for the matching card types ---@param matchCardTypes boolean Whether snap points should only snap for the matching card types
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor) PlayermatApi.setLimitSnapsByType = function(matchCardTypes, matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("setLimitSnapsByType", matchCardTypes) mat.call("setLimitSnapsByType", matchCardTypes)
end end
end end
-- Sets the requested playmat's draw 1 button to visible -- Sets the requested playermat's draw 1 button to visible
---@param isDrawButtonVisible boolean Whether the draw 1 button should be visible or not ---@param isDrawButtonVisible boolean Whether the draw 1 button should be visible or not
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor) PlayermatApi.showDrawButton = function(isDrawButtonVisible, matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("showDrawButton", isDrawButtonVisible) mat.call("showDrawButton", isDrawButtonVisible)
end end
end end
-- Shows or hides the clickable clue counter for the requested playmat -- Shows or hides the clickable clue counter for the requested playermat
---@param showCounter boolean Whether the clickable counter should be present or not ---@param showCounter boolean Whether the clickable counter should be present or not
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlaymatApi.clickableClues = function(showCounter, matColor) PlayermatApi.clickableClues = function(showCounter, matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("clickableClues", showCounter) mat.call("clickableClues", showCounter)
end end
end end
-- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlaymatApi.removeClues = function(matColor) PlayermatApi.removeClues = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("removeClues") mat.call("removeClues")
end end
end end
-- Reports the clue count for the requested playmat -- Reports the clue count for the requested playermat
---@param useClickableCounters boolean Controls which type of counter is getting checked ---@param useClickableCounters boolean Controls which type of counter is getting checked
PlaymatApi.getClueCount = function(useClickableCounters, matColor) PlayermatApi.getClueCount = function(useClickableCounters, matColor)
local count = 0 local count = 0
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
count = count + mat.call("getClueCount", useClickableCounters) count = count + mat.call("getClueCount", useClickableCounters)
@ -244,36 +244,36 @@ do
end end
-- Updates the specified owned counter -- Updates the specified owned counter
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
---@param type string Counter to target ---@param type string Counter to target
---@param newValue number Value to set the counter to ---@param newValue number Value to set the counter to
---@param modifier number If newValue is not provided, the existing value will be adjusted by this modifier ---@param modifier number If newValue is not provided, the existing value will be adjusted by this modifier
PlaymatApi.updateCounter = function(matColor, type, newValue, modifier) PlayermatApi.updateCounter = function(matColor, type, newValue, modifier)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("updateCounter", { type = type, newValue = newValue, modifier = modifier }) mat.call("updateCounter", { type = type, newValue = newValue, modifier = modifier })
end end
end end
-- Triggers the draw function for the specified playmat -- Triggers the draw function for the specified playermat
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
---@param number number Amount of cards to draw ---@param number number Amount of cards to draw
PlaymatApi.drawCardsWithReshuffle = function(matColor, number) PlayermatApi.drawCardsWithReshuffle = function(matColor, number)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("drawCardsWithReshuffle", number) mat.call("drawCardsWithReshuffle", number)
end end
end end
-- Returns the resource counter amount -- Returns the resource counter amount
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All") ---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
---@param type string Counter to target ---@param type string Counter to target
PlaymatApi.getCounterValue = function(matColor, type) PlayermatApi.getCounterValue = function(matColor, type)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
return mat.call("getCounterValue", type) return mat.call("getCounterValue", type)
end end
end end
-- Returns a list of mat colors that have an investigator placed -- Returns a list of mat colors that have an investigator placed
PlaymatApi.getUsedMatColors = function() PlayermatApi.getUsedMatColors = function()
local localInvestigatorPosition = { x = -1.17, y = 1, z = -0.01 } local localInvestigatorPosition = { x = -1.17, y = 1, z = -0.01 }
local usedColors = {} local usedColors = {}
for matColor, mat in pairs(getMatForColor("All")) do for matColor, mat in pairs(getMatForColor("All")) do
@ -287,25 +287,25 @@ do
end end
-- Resets the specified skill tracker to "1, 1, 1, 1" -- Resets the specified skill tracker to "1, 1, 1, 1"
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlaymatApi.resetSkillTracker = function(matColor) PlayermatApi.resetSkillTracker = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("resetSkillTracker") mat.call("resetSkillTracker")
end end
end end
-- Redraws the XML for the slot symbols based on the slotData table -- Redraws the XML for the slot symbols based on the slotData table
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlaymatApi.redrawSlotSymbols = function(matColor) PlayermatApi.redrawSlotSymbols = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("redrawSlotSymbols") mat.call("redrawSlotSymbols")
end end
end end
-- Finds all objects on the playmat and associated set aside zone and returns a table -- Finds all objects on the playermat and associated set aside zone and returns a table
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
---@param filter string Name of the filte function (see util/SearchLib) ---@param filter string Name of the filte function (see util/SearchLib)
PlaymatApi.searchAroundPlaymat = function(matColor, filter) PlayermatApi.searchAroundPlayermat = function(matColor, filter)
local objList = {} local objList = {}
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
for _, obj in ipairs(mat.call("searchAroundSelf", filter)) do for _, obj in ipairs(mat.call("searchAroundSelf", filter)) do
@ -316,19 +316,19 @@ do
end end
-- Discard a non-hidden card from the corresponding player's hand -- Discard a non-hidden card from the corresponding player's hand
---@param matColor string Color of the playmat - White, Orange, Green, Red or All ---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlaymatApi.doDiscardOne = function(matColor) PlayermatApi.doDiscardOne = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do for _, mat in pairs(getMatForColor(matColor)) do
mat.call("doDiscardOne") mat.call("doDiscardOne")
end end
end end
-- Triggers the metadata sync for all playmats -- Triggers the metadata sync for all playermats
PlaymatApi.syncAllCustomizableCards = function() PlayermatApi.syncAllCustomizableCards = function()
for _, mat in pairs(getMatForColor("All")) do for _, mat in pairs(getMatForColor("All")) do
mat.call("syncAllCustomizableCards") mat.call("syncAllCustomizableCards")
end end
end end
return PlaymatApi return PlayermatApi
end end

View File

@ -20,7 +20,7 @@
-- SetAside5: Hunch Deck for Joe Diamond -- SetAside5: Hunch Deck for Joe Diamond
-- SetAside6: currently unused -- SetAside6: currently unused
do do
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local Zones = { } local Zones = { }
local commonZones = {} local commonZones = {}
@ -126,7 +126,7 @@ do
and playerColor ~= "Green") then and playerColor ~= "Green") then
return nil return nil
end end
return playmatApi.transformLocalPosition(zoneData[playerColor][zoneName], playerColor) return playermatApi.transformLocalPosition(zoneData[playerColor][zoneName], playerColor)
end end
-- Return the global rotation for a card on the given player mat, based on its zone. -- Return the global rotation for a card on the given player mat, based on its zone.
@ -136,7 +136,7 @@ do
-- Y rotation to orient the card on the given player mat as well as a -- Y rotation to orient the card on the given player mat as well as a
-- Z rotation to place the card face up or face down. -- Z rotation to place the card face up or face down.
Zones.getDefaultCardRotation = function(playerColor, zoneName) Zones.getDefaultCardRotation = function(playerColor, zoneName)
local cardRotation = playmatApi.returnRotation(playerColor) local cardRotation = playermatApi.returnRotation(playerColor)
if zoneName == "Deck" then if zoneName == "Deck" then
cardRotation = cardRotation + Vector(0, 0, 180) cardRotation = cardRotation + Vector(0, 0, 180)
end end

View File

@ -1,4 +1,4 @@
local playmatApi = require("playermat/PlaymatApi") local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
local tokenManager = require("core/token/TokenManager") local tokenManager = require("core/token/TokenManager")
local TOKEN_INDEX = {} local TOKEN_INDEX = {}
@ -79,8 +79,8 @@ function onScriptingButtonDown(index, playerColor)
end end
-- check for nearest investigator card and change action token state to its class -- check for nearest investigator card and change action token state to its class
elseif tokenType == "universalActionAbility" then elseif tokenType == "universalActionAbility" then
local matColor = playmatApi.getMatColorByPosition(position) local matColor = playermatApi.getMatColorByPosition(position)
local class = playmatApi.returnInvestigatorClass(matColor) local class = playermatApi.returnInvestigatorClass(matColor)
callback = function(spawned) spawned.call("updateClassAndSymbol", { class = class, symbol = class }) end callback = function(spawned) spawned.call("updateClassAndSymbol", { class = class, symbol = class }) end
end end