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",
"Configuration.03804b",
"DrawingTool.280086",
"PlaymatImageSwapper.b7b45b",
"PlayAreaImageSwapper.b7b45b",
"AllPlayerCards.15bb07",
"InvestigatorSkillTracker.af7ed7",
"InvestigatorSkillTracker.e598c2",

View File

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

View File

@ -22,7 +22,7 @@
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1915746489209870095/5F6A6F2946DBEB81667C15B112F9E35943E61A97/",
"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,
"GMNotes": "",
"GUID": "0f1374",

View File

@ -22,7 +22,7 @@
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1838053776205435595/ECFB88938ADBD1EF7AEF713111A11330FD9FAA5A/",
"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,
"GMNotes": "",
"GUID": "17aed0",

View File

@ -22,7 +22,7 @@
"ImageURL": "https://i.imgur.com/gs1mtXJ.png",
"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,
"GMNotes": "",
"GUID": "b7b45b",
@ -37,7 +37,7 @@
"LuaScriptState": "{\"selectionIndex\":1,\"typeIndex\":1}",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Playmat Image Swapper",
"Nickname": "PlayArea Image Swapper",
"Snap": true,
"Sticky": true,
"Tags": [

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
-- 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
-- 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")
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
@ -8,7 +8,7 @@ local chaosBagApi = require("chaosbag/ChaosBagApi")
local guidReferenceApi = require("core/GUIDReferenceApi")
local mythosAreaApi = require("core/MythosAreaApi")
local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib")
local soundCubeApi = require("core/SoundCubeApi")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
@ -28,7 +28,7 @@ options["importTrauma"] = true
options["tidyPlayermats"] = true
options["removeDrawnLines"] = false
-- don't clean playmats for preludes
-- don't clean playermats for preludes
local scenarioName
local preludeList = {
["Prelude: Welcome to Hemlock Vale!"] = true
@ -149,13 +149,13 @@ end
function updateCounters()
if not getOptionValue() then return end
playmatApi.updateCounter("All", "ResourceCounter", 5)
playmatApi.updateCounter("All", "ClickableClueCounter", 0)
playmatApi.resetSkillTracker("All")
playermatApi.updateCounter("All", "ResourceCounter", 5)
playermatApi.updateCounter("All", "ClickableClueCounter", 0)
playermatApi.resetSkillTracker("All")
for i = 1, 4 do
playmatApi.updateCounter(COLORS[i], "DamageCounter", RESET_VALUES.Damage[i])
playmatApi.updateCounter(COLORS[i], "HorrorCounter", RESET_VALUES.Horror[i])
playermatApi.updateCounter(COLORS[i], "DamageCounter", RESET_VALUES.Damage[i])
playermatApi.updateCounter(COLORS[i], "HorrorCounter", RESET_VALUES.Horror[i])
end
end
@ -272,7 +272,7 @@ function discardHands()
for i = 1, 4 do
local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Trash")
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
trash.putObject(hand[j])
end
@ -340,7 +340,7 @@ function tidyPlayerMatCoroutine()
-- get respective trash
local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Trash")
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
end
@ -351,7 +351,7 @@ function tidyPlayerMatCoroutine()
local objList
if i < 5 then
objList = playmatApi.searchAroundPlaymat(COLORS[i])
objList = playermatApi.searchAroundPlayermat(COLORS[i])
else
-- Victory Display + Mythos Area
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
local matColor, handColor, hovering
@ -36,7 +36,7 @@ function onLoad()
updateColors()
-- start loop to update card count
playmatApi.checkForDES(matColor)
playermatApi.checkForDES(matColor)
Wait.time(updateValue, 1, -1)
end
@ -49,7 +49,7 @@ function onObjectHover(hoverColor, object)
if object == self then
hovering = true
playmatApi.checkForDES(matColor)
playermatApi.checkForDES(matColor)
updateValue()
else
hovering = false
@ -58,8 +58,8 @@ end
-- updates the matcolor and handcolor variable
function updateColors()
matColor = playmatApi.getMatColorByPosition(self.getPosition())
handColor = playmatApi.getPlayerColor(matColor)
matColor = playermatApi.getMatColorByPosition(self.getPosition())
handColor = playermatApi.getPlayerColor(matColor)
self.setName(handColor .. " Hand Helper")
end
@ -74,7 +74,7 @@ function updateValue()
if Player[handColor].getHandCount() == 0 then return end
-- get state of "Dream-Enhancing Serum" from playermat
local hasDES = playmatApi.hasDES(matColor)
local hasDES = playermatApi.hasDES(matColor)
-- default to regular count if hovered
if hovering then
@ -113,5 +113,5 @@ end
-- discards a random non-hidden card from hand
function discardRandom()
playmatApi.doDiscardOne(matColor)
playermatApi.doDiscardOne(matColor)
end

View File

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

View File

@ -3,7 +3,7 @@ require("playercards/PlayerCardSpawner")
local allCardsBagApi = require("playercards/AllCardsBagApi")
local arkhamDb = require("arkhamdb/ArkhamDb")
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
local zones = require("playermat/Zones")
local startsInPlayCount = 0
@ -158,7 +158,7 @@ end
---@param deck tts__Object Callback-provided spawned deck object
---@param playerColor string Color of the player to draw the cards to
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 deckCards = deck.getData().ContainedObjects

View File

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

View File

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

View File

@ -3,7 +3,7 @@ local guidReferenceApi = require("core/GUIDReferenceApi")
local mythosAreaApi = require("core/MythosAreaApi")
local navigationOverlayApi = require("core/NavigationOverlayApi")
local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib")
local soundCubeApi = require("core/SoundCubeApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi")
@ -194,7 +194,7 @@ function onObjectEnterZone(zone, enteringObj)
if tokenChecker.isChaosToken(enteringObj) then return end
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")
trash.putObject(enteringObj)
end
@ -207,10 +207,10 @@ function onObjectNumberTyped(hoveredObject, playerColor, number)
if hoveredObject.type ~= "Deck" and hoveredObject.type ~= "Card" then return end
-- check whether the hovered object is part of a players draw objects
for _, color in ipairs(playmatApi.getUsedMatColors()) do
local deckAreaObjects = playmatApi.getDeckAreaObjects(color)
for _, color in ipairs(playermatApi.getUsedMatColors()) do
local deckAreaObjects = playermatApi.getDeckAreaObjects(color)
if deckAreaObjects.topCard == hoveredObject or deckAreaObjects.draw == hoveredObject then
playmatApi.drawCardsWithReshuffle(color, number)
playermatApi.drawCardsWithReshuffle(color, number)
return true
end
end
@ -226,9 +226,9 @@ function onObjectNumberTyped(hoveredObject, playerColor, number)
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()
Wait.time(function() playmatApi.redrawSlotSymbols("All") end, 0.2)
Wait.time(function() playermatApi.redrawSlotSymbols("All") end, 0.2)
end
---------------------------------------------------------
@ -321,7 +321,7 @@ function drawChaosToken(params)
local tokenOffset = { -1.55, 0.25, -0.58 }
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
returnChaosTokens()
chaosTokensLastMatGUID = nil
@ -440,8 +440,8 @@ function handleStatTrackerClick(_, _, isRightClick)
playerName = "Overall"
else
-- get mat color
local matColor = playmatApi.getMatColorByPosition(getObjectFromGUID(key).getPosition())
playerColor = playmatApi.getPlayerColor(matColor)
local matColor = playermatApi.getMatColorByPosition(getObjectFromGUID(key).getPosition())
playerColor = playermatApi.getPlayerColor(matColor)
playerName = Player[playerColor].steam_name or playerColor
local playerSquidCount = personalStats["Auto-fail"] or 0
@ -1391,7 +1391,7 @@ function removePlayermat(matColor)
if not matObjects.Playermat then return end
-- remove action tokens
local actionTokens = playmatApi.searchAroundPlaymat(matColor, "isUniversalToken")
local actionTokens = playermatApi.searchAroundPlayermat(matColor, "isUniversalToken")
for _, obj in ipairs(actionTokens) do
obj.destruct()
end
@ -1431,15 +1431,15 @@ function applyOptionPanelChange(id, state)
-- option: Snap tags
if id == "useSnapTags" then
playmatApi.setLimitSnapsByType(state, "All")
playermatApi.setLimitSnapsByType(state, "All")
-- option: Draw 1 button
elseif id == "showDrawButton" then
playmatApi.showDrawButton(state, "All")
playermatApi.showDrawButton(state, "All")
-- option: Clickable clue counters
elseif id == "useClueClickers" then
playmatApi.clickableClues(state, "All")
playermatApi.clickableClues(state, "All")
-- update master clue counter
local counter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "MasterClueCounter")
@ -1488,7 +1488,7 @@ end
---@param helperName string Name of the helper object
---@param state boolean Contains the state of the option: true = spawn it, false = remove it
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)
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
count = 0
@ -31,12 +31,12 @@ end
-- removes all player clues by calling the respective function from the counting bowls / clickers
function removeAllPlayerClues()
printToAll(count .. " clue(s) from playermats removed.", "White")
playmatApi.removeClues("All")
playermatApi.removeClues("All")
self.editButton({ index = 0, label = "0" })
end
-- gets the counted values from the counting bowls / clickers and sums them up
function sumClues()
count = playmatApi.getClueCount(useClickableCounters, "All")
count = playermatApi.getClueCount(useClickableCounters, "All")
self.editButton({ index = 0, label = tostring(count) })
end

View File

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

View File

@ -1,4 +1,4 @@
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
fullButtonData = {
{ id = "1", width = "84", height = "33", offset = "1 2" }, -- 1. Act/Agenda
@ -44,10 +44,10 @@ playButtonData = {
cameraData = {
{ position = { -1.6, 1.55, 0 }, distance = 18 }, -- 1. Act/Agenda
{ position = { -28, 1.55, 0 }, distance = -1 }, -- 2. Map
{ position = { -31.6, 1.55, 26.4 }, distance = -1 }, -- 3. Green playmat
{ position = { -55, 1.55, 12.05 }, distance = -1 }, -- 4. White playmat
{ position = { -55, 1.55, -11.48 }, distance = -1 }, -- 5. Orange playmat
{ position = { -31.6, 1.55, -26.4 }, distance = -1 }, -- 6. Red playmat
{ position = { -31.6, 1.55, 26.4 }, distance = -1 }, -- 3. Green playermat
{ position = { -55, 1.55, 12.05 }, distance = -1 }, -- 4. White playermat
{ position = { -55, 1.55, -11.48 }, distance = -1 }, -- 5. Orange playermat
{ 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, -26.76 }, distance = 16 }, -- 8. Guide
{ position = { -11.83, 1.55, 0 }, distance = 10 }, -- 9. Player count
@ -338,19 +338,19 @@ function loadCamera(player, camera)
end
-- 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
local newPlayerColor = playmatApi.getPlayerColor(matColor)
if #getSeatedPlayers() == 1 or (not isClaimed and isPlayermatAvailable(matColor)) then
local newPlayerColor = playermatApi.getPlayerColor(matColor)
copyVisibility({ startColor = player.color, targetColor = newPlayerColor })
player.changeColor(newPlayerColor)
player = Player[newPlayerColor]
end
-- search on the playmat for objects
local bounds = getDynamicViewBounds(playmatApi.searchAroundPlaymat(matColor))
-- search on the playermat for objects
local bounds = getDynamicViewBounds(playermatApi.searchAroundPlayermat(matColor))
lookHere = {
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
}
end
@ -371,9 +371,9 @@ function loadCamera(player, camera)
Wait.frames(function() player.lookAt(lookHere) end, 2)
end
-- helper function to check if a playmat is available for a color swap
function isPlaymatAvailable(matColor)
local newPlayerColor = playmatApi.getPlayerColor(matColor)
-- helper function to check if a playermat is available for a color swap
function isPlayermatAvailable(matColor)
local newPlayerColor = playermatApi.getPlayerColor(matColor)
for _, color in ipairs(getSeatedPlayers()) do
if color == newPlayerColor then
return false

View File

@ -10,13 +10,13 @@ do
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "InvestigatorCounter")
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
PlayAreaApi.getInvestigatorCount = function()
return getInvestigatorCounter().getVar("val")
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
PlayAreaApi.setInvestigatorCount = function(count)
getInvestigatorCounter().call("updateVal", count)
@ -57,7 +57,7 @@ do
getPlayArea().call("onScenarioChanged", scenarioName)
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.
---@param matchCardTypes boolean Whether snap points should only snap for the matching card types
PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)

View File

@ -2,7 +2,7 @@ do
local guidReferenceApi = require("core/GUIDReferenceApi")
local optionPanelApi = require("core/OptionPanelApi")
local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
@ -133,13 +133,13 @@ do
local TokenManager = {}
local internal = {}
-- 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
-- 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 card has already spawned, find appropriate data from either the uses metadata or the Data
-- Helper, and spawn the tokens.
---@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
--- 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)
if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then
return
@ -155,10 +155,10 @@ do
-- Spawns a set of tokens on the given card.
---@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 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
---@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)
local optionPanel = optionPanelApi.getOptions()
@ -244,8 +244,8 @@ do
if tokenType == "resource" and stateID ~= nil and stateID ~= 1 then
callback = function(spawned) spawned.setState(stateID) end
elseif tokenType == "universalActionAbility" then
local matColor = playmatApi.getMatColorByPosition(card.getPosition())
local class = playmatApi.returnInvestigatorClass(matColor)
local matColor = playermatApi.getMatColorByPosition(card.getPosition())
local class = playermatApi.returnInvestigatorClass(matColor)
callback = function(spawned) spawned.call("updateClassAndSymbol", { class = class, symbol = subType or class }) end
end
@ -294,7 +294,7 @@ do
-- Checks a card for metadata to maybe replenish it
---@param card tts__Object Card object to be replenished
---@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)
-- 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
@ -302,7 +302,7 @@ do
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.
---@param card tts__Object Card object to reset the tokens for
TokenManager.resetTokensSpawned = function(card)
@ -347,7 +347,7 @@ do
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()
if playerCardData ~= nil then
return
@ -357,11 +357,11 @@ do
locationData = dataHelper.getTable('LOCATIONS_DATA')
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.
---@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
--- 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)
local uses = internal.getUses(card)
if uses == nil then return end
@ -380,7 +380,7 @@ do
tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())
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.
---@param card tts__Object Card to maybe spawn tokens for
internal.spawnTokensFromDataHelper = function(card)
@ -397,7 +397,7 @@ do
-- Spawn tokens for a player card using data retrieved from the Data Helper.
---@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.
internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)
local token = playerData.tokenType
@ -408,7 +408,7 @@ do
-- Spawn tokens for a location using data retrieved from the Data Helper.
---@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.
internal.spawnLocationTokensFromDataHelper = function(card, locationData)
local clueCount = internal.getClueCountFromData(card, locationData)
@ -481,7 +481,7 @@ do
---@param card tts__Object Card object to be replenished
---@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)
local cardPos = card.getPosition()

View File

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

View File

@ -1,6 +1,6 @@
local chaosBagApi = require("chaosbag/ChaosBagApi")
local guidReferenceApi = require("core/GUIDReferenceApi")
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
function onLoad(savedData)
self.addContextMenuItem("Enable Helper", createButtons)
@ -35,9 +35,9 @@ end
function resolveToken(player, _, tokenType)
local matColor
if player.color == "Black" then
matColor = playmatApi.getMatColorByPosition(self.getPosition())
matColor = playermatApi.getMatColorByPosition(self.getPosition())
else
matColor = playmatApi.getMatColor(player.color)
matColor = playermatApi.getMatColor(player.color)
end
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
-- (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")
-- common button parameters
@ -104,8 +104,8 @@ function createButtons()
end
function findUpgradeSheet()
local matColor = playmatApi.getMatColorByPosition(self.getPosition())
local result = playmatApi.searchAroundPlaymat(matColor, "isCard")
local matColor = playermatApi.getMatColorByPosition(self.getPosition())
local result = playermatApi.searchAroundPlayermat(matColor, "isCard")
for j, card in ipairs(result) do
local metadata = JSON.decode(card.getGMNotes()) or {}
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 tokenManager = require("core/token/TokenManager")
@ -46,8 +46,8 @@ end
function takeAll(playerColor)
searchSelf()
local matColor = playmatApi.getMatColorByPosition(self.getPosition())
playmatApi.updateCounter(matColor, "ResourceCounter", _, foundTokens)
local matColor = playermatApi.getMatColorByPosition(self.getPosition())
playermatApi.updateCounter(matColor, "ResourceCounter", _, foundTokens)
if clickableResourceCounter then
clickableResourceCounter.call("updateVal", 0)

View File

@ -1,6 +1,6 @@
local chaosBagApi = require("chaosbag/ChaosBagApi")
local guidReferenceApi = require("core/GUIDReferenceApi")
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
-- XML background color for each token
local tokenColor = {
@ -170,7 +170,7 @@ end
function drawSigil(player, tokenGUID)
local returnedToken = getObjectFromGUID(tokenGUID)
local matColor = playmatApi.getMatColorByPosition(returnedToken.getPosition())
local matColor = playermatApi.getMatColorByPosition(returnedToken.getPosition())
local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat")
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
local mythosAreaApi = require("core/MythosAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
-- get class via metadata and create context menu accordingly
function onLoad()
@ -30,8 +30,8 @@ function contextFunc(playerColor, amount)
-- check for players with a deck and only display them as option
for _, color in ipairs(Player.getAvailableColors()) do
local matColor = playmatApi.getMatColor(color)
local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)
local matColor = playermatApi.getMatColor(color)
local deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
if deckAreaObjects.draw or deckAreaObjects.topCard then
table.insert(options, color)
@ -52,8 +52,8 @@ function drawCardsFromBottom(playerColor, owner, amount)
if owner == "Encounter Deck" then
deck = mythosAreaApi.getEncounterDeck()
else
local matColor = playmatApi.getMatColor(owner)
deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)
local matColor = playermatApi.getMatColor(owner)
deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
deck = deckAreaObjects.draw
end

View File

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

View File

@ -1,5 +1,5 @@
local deckLib = require("util/DeckLib")
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
function onLoad()
self.addContextMenuItem("Return this card", returnSelf)
@ -18,9 +18,9 @@ end
-- places this card below the deck of the player that triggered it
function placeBelowDeck(playerColor)
local matColor = playmatApi.getMatColor(playerColor)
local deckPos = playmatApi.getDrawPosition(matColor)
local deckRot = playmatApi.returnRotation(matColor)
local matColor = playermatApi.getMatColor(playerColor)
local deckPos = playermatApi.getDrawPosition(matColor)
local deckRot = playermatApi.returnRotation(matColor)
deckRot = deckRot:setAt("z", 180)
deckLib.placeOrMergeIntoDeck(self, Vector(deckPos), deckRot, true)
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
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
local modValue, loopId
local buttonParameters = {
@ -46,8 +46,8 @@ function toggleCounter()
end
function updateDisplay()
local matColor = playmatApi.getMatColorByPosition(self.getPosition())
local resources = playmatApi.getCounterValue(matColor, "ResourceCounter")
local matColor = playermatApi.getMatColorByPosition(self.getPosition())
local resources = playermatApi.getCounterValue(matColor, "ResourceCounter")
local count = tostring(math.floor(resources / modValue))
self.editButton({ index = 0, label = count })
end

View File

@ -19,7 +19,7 @@
-- selectedUpgrades holds the state of checkboxes and text input, each element being:
-- 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
-- when not selected.
@ -230,7 +230,7 @@ function clickCheckbox(row, col)
selectedUpgrades[row].xp = col
end
updateCheckboxes(row)
playmatApi.syncAllCustomizableCards()
playermatApi.syncAllCustomizableCards()
end
-- Updates saved value for given text box when it loses focus

View File

@ -1,10 +1,10 @@
local guidReferenceApi = require("core/GUIDReferenceApi")
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
local searchLib = require("util/SearchLib")
exposedValue = 0
local playmat
local playermat
local searchParam = {}
function onLoad()
@ -19,14 +19,14 @@ function onLoad()
font_size = 2000
})
-- get closest playmat
local matColor = playmatApi.getMatColorByPosition(self.getPosition())
playmat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat")
-- get closest playermat
local matColor = playermatApi.getMatColorByPosition(self.getPosition())
playermat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat")
-- get search parameters (threat area excluded)
local localPos = playmat.positionToLocal(playmat.getPosition())
searchParam.pos = playmat.positionToWorld(localPos + Vector(0, 0, 0.4))
searchParam.rot = playmat.getRotation() + Vector(0, 90, 0)
local localPos = playermat.positionToLocal(playermat.getPosition())
searchParam.pos = playermat.positionToWorld(localPos + Vector(0, 0, 0.4))
searchParam.rot = playermat.getRotation() + Vector(0, 90, 0)
searchParam.size = Vector(8, 1, 27)
searchParam.filter = "isClue"
@ -34,7 +34,7 @@ function onLoad()
Wait.time(countItems, 1.5, -1)
end
-- activated once per second, counts clues on the playmat
-- activated once per second, counts clues on the playermat
function countItems()
local totalValue = 0
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
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
local buttonParameters = {
label = "Upkeep",
@ -169,7 +169,7 @@ function searchArea(origin, size, filter)
return searchLib.inArea(origin, self.getRotation(), size, filter)
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)
local scale = self.getScale()
local bounds = self.getBoundsNormalized()
@ -180,11 +180,11 @@ function searchAroundSelf(filter)
bounds.size.z = bounds.size.z + SEARCH_AROUND_SELF_Z_BUFFER
-- '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
-- 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)
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
@ -723,7 +723,7 @@ function changeColor(clickedByColor)
end
---------------------------------------------------------
-- playmat token spawning
-- playermat token spawning
---------------------------------------------------------
-- 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
obj.call("updateStats", { 1, 1, 1, 1 })
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
@ -1051,7 +1051,7 @@ function showDrawButton(visible)
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
function clickableClues(showCounter)
local clickerPos = ownedObjects.ClickableClueCounter.getPosition()

View File

@ -1,11 +1,11 @@
do
local PlaymatApi = {}
local PlayermatApi = {}
local guidReferenceApi = require("core/GUIDReferenceApi")
local searchLib = require("util/SearchLib")
-- 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
---@return table: Single-element if only single playmat is requested
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
---@return table: Single-element if only single playermat is requested
local function getMatForColor(matColor)
if matColor == "All" then
return guidReferenceApi.getObjectsByType("Playermat")
@ -14,9 +14,9 @@ do
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
PlaymatApi.getMatColorByPosition = function(startPos)
PlayermatApi.getMatColorByPosition = function(startPos)
local result, smallestDistance
for matColor, mat in pairs(getMatForColor("All")) do
local distance = Vector.between(startPos, mat.getPosition()):magnitude()
@ -28,17 +28,17 @@ do
return result
end
-- Returns the color of the player's hand that is seated next to the playmat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
PlaymatApi.getPlayerColor = function(matColor)
-- Returns the color of the player's hand that is seated next to the playermat
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlayermatApi.getPlayerColor = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.getVar("playerColor")
end
end
-- Returns the color of the playmat that owns the playercolor's hand
---@param handColor string Color of the playmat
PlaymatApi.getMatColor = function(handColor)
-- Returns the color of the playermat that owns the playercolor's hand
---@param handColor string Color of the playermat
PlayermatApi.getMatColor = function(handColor)
for matColor, mat in pairs(getMatForColor("All")) do
local playerColor = mat.getVar("playerColor")
if playerColor == handColor then
@ -47,35 +47,35 @@ do
end
end
-- Instructs a playmat to check for DES
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
PlaymatApi.checkForDES = function(matColor)
-- Instructs a playermat to check for DES
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlayermatApi.checkForDES = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
mat.call("checkForDES")
end
end
-- Returns if there is the card "Dream-Enhancing Serum" on the requested playmat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
---@return boolean: whether DES is present on the playmat
PlaymatApi.hasDES = function(matColor)
-- Returns if there is the card "Dream-Enhancing Serum" on the requested playermat
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
---@return boolean: whether DES is present on the playermat
PlayermatApi.hasDES = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.getVar("hasDES")
end
end
-- gets the slot data for the playmat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
PlaymatApi.getSlotData = function(matColor)
-- gets the slot data for the playermat
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlayermatApi.getSlotData = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.getTable("slotData")
end
end
-- sets the slot data for the playmat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
---@param newSlotData table New slot data for the playmat
PlaymatApi.loadSlotData = function(matColor, newSlotData)
-- sets the slot data for the playermat
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
---@param newSlotData table New slot data for the playermat
PlayermatApi.loadSlotData = function(matColor, newSlotData)
for _, mat in pairs(getMatForColor(matColor)) do
mat.setTable("slotData", newSlotData)
mat.call("redrawSlotSymbols")
@ -83,33 +83,33 @@ do
end
end
-- Performs a search of the deck area of the requested playmat and returns the result as table
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
PlaymatApi.getDeckAreaObjects = function(matColor)
-- Performs a search of the deck area of the requested playermat and returns the result as table
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlayermatApi.getDeckAreaObjects = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.call("getDeckAreaObjects")
end
end
-- 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")
PlaymatApi.flipTopCardFromDeck = function(matColor)
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlayermatApi.flipTopCardFromDeck = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.call("flipTopCardFromDeck")
end
end
-- Returns the position of the discard pile of the requested playmat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
PlaymatApi.getDiscardPosition = function(matColor)
-- Returns the position of the discard pile of the requested playermat
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlayermatApi.getDiscardPosition = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.call("returnGlobalDiscardPosition")
end
end
-- Returns the position of the draw pile of the requested playmat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
PlaymatApi.getDrawPosition = function(matColor)
-- Returns the position of the draw pile of the requested playermat
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlayermatApi.getDrawPosition = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.call("returnGlobalDrawPosition")
end
@ -117,25 +117,25 @@ do
-- Transforms a local position into a global position
---@param localPos table Local position to be transformed
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
PlaymatApi.transformLocalPosition = function(localPos, matColor)
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlayermatApi.transformLocalPosition = function(localPos, matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.positionToWorld(localPos)
end
end
-- Returns the rotation of the requested playmat
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
PlaymatApi.returnRotation = function(matColor)
-- Returns the rotation of the requested playermat
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlayermatApi.returnRotation = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.getRotation()
end
end
-- 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
PlaymatApi.getHelperSpawnData = function(matColor, helperName)
PlayermatApi.getHelperSpawnData = function(matColor, helperName)
local resultTable = {}
local localPositionTable = {
["Hand Helper"] = {0.05, 0, -1.182},
@ -152,90 +152,90 @@ do
end
-- Triggers the Upkeep for the requested playmat
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
-- Triggers the Upkeep for the requested playermat
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
---@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
mat.call("doUpkeepFromHotkey", playerColor)
end
end
-- Handles discarding for the requested playmat for the provided list of objects
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
-- Handles discarding for the requested playermat for the provided list of objects
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
---@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
mat.call("discardListOfObjects", objList)
end
end
-- Returns the active investigator id
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
PlaymatApi.returnInvestigatorId = function(matColor)
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlayermatApi.returnInvestigatorId = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.getVar("activeInvestigatorId")
end
end
-- Returns the class of the active investigator
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
PlaymatApi.returnInvestigatorClass = function(matColor)
---@param matColor string Color of the playermat - White, Orange, Green or Red (does not support "All")
PlayermatApi.returnInvestigatorClass = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.getVar("activeInvestigatorClass")
end
end
-- 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
PlaymatApi.getEncounterCardDrawPosition = function(matColor, stack)
PlayermatApi.getEncounterCardDrawPosition = function(matColor, stack)
for _, mat in pairs(getMatForColor(matColor)) do
return Vector(mat.call("getEncounterCardDrawPosition", stack))
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
-- investigator area point will only snap Investigators. 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 matColor string Color of the playmat - White, Orange, Green, Red or All
PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlayermatApi.setLimitSnapsByType = function(matchCardTypes, matColor)
for _, mat in pairs(getMatForColor(matColor)) do
mat.call("setLimitSnapsByType", matchCardTypes)
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 matColor string Color of the playmat - White, Orange, Green, Red or All
PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlayermatApi.showDrawButton = function(isDrawButtonVisible, matColor)
for _, mat in pairs(getMatForColor(matColor)) do
mat.call("showDrawButton", isDrawButtonVisible)
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 matColor string Color of the playmat - White, Orange, Green, Red or All
PlaymatApi.clickableClues = function(showCounter, matColor)
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlayermatApi.clickableClues = function(showCounter, matColor)
for _, mat in pairs(getMatForColor(matColor)) do
mat.call("clickableClues", showCounter)
end
end
-- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
PlaymatApi.removeClues = function(matColor)
-- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlayermatApi.removeClues = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
mat.call("removeClues")
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
PlaymatApi.getClueCount = function(useClickableCounters, matColor)
PlayermatApi.getClueCount = function(useClickableCounters, matColor)
local count = 0
for _, mat in pairs(getMatForColor(matColor)) do
count = count + mat.call("getClueCount", useClickableCounters)
@ -244,36 +244,36 @@ do
end
-- 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 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
PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)
PlayermatApi.updateCounter = function(matColor, type, newValue, modifier)
for _, mat in pairs(getMatForColor(matColor)) do
mat.call("updateCounter", { type = type, newValue = newValue, modifier = modifier })
end
end
-- Triggers the draw function for the specified playmat
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
-- Triggers the draw function for the specified playermat
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
---@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
mat.call("drawCardsWithReshuffle", number)
end
end
-- 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
PlaymatApi.getCounterValue = function(matColor, type)
PlayermatApi.getCounterValue = function(matColor, type)
for _, mat in pairs(getMatForColor(matColor)) do
return mat.call("getCounterValue", type)
end
end
-- 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 usedColors = {}
for matColor, mat in pairs(getMatForColor("All")) do
@ -287,25 +287,25 @@ do
end
-- Resets the specified skill tracker to "1, 1, 1, 1"
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
PlaymatApi.resetSkillTracker = function(matColor)
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlayermatApi.resetSkillTracker = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
mat.call("resetSkillTracker")
end
end
-- 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
PlaymatApi.redrawSlotSymbols = function(matColor)
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlayermatApi.redrawSlotSymbols = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
mat.call("redrawSlotSymbols")
end
end
-- Finds all objects on the playmat and associated set aside zone and returns a table
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
-- Finds all objects on the playermat and associated set aside zone and returns a table
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
---@param filter string Name of the filte function (see util/SearchLib)
PlaymatApi.searchAroundPlaymat = function(matColor, filter)
PlayermatApi.searchAroundPlayermat = function(matColor, filter)
local objList = {}
for _, mat in pairs(getMatForColor(matColor)) do
for _, obj in ipairs(mat.call("searchAroundSelf", filter)) do
@ -316,19 +316,19 @@ do
end
-- Discard a non-hidden card from the corresponding player's hand
---@param matColor string Color of the playmat - White, Orange, Green, Red or All
PlaymatApi.doDiscardOne = function(matColor)
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
PlayermatApi.doDiscardOne = function(matColor)
for _, mat in pairs(getMatForColor(matColor)) do
mat.call("doDiscardOne")
end
end
-- Triggers the metadata sync for all playmats
PlaymatApi.syncAllCustomizableCards = function()
-- Triggers the metadata sync for all playermats
PlayermatApi.syncAllCustomizableCards = function()
for _, mat in pairs(getMatForColor("All")) do
mat.call("syncAllCustomizableCards")
end
end
return PlaymatApi
return PlayermatApi
end

View File

@ -20,7 +20,7 @@
-- SetAside5: Hunch Deck for Joe Diamond
-- SetAside6: currently unused
do
local playmatApi = require("playermat/PlaymatApi")
local playermatApi = require("playermat/PlayermatApi")
local Zones = { }
local commonZones = {}
@ -126,7 +126,7 @@ do
and playerColor ~= "Green") then
return nil
end
return playmatApi.transformLocalPosition(zoneData[playerColor][zoneName], playerColor)
return playermatApi.transformLocalPosition(zoneData[playerColor][zoneName], playerColor)
end
-- 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
-- Z rotation to place the card face up or face down.
Zones.getDefaultCardRotation = function(playerColor, zoneName)
local cardRotation = playmatApi.returnRotation(playerColor)
local cardRotation = playermatApi.returnRotation(playerColor)
if zoneName == "Deck" then
cardRotation = cardRotation + Vector(0, 0, 180)
end

View File

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