made object reference dynamic
This commit is contained in:
parent
550c958275
commit
889f0af13f
@ -83,10 +83,6 @@
|
||||
{
|
||||
"displayed": "CameraZoom_ignore",
|
||||
"normalized": "camerazoom_ignore"
|
||||
},
|
||||
{
|
||||
"displayed": "TokenArranger",
|
||||
"normalized": "tokenarranger"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
"LuaScript": "require(\"chaosbag/BlessCurseManager\")",
|
||||
"LuaScriptState": "false",
|
||||
"MeasureMovement": false,
|
||||
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"BlessCurseManager\"}",
|
||||
"Name": "Custom_Token",
|
||||
"Nickname": "Bless/Curse Manager",
|
||||
"Snap": true,
|
||||
|
@ -62,6 +62,7 @@
|
||||
"LuaScript": "require(\"core/MythosArea\")",
|
||||
"LuaScriptState": "{\"currentScenario\":\"\",\"tokenData\":[],\"useFrontData\":true}",
|
||||
"MeasureMovement": false,
|
||||
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"MythosArea\"}",
|
||||
"Name": "Custom_Tile",
|
||||
"Nickname": "Mythos Area",
|
||||
"Snap": true,
|
||||
|
@ -973,6 +973,7 @@
|
||||
"LuaScript": "require(\"core/PlayArea\")",
|
||||
"LuaScriptState": "{\"trackedLocations\":[]}",
|
||||
"MeasureMovement": false,
|
||||
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"PlayArea\"}",
|
||||
"Name": "Custom_Token",
|
||||
"Nickname": "Playarea",
|
||||
"Snap": true,
|
||||
|
@ -343,8 +343,8 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "require(\"playermat/Playmat\")",
|
||||
"LuaScriptState_path": "Playermat1White.8b081b.luascriptstate",
|
||||
"LuaScript_path": "Playermat1White.8b081b.ttslua",
|
||||
"MeasureMovement": false,
|
||||
"Memo": "{\"matColor\":\"White\",\"type\":\"Playermat\"}",
|
||||
"Name": "Custom_Tile",
|
||||
|
@ -1,11 +0,0 @@
|
||||
---------------------------------------------------------
|
||||
-- specific setup (different for each playmat)
|
||||
---------------------------------------------------------
|
||||
|
||||
TRASHCAN_GUID = "147e80"
|
||||
STAT_TRACKER_GUID = "e598c2"
|
||||
RESOURCE_COUNTER_GUID = "4406f0"
|
||||
CLUE_COUNTER_GUID = "d86b7c"
|
||||
CLUE_CLICKER_GUID = "db85d6"
|
||||
|
||||
require("playermat/Playmat")
|
@ -343,8 +343,8 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "require(\"playermat/Playmat\")",
|
||||
"LuaScriptState_path": "Playermat2Orange.bd0ff4.luascriptstate",
|
||||
"LuaScript_path": "Playermat2Orange.bd0ff4.ttslua",
|
||||
"MeasureMovement": false,
|
||||
"Memo": "{\"matColor\":\"Orange\",\"type\":\"Playermat\"}",
|
||||
"Name": "Custom_Tile",
|
||||
|
@ -1,11 +0,0 @@
|
||||
---------------------------------------------------------
|
||||
-- specific setup (different for each playmat)
|
||||
---------------------------------------------------------
|
||||
|
||||
TRASHCAN_GUID = "f7b6c8"
|
||||
STAT_TRACKER_GUID = "b4a5f7"
|
||||
RESOURCE_COUNTER_GUID = "816d84"
|
||||
CLUE_COUNTER_GUID = "1769ed"
|
||||
CLUE_CLICKER_GUID = "3f22e5"
|
||||
|
||||
require("playermat/Playmat")
|
@ -343,8 +343,8 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "require(\"playermat/Playmat\")",
|
||||
"LuaScriptState_path": "Playermat3Green.383d8b.luascriptstate",
|
||||
"LuaScript_path": "Playermat3Green.383d8b.ttslua",
|
||||
"MeasureMovement": false,
|
||||
"Memo": "{\"matColor\":\"Green\",\"type\":\"Playermat\"}",
|
||||
"Name": "Custom_Tile",
|
||||
|
@ -1,11 +0,0 @@
|
||||
---------------------------------------------------------
|
||||
-- specific setup (different for each playmat)
|
||||
---------------------------------------------------------
|
||||
|
||||
TRASHCAN_GUID = "5f896a"
|
||||
STAT_TRACKER_GUID = "af7ed7"
|
||||
RESOURCE_COUNTER_GUID = "cd15ac"
|
||||
CLUE_COUNTER_GUID = "032300"
|
||||
CLUE_CLICKER_GUID = "891403"
|
||||
|
||||
require("playermat/Playmat")
|
@ -343,8 +343,8 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "require(\"playermat/Playmat\")",
|
||||
"LuaScriptState_path": "Playermat4Red.0840d5.luascriptstate",
|
||||
"LuaScript_path": "Playermat4Red.0840d5.ttslua",
|
||||
"MeasureMovement": false,
|
||||
"Memo": "{\"matColor\":\"Red\",\"type\":\"Playermat\"}",
|
||||
"Name": "Custom_Tile",
|
||||
|
@ -1,11 +0,0 @@
|
||||
---------------------------------------------------------
|
||||
-- specific setup (different for each playmat)
|
||||
---------------------------------------------------------
|
||||
|
||||
TRASHCAN_GUID = "4b8594"
|
||||
STAT_TRACKER_GUID = "e74881"
|
||||
RESOURCE_COUNTER_GUID = "a4b60d"
|
||||
CLUE_COUNTER_GUID = "37be78"
|
||||
CLUE_CLICKER_GUID = "4111de"
|
||||
|
||||
require("playermat/Playmat")
|
@ -36,13 +36,11 @@
|
||||
"LuaScript": "require(\"accessories/TokenArranger\")",
|
||||
"LuaScriptState_path": "TokenArranger.022907.luascriptstate",
|
||||
"MeasureMovement": false,
|
||||
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"TokenArranger\"}",
|
||||
"Name": "Custom_Token",
|
||||
"Nickname": "Token Arranger",
|
||||
"Snap": true,
|
||||
"Sticky": true,
|
||||
"Tags": [
|
||||
"TokenArranger"
|
||||
],
|
||||
"Tooltip": true,
|
||||
"Transform": {
|
||||
"posX": -42.3,
|
||||
|
@ -158,6 +158,7 @@
|
||||
"LuaScript": "require(\"core/VictoryDisplay\")",
|
||||
"LuaScriptState": "",
|
||||
"MeasureMovement": false,
|
||||
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"VictoryDisplay\"}",
|
||||
"Name": "Custom_Token",
|
||||
"Nickname": "Victory Display",
|
||||
"Snap": false,
|
||||
|
@ -1,11 +1,32 @@
|
||||
do
|
||||
local TokenArrangerApi = {}
|
||||
|
||||
-- gets the first object that matches the provided information
|
||||
---@param matColor String Color of the playermat
|
||||
---@param type String Object to look for (usually name without spaces)
|
||||
local function getObjectFromMemo(matColor, type)
|
||||
if matColor == nil or type == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
for _, obj in ipairs(getObjects()) do
|
||||
local memo = obj.getMemo()
|
||||
if memo then
|
||||
local decoded = JSON.decode(memo) or {}
|
||||
if decoded.matColor == matColor and decoded.type == type then
|
||||
return obj
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
-- local function to call the token arranger, if it is on the table
|
||||
---@param functionName String Name of the function to cal
|
||||
---@param argument Variant Parameter to pass
|
||||
local function callIfExistent(functionName, argument)
|
||||
local tokenArranger = getObjectsWithTag("TokenArranger")[1]
|
||||
local tokenArranger = getObjectFromMemo("Mythos", "TokenArranger")
|
||||
if tokenArranger ~= nil then
|
||||
tokenArranger.call(functionName, argument)
|
||||
end
|
||||
|
@ -1,10 +1,30 @@
|
||||
do
|
||||
local BlessCurseManagerApi = {}
|
||||
local MANAGER_GUID = "5933fb"
|
||||
|
||||
-- gets the first object that matches the provided information
|
||||
---@param matColor String Color of the playermat
|
||||
---@param type String Object to look for (usually name without spaces)
|
||||
local function getObjectFromMemo(matColor, type)
|
||||
if matColor == nil or type == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
for _, obj in ipairs(getObjects()) do
|
||||
local memo = obj.getMemo()
|
||||
if memo then
|
||||
local decoded = JSON.decode(memo) or {}
|
||||
if decoded.matColor == matColor and decoded.type == type then
|
||||
return obj
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
-- removes all taken tokens and resets the counts
|
||||
BlessCurseManagerApi.removeTakenTokensAndReset = function()
|
||||
local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)
|
||||
local BlessCurseManager = getObjectFromMemo("Mythos", "BlessCurseManager")
|
||||
Wait.time(function() BlessCurseManager.call("removeTakenTokens", "Bless") end, 0.05)
|
||||
Wait.time(function() BlessCurseManager.call("removeTakenTokens", "Curse") end, 0.10)
|
||||
Wait.time(function() BlessCurseManager.call("doReset", "White") end, 0.15)
|
||||
@ -12,30 +32,30 @@ do
|
||||
|
||||
-- updates the internal count (called by cards that seal bless/curse tokens)
|
||||
BlessCurseManagerApi.sealedToken = function(type, guid)
|
||||
getObjectFromGUID(MANAGER_GUID).call("sealedToken", { type = type, guid = guid })
|
||||
getObjectFromMemo("Mythos", "BlessCurseManager").call("sealedToken", { type = type, guid = guid })
|
||||
end
|
||||
|
||||
-- updates the internal count (called by cards that seal bless/curse tokens)
|
||||
BlessCurseManagerApi.releasedToken = function(type, guid)
|
||||
getObjectFromGUID(MANAGER_GUID).call("releasedToken", { type = type, guid = guid })
|
||||
getObjectFromMemo("Mythos", "BlessCurseManager").call("releasedToken", { type = type, guid = guid })
|
||||
end
|
||||
|
||||
-- broadcasts the current status for bless/curse tokens
|
||||
---@param playerColor String Color of the player to show the broadcast to
|
||||
BlessCurseManagerApi.broadcastStatus = function(playerColor)
|
||||
getObjectFromGUID(MANAGER_GUID).call("broadcastStatus", playerColor)
|
||||
getObjectFromMemo("Mythos", "BlessCurseManager").call("broadcastStatus", playerColor)
|
||||
end
|
||||
|
||||
-- removes all bless / curse tokens from the chaos bag and play
|
||||
---@param playerColor String Color of the player to show the broadcast to
|
||||
BlessCurseManagerApi.removeAll = function(playerColor)
|
||||
getObjectFromGUID(MANAGER_GUID).call("doRemove", playerColor)
|
||||
getObjectFromMemo("Mythos", "BlessCurseManager").call("doRemove", playerColor)
|
||||
end
|
||||
|
||||
-- adds Wendy's menu to the hovered card (allows sealing of tokens)
|
||||
---@param color String Color of the player to show the broadcast to
|
||||
BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)
|
||||
getObjectFromGUID(MANAGER_GUID).call("addMenuOptions", { playerColor = playerColor, hoveredObject = hoveredObject })
|
||||
getObjectFromMemo("Mythos", "BlessCurseManager").call("addMenuOptions", { playerColor = playerColor, hoveredObject = hoveredObject })
|
||||
end
|
||||
|
||||
return BlessCurseManagerApi
|
||||
|
@ -61,7 +61,7 @@ local ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38}
|
||||
-- global variable so it can be reset by the Clean Up Helper
|
||||
activeInvestigatorId = "00000"
|
||||
|
||||
local TRASHCAN, STAT_TRACKER, RESOURCE_COUNTER
|
||||
local MATCOLOR, TRASHCAN, STAT_TRACKER, RESOURCE_COUNTER
|
||||
local isDrawButtonVisible = false
|
||||
|
||||
-- global variable to report "Dream-Enhancing Serum" status
|
||||
@ -79,9 +79,12 @@ end
|
||||
function onLoad(save_state)
|
||||
self.interactable = DEBUG
|
||||
|
||||
TRASHCAN = getObjectFromGUID(TRASHCAN_GUID)
|
||||
STAT_TRACKER = getObjectFromGUID(STAT_TRACKER_GUID)
|
||||
RESOURCE_COUNTER = getObjectFromGUID(RESOURCE_COUNTER_GUID)
|
||||
-- set MATCOLOR based on memo
|
||||
MATCOLOR = JSON.decode(self.getMemo()).matColor
|
||||
|
||||
TRASHCAN = getObjectFromMemo(MATCOLOR, "Trash")
|
||||
STAT_TRACKER = getObjectFromMemo(MATCOLOR, "InvestigatorSkillTracker")
|
||||
RESOURCE_COUNTER = getObjectFromMemo(MATCOLOR, "ResourceCounter")
|
||||
|
||||
-- button creation
|
||||
for i = 1, 6 do
|
||||
@ -209,6 +212,35 @@ function doNotReady(card)
|
||||
return card.getVar("do_not_ready") or false
|
||||
end
|
||||
|
||||
-- rounds a number to the specified amount of decimal places
|
||||
---@param num Number Initial value
|
||||
---@param numDecimalPlaces Number Amount of decimal places
|
||||
function round(num, numDecimalPlaces)
|
||||
local mult = 10^(numDecimalPlaces or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
||||
-- gets the first object that matches the provided information
|
||||
---@param matColor String Color of the playermat
|
||||
---@param type String Object to look for (usually name without spaces)
|
||||
function getObjectFromMemo(matColor, type)
|
||||
if matColor == nil or type == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
for _, obj in ipairs(getObjects()) do
|
||||
local memo = obj.getMemo()
|
||||
if memo then
|
||||
local decoded = JSON.decode(memo) or {}
|
||||
if decoded.matColor == matColor and decoded.type == type then
|
||||
return obj
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------
|
||||
-- Discard buttons
|
||||
---------------------------------------------------------
|
||||
@ -570,32 +602,8 @@ function changeColor(clickedByColor)
|
||||
|
||||
-- show the option dialog for color selection to the player that triggered this
|
||||
Player[clickedByColor].showOptionsDialog("Select a new color:", colorList, _, function(color)
|
||||
local HAND_ZONE_GUIDS = {
|
||||
"a70eee", -- White
|
||||
"5fe087", -- Orange
|
||||
"0285cc", -- Green
|
||||
"be2f17" -- Red
|
||||
}
|
||||
local index
|
||||
local startPos = self.getPosition()
|
||||
|
||||
-- get respective hand zone by position
|
||||
if startPos.x < -42 then
|
||||
if startPos.z > 0 then
|
||||
index = 1
|
||||
else
|
||||
index = 2
|
||||
end
|
||||
else
|
||||
if startPos.z > 0 then
|
||||
index = 3
|
||||
else
|
||||
index = 4
|
||||
end
|
||||
end
|
||||
|
||||
-- update the color of the hand zone
|
||||
local handZone = getObjectFromGUID(HAND_ZONE_GUIDS[index])
|
||||
local handZone = getObjectFromMemo(MATCOLOR, "HandZone")
|
||||
handZone.setValue(color)
|
||||
|
||||
-- if the seated player clicked this, reseat him to the new color
|
||||
@ -880,8 +888,8 @@ end
|
||||
-- Spawns / destroys a clickable clue counter for this playmat with the correct amount of clues
|
||||
---@param showCounter Boolean Whether the clickable clue counter should be present
|
||||
function clickableClues(showCounter)
|
||||
local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)
|
||||
local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)
|
||||
local CLUE_COUNTER = getObjectFromMemo(MATCOLOR, "ClueCounter")
|
||||
local CLUE_CLICKER = getObjectFromMemo(MATCOLOR, "ClickableClueCounter")
|
||||
local clickerPos = CLUE_CLICKER.getPosition()
|
||||
local clueCount = 0
|
||||
|
||||
@ -917,8 +925,8 @@ end
|
||||
|
||||
-- removes all clues (moving tokens to the trash and setting counters to 0)
|
||||
function removeClues()
|
||||
local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)
|
||||
local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)
|
||||
local CLUE_COUNTER = getObjectFromMemo(MATCOLOR, "ClueCounter")
|
||||
local CLUE_CLICKER = getObjectFromMemo(MATCOLOR, "ClickableClueCounter")
|
||||
|
||||
CLUE_COUNTER.call("removeAllClues")
|
||||
CLUE_CLICKER.call("updateVal", 0)
|
||||
@ -930,10 +938,10 @@ function getClueCount(useClickableCounters)
|
||||
local count = 0
|
||||
|
||||
if useClickableCounters then
|
||||
local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)
|
||||
local CLUE_CLICKER = getObjectFromMemo(MATCOLOR, "ClickableClueCounter")
|
||||
count = tonumber(CLUE_CLICKER.getVar("val"))
|
||||
else
|
||||
local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)
|
||||
local CLUE_COUNTER = getObjectFromMemo(MATCOLOR, "ClueCounter")
|
||||
count = tonumber(CLUE_COUNTER.getVar("exposedValue"))
|
||||
end
|
||||
return count
|
||||
@ -995,11 +1003,3 @@ function updatePlayerCards(args)
|
||||
local playerCardData = customDataHelper.getTable("PLAYER_CARD_DATA")
|
||||
tokenManager.addPlayerCardData(playerCardData)
|
||||
end
|
||||
|
||||
-- utility function for rounding
|
||||
---@param num Number Initial value
|
||||
---@param numDecimalPlaces Number Amount of decimal places
|
||||
function round(num, numDecimalPlaces)
|
||||
local mult = 10^(numDecimalPlaces or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
@ -2,26 +2,26 @@ do
|
||||
local PlaymatApi = { }
|
||||
local internal = { }
|
||||
|
||||
local MAT_IDS = {
|
||||
White = "8b081b",
|
||||
Orange = "bd0ff4",
|
||||
Green = "383d8b",
|
||||
Red = "0840d5"
|
||||
}
|
||||
-- gets the first object that matches the provided information
|
||||
---@param matColor String Color of the playermat
|
||||
---@param type String Object to look for (usually name without spaces)
|
||||
internal.getObjectFromMemo = function(matColor, type)
|
||||
if matColor == nil or type == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
local CLUE_COUNTER_GUIDS = {
|
||||
White = "37be78",
|
||||
Orange = "1769ed",
|
||||
Green = "032300",
|
||||
Red = "d86b7c"
|
||||
}
|
||||
for _, obj in ipairs(getObjects()) do
|
||||
local memo = obj.getMemo()
|
||||
if memo then
|
||||
local decoded = JSON.decode(memo) or {}
|
||||
if decoded.matColor == matColor and decoded.type == type then
|
||||
return obj
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local CLUE_CLICKER_GUIDS = {
|
||||
White = "db85d6",
|
||||
Orange = "3f22e5",
|
||||
Green = "891403",
|
||||
Red = "4111de"
|
||||
}
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Returns the color of the by position requested playermat as string
|
||||
---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat
|
||||
@ -44,7 +44,7 @@ do
|
||||
-- Returns the color of the player's hand that is seated next to the playermat
|
||||
---@param matColor String Color of the playermat
|
||||
PlaymatApi.getPlayerColor = function(matColor)
|
||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
return mat.getVar("playerColor")
|
||||
end
|
||||
|
||||
@ -62,21 +62,21 @@ do
|
||||
-- Returns the result of a cast in the specificed playermat's area
|
||||
---@param matColor String Color of the playermat
|
||||
PlaymatApi.searchPlaymat = function(matColor)
|
||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
return mat.call("searchAroundSelf")
|
||||
end
|
||||
|
||||
-- Returns if there is the card "Dream-Enhancing Serum" on the requested playermat
|
||||
---@param matColor String Color of the playermat
|
||||
PlaymatApi.isDES = function(matColor)
|
||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
return mat.getVar("isDES")
|
||||
end
|
||||
|
||||
-- Returns the draw deck of the requested playmat
|
||||
---@param matColor String Color of the playermat
|
||||
PlaymatApi.getDrawDeck = function(matColor)
|
||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
mat.call("getDrawDiscardDecks")
|
||||
return mat.getVar("drawDeck")
|
||||
end
|
||||
@ -84,7 +84,7 @@ do
|
||||
-- Returns the position of the discard pile of the requested playmat
|
||||
---@param matColor String Color of the playermat
|
||||
PlaymatApi.getDiscardPosition = function(matColor)
|
||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
return mat.call("returnGlobalDiscardPosition")
|
||||
end
|
||||
|
||||
@ -92,14 +92,14 @@ do
|
||||
---@param localPos Table Local position to be transformed
|
||||
---@param matColor String Color of the playermat
|
||||
PlaymatApi.transformLocalPosition = function(localPos, matColor)
|
||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
return mat.positionToWorld(localPos)
|
||||
end
|
||||
|
||||
-- Returns the rotation of the requested playmat
|
||||
---@param matColor String Color of the playermat
|
||||
PlaymatApi.returnRotation = function(matColor)
|
||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
return mat.getRotation()
|
||||
end
|
||||
|
||||
@ -107,14 +107,14 @@ do
|
||||
---@param matColor String Color of the playermat
|
||||
---@param playerColor String Color of the calling player (for messages)
|
||||
PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)
|
||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
return mat.call("doUpkeepFromHotkey", playerColor)
|
||||
end
|
||||
|
||||
-- Returns the active investigator id
|
||||
---@param matColor String Color of the playermat
|
||||
PlaymatApi.returnInvestigatorId = function(matColor)
|
||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
return mat.getVar("activeInvestigatorId")
|
||||
end
|
||||
|
||||
@ -180,7 +180,7 @@ do
|
||||
|
||||
-- Returns the resource counter amount for the requested playermat
|
||||
PlaymatApi.getResourceCount = function(matColor)
|
||||
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
return mat.call("getResourceCount")
|
||||
end
|
||||
|
||||
@ -197,8 +197,8 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
PlaymatApi.updateClueClicker = function(playerColor, val)
|
||||
return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call("updateVal", val)
|
||||
PlaymatApi.updateClueClicker = function(matColor, val)
|
||||
return internal.getObjectFromMemo(matColor, "ClickableClueCounter").call("updateVal", val)
|
||||
end
|
||||
|
||||
-- Convenience function to look up a mat's object by color, or get all mats.
|
||||
@ -207,16 +207,16 @@ do
|
||||
---@return: Array of playermat objects. If a single mat is requested, will return a single-element
|
||||
-- array to simplify processing by consumers.
|
||||
internal.getMatForColor = function(matColor)
|
||||
local targetMatGuid = MAT_IDS[matColor]
|
||||
if targetMatGuid != nil then
|
||||
return { getObjectFromGUID(targetMatGuid) }
|
||||
local targetMat = internal.getObjectFromMemo(matColor, "Playermat")
|
||||
if targetMat != nil then
|
||||
return { targetMatGuid }
|
||||
end
|
||||
if matColor == "All" then
|
||||
return {
|
||||
getObjectFromGUID(MAT_IDS.White),
|
||||
getObjectFromGUID(MAT_IDS.Orange),
|
||||
getObjectFromGUID(MAT_IDS.Green),
|
||||
getObjectFromGUID(MAT_IDS.Red),
|
||||
internal.getObjectFromMemo("White", "Playermat"),
|
||||
internal.getObjectFromMemo("Orange", "Playermat"),
|
||||
internal.getObjectFromMemo("Green", "Playermat"),
|
||||
internal.getObjectFromMemo("Red", "Playermat"),
|
||||
}
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user