diff --git a/modsettings/ComponentTags.json b/modsettings/ComponentTags.json index 8d28dfae..83a638b1 100644 --- a/modsettings/ComponentTags.json +++ b/modsettings/ComponentTags.json @@ -83,10 +83,6 @@ { "displayed": "CameraZoom_ignore", "normalized": "camerazoom_ignore" - }, - { - "displayed": "TokenArranger", - "normalized": "tokenarranger" } ] } diff --git a/objects/BlessCurseManager.5933fb.json b/objects/BlessCurseManager.5933fb.json index ae7809ce..c7325804 100644 --- a/objects/BlessCurseManager.5933fb.json +++ b/objects/BlessCurseManager.5933fb.json @@ -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, diff --git a/objects/MythosArea.9f334f.json b/objects/MythosArea.9f334f.json index 83ba39e6..734c5d92 100644 --- a/objects/MythosArea.9f334f.json +++ b/objects/MythosArea.9f334f.json @@ -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, diff --git a/objects/Playarea.721ba2.json b/objects/Playarea.721ba2.json index 0bbd9af2..74caeab4 100644 --- a/objects/Playarea.721ba2.json +++ b/objects/Playarea.721ba2.json @@ -973,6 +973,7 @@ "LuaScript": "require(\"core/PlayArea\")", "LuaScriptState": "{\"trackedLocations\":[]}", "MeasureMovement": false, + "Memo": "{\"matColor\":\"Mythos\",\"type\":\"PlayArea\"}", "Name": "Custom_Token", "Nickname": "Playarea", "Snap": true, diff --git a/objects/Playermat1White.8b081b.json b/objects/Playermat1White.8b081b.json index 4fc6db15..ce714318 100644 --- a/objects/Playermat1White.8b081b.json +++ b/objects/Playermat1White.8b081b.json @@ -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", diff --git a/objects/Playermat1White.8b081b.ttslua b/objects/Playermat1White.8b081b.ttslua deleted file mode 100644 index 6d2d842f..00000000 --- a/objects/Playermat1White.8b081b.ttslua +++ /dev/null @@ -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") diff --git a/objects/Playermat2Orange.bd0ff4.json b/objects/Playermat2Orange.bd0ff4.json index 1b90fc2d..d0bc1be6 100644 --- a/objects/Playermat2Orange.bd0ff4.json +++ b/objects/Playermat2Orange.bd0ff4.json @@ -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", diff --git a/objects/Playermat2Orange.bd0ff4.ttslua b/objects/Playermat2Orange.bd0ff4.ttslua deleted file mode 100644 index 4530453c..00000000 --- a/objects/Playermat2Orange.bd0ff4.ttslua +++ /dev/null @@ -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") diff --git a/objects/Playermat3Green.383d8b.json b/objects/Playermat3Green.383d8b.json index b5a1f585..4f9a6292 100644 --- a/objects/Playermat3Green.383d8b.json +++ b/objects/Playermat3Green.383d8b.json @@ -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", diff --git a/objects/Playermat3Green.383d8b.ttslua b/objects/Playermat3Green.383d8b.ttslua deleted file mode 100644 index 818bd09f..00000000 --- a/objects/Playermat3Green.383d8b.ttslua +++ /dev/null @@ -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") diff --git a/objects/Playermat4Red.0840d5.json b/objects/Playermat4Red.0840d5.json index 0d694a1a..b02587ef 100644 --- a/objects/Playermat4Red.0840d5.json +++ b/objects/Playermat4Red.0840d5.json @@ -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", diff --git a/objects/Playermat4Red.0840d5.ttslua b/objects/Playermat4Red.0840d5.ttslua deleted file mode 100644 index 6c0fb70f..00000000 --- a/objects/Playermat4Red.0840d5.ttslua +++ /dev/null @@ -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") diff --git a/objects/TokenArranger.022907.json b/objects/TokenArranger.022907.json index ec5c2a4a..4fb6d2fc 100644 --- a/objects/TokenArranger.022907.json +++ b/objects/TokenArranger.022907.json @@ -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, diff --git a/objects/VictoryDisplay.6ccd6d.json b/objects/VictoryDisplay.6ccd6d.json index 622ccfd8..7834f0a9 100644 --- a/objects/VictoryDisplay.6ccd6d.json +++ b/objects/VictoryDisplay.6ccd6d.json @@ -158,6 +158,7 @@ "LuaScript": "require(\"core/VictoryDisplay\")", "LuaScriptState": "", "MeasureMovement": false, + "Memo": "{\"matColor\":\"Mythos\",\"type\":\"VictoryDisplay\"}", "Name": "Custom_Token", "Nickname": "Victory Display", "Snap": false, diff --git a/src/accessories/TokenArrangerApi.ttslua b/src/accessories/TokenArrangerApi.ttslua index 47afb77f..4538431d 100644 --- a/src/accessories/TokenArrangerApi.ttslua +++ b/src/accessories/TokenArrangerApi.ttslua @@ -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 diff --git a/src/chaosbag/BlessCurseManagerApi.ttslua b/src/chaosbag/BlessCurseManagerApi.ttslua index 694e98b2..87dfb60b 100644 --- a/src/chaosbag/BlessCurseManagerApi.ttslua +++ b/src/chaosbag/BlessCurseManagerApi.ttslua @@ -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 diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index 91b1b94c..a36c554a 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -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 diff --git a/src/playermat/PlaymatApi.ttslua b/src/playermat/PlaymatApi.ttslua index 9df18be2..2f20b299 100644 --- a/src/playermat/PlaymatApi.ttslua +++ b/src/playermat/PlaymatApi.ttslua @@ -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