added guid reference handler

This commit is contained in:
Chr1Z93 2023-10-02 13:51:10 +02:00
parent de61831956
commit ce01733ef3
86 changed files with 292 additions and 186 deletions

View File

@ -19,6 +19,7 @@
"MusicPlayer_path": "MusicPlayer.json",
"Note": "",
"ObjectStates_order": [
"GUIDReferenceHandler.da23e4",
"HandTrigger.5fe087",
"HandTrigger.be2f17",
"HandTrigger.0285cc",

View File

@ -1575,7 +1575,6 @@
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"AllCardsBag\"}",
"MeshIndex": -1,
"Name": "Bag",
"Nickname": "All Player Cards",

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"arkhamdb/DeckImporterMain\")",
"LuaScriptState_path": "ArkhamDBDeckImporter.a28140.luascriptstate",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"DeckImporter\"}",
"Name": "Custom_Tile",
"Nickname": "ArkhamDB Deck Importer",
"Snap": false,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"chaosbag/BlessCurseManager\")",
"LuaScriptState": "false",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"BlessCurseManager\"}",
"Name": "Custom_Token",
"Nickname": "Bless/Curse Manager",
"Snap": true,

View File

@ -45,7 +45,6 @@
"LuaScript": "require(\"playermat/ClueCounter\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"ClueCounter\"}",
"Name": "Custom_Model",
"Nickname": "Clue Counter",
"Snap": true,

View File

@ -45,7 +45,6 @@
"LuaScript": "require(\"playermat/ClueCounter\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"ClueCounter\"}",
"Name": "Custom_Model",
"Nickname": "Clue Counter",
"Snap": true,

View File

@ -45,7 +45,6 @@
"LuaScript": "require(\"playermat/ClueCounter\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"ClueCounter\"}",
"Name": "Custom_Model",
"Nickname": "Clue Counter",
"Snap": true,

View File

@ -45,7 +45,6 @@
"LuaScript": "require(\"playermat/ClueCounter\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"ClueCounter\"}",
"Name": "Custom_Model",
"Nickname": "Clue Counter",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"ClickableClueCounter\"}",
"Name": "Custom_Token",
"Nickname": "Clues",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"ClickableClueCounter\"}",
"Name": "Custom_Token",
"Nickname": "Clues",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"ClickableClueCounter\"}",
"Name": "Custom_Token",
"Nickname": "Clues",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"ClickableClueCounter\"}",
"Name": "Custom_Token",
"Nickname": "Clues",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"DamageCounter\"}",
"Name": "Custom_Token",
"Nickname": "Damage\n",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"DamageCounter\"}",
"Name": "Custom_Token",
"Nickname": "Damage\n",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"DamageCounter\"}",
"Name": "Custom_Token",
"Nickname": "Damage\n",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"DamageCounter\"}",
"Name": "Custom_Token",
"Nickname": "Damage\n",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/DataHelper\")",
"LuaScriptState": "[]",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"DataHelper\"}",
"Name": "Custom_Tile",
"Nickname": "Data Helper",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/DoomCounter\")",
"LuaScriptState": "[0,{\"Agenda\":true,\"Playarea\":true,\"Playermats\":true}]",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"DoomCounter\"}",
"Name": "Custom_Token",
"Nickname": "Doom Counter",
"Snap": true,

View File

@ -0,0 +1,48 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.116,
"g": 0.116,
"r": 0.716
},
"Description": "This object handles GUID references to objects.",
"DragSelectable": true,
"GMNotes": "",
"GUID": "da23e4",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"core/GUIDReferenceHandler\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "go_game_piece_white",
"Nickname": "GUID Reference Handler",
"Snap": true,
"Sticky": true,
"Tags": [
"GUIDs"
],
"Tooltip": true,
"Transform": {
"posX": 78,
"posY": 1.328,
"posZ": -8,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"scaleX": 1,
"scaleY": 1,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
}

View File

@ -26,7 +26,6 @@
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"HandZone\"}",
"Name": "HandTrigger",
"Nickname": "",
"Snap": true,

View File

@ -26,7 +26,6 @@
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"HandZone\"}",
"Name": "HandTrigger",
"Nickname": "",
"Snap": true,

View File

@ -26,7 +26,6 @@
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"HandZone\"}",
"Name": "HandTrigger",
"Nickname": "",
"Snap": true,

View File

@ -26,7 +26,6 @@
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"HandZone\"}",
"Name": "HandTrigger",
"Nickname": "",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"HorrorCounter\"}",
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"HorrorCounter\"}",
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"HorrorCounter\"}",
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"HorrorCounter\"}",
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/ActiveInvestigatorCounter\")",
"LuaScriptState": "2",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"InvestigatorCounter\"}",
"Name": "Custom_Token",
"Nickname": "Investigator Count",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"InvestigatorSkillTracker\"}",
"Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"InvestigatorSkillTracker\"}",
"Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"InvestigatorSkillTracker\"}",
"Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"InvestigatorSkillTracker\"}",
"Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/MasterClueCounter\")",
"LuaScriptState": "false",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"MasterClueCounter\"}",
"Name": "Custom_Token",
"Nickname": "Master Clue Counter",
"Snap": true,

View File

@ -62,7 +62,6 @@
"LuaScript": "require(\"core/MythosArea\")",
"LuaScriptState": "{\"currentScenario\":\"\",\"tokenData\":[],\"useFrontData\":true}",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"MythosArea\"}",
"Name": "Custom_Tile",
"Nickname": "Mythos Area",
"Snap": true,

View File

@ -24,7 +24,6 @@
"LuaScript": "require(\"core/NavigationOverlayHandler\")",
"LuaScriptState_path": "NavigationOverlayHandler.797ede.luascriptstate",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"NavigationOverlayHandler\"}",
"Name": "go_game_piece_black",
"Nickname": "Navigation Overlay Handler",
"Snap": true,

View File

@ -38,7 +38,6 @@
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"OptionPanelSource\"}",
"MeshIndex": -1,
"Name": "Bag",
"Nickname": "OptionPanel Source",

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/DoomInPlayCounter\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"DoomInPlayCounter\"}",
"Name": "Custom_Token",
"Nickname": "Other Doom in Play",
"Snap": true,

View File

@ -973,7 +973,6 @@
"LuaScript": "require(\"core/PlayArea\")",
"LuaScriptState": "{\"trackedLocations\":[]}",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"PlayArea\"}",
"Name": "Custom_Token",
"Nickname": "Play Area",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"playercards/PlayerCardPanel\")",
"LuaScriptState": "{\"spawnBagState\":{\"placed\":[],\"placedObjects\":[]}}",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"PlayerCardPanel\"}",
"Name": "Custom_Tile",
"Nickname": "Player Cards",
"Snap": true,

View File

@ -346,7 +346,7 @@
"LuaScript": "require(\"playermat/Playmat\")",
"LuaScriptState_path": "Playermat1White.8b081b.luascriptstate",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"Playermat\"}",
"Memo": "White",
"Name": "Custom_Tile",
"Nickname": "Playermat 1: White",
"Snap": true,

View File

@ -346,7 +346,7 @@
"LuaScript": "require(\"playermat/Playmat\")",
"LuaScriptState_path": "Playermat2Orange.bd0ff4.luascriptstate",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"Playermat\"}",
"Memo": "Orange",
"Name": "Custom_Tile",
"Nickname": "Playermat 2: Orange",
"Snap": true,

View File

@ -346,7 +346,7 @@
"LuaScript": "require(\"playermat/Playmat\")",
"LuaScriptState_path": "Playermat3Green.383d8b.luascriptstate",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"Playermat\"}",
"Memo": "Green",
"Name": "Custom_Tile",
"Nickname": "Playermat 3: Green",
"Snap": true,

View File

@ -346,7 +346,7 @@
"LuaScript": "require(\"playermat/Playmat\")",
"LuaScriptState_path": "Playermat4Red.0840d5.luascriptstate",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"Playermat\"}",
"Memo": "Red",
"Name": "Custom_Tile",
"Nickname": "Playermat 4: Red",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "5",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"ResourceCounter\"}",
"Name": "Custom_Token",
"Nickname": "Resources",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "5",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"ResourceCounter\"}",
"Name": "Custom_Token",
"Nickname": "Resources",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "5",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"ResourceCounter\"}",
"Name": "Custom_Token",
"Nickname": "Resources",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "5",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"ResourceCounter\"}",
"Name": "Custom_Token",
"Nickname": "Resources",
"Snap": true,

View File

@ -39,7 +39,6 @@
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"ResourceTokenBag\"}",
"MeshIndex": -1,
"Name": "Custom_Model_Infinite_Bag",
"Nickname": "Resource tokens",

View File

@ -30,7 +30,6 @@
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"RulesReference\"}",
"Name": "Custom_PDF",
"Nickname": "Rules Reference",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"core/tour/TourStarter\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"TourStarter\"}",
"Name": "Custom_Token",
"Nickname": "SCED Tour",
"Snap": true,

View File

@ -25,7 +25,6 @@
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"PlayAreaZone\"}",
"Name": "ScriptingTrigger",
"Nickname": "",
"Snap": true,

View File

@ -31,7 +31,6 @@
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"SoundCube\"}",
"Name": "Custom_Assetbundle",
"Nickname": "SoundCube",
"Snap": true,

View File

@ -45,7 +45,6 @@
"LuaScript": "require(\"core/DownloadBox\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"CampaignThePathToCarcosa\"}",
"Name": "Custom_Model",
"Nickname": "The Path to Carcosa",
"Snap": true,

View File

@ -36,7 +36,6 @@
"LuaScript": "require(\"accessories/TokenArranger\")",
"LuaScriptState_path": "TokenArranger.022907.luascriptstate",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"TokenArranger\"}",
"Name": "Custom_Token",
"Nickname": "Token Arranger",
"Snap": true,

View File

@ -37,7 +37,6 @@
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"TokenSource\"}",
"MeshIndex": -1,
"Name": "Bag",
"Nickname": "Token Source",

View File

@ -24,7 +24,6 @@
"LuaScript": "require(\"core/token/TokenSpawnTracker\")",
"LuaScriptState": "{\"cards\":[]}",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"TokenSpawnTracker\"}",
"Name": "Checker_white",
"Nickname": "Token Spawn Tracker",
"Snap": true,

View File

@ -38,7 +38,6 @@
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"Trash\"}",
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Trash",

View File

@ -38,7 +38,6 @@
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"Trash\"}",
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Trash",

View File

@ -38,7 +38,6 @@
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"Trash\"}",
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Trash",

View File

@ -38,7 +38,6 @@
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"Trash\"}",
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Trash",

View File

@ -38,7 +38,6 @@
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"Trash\"}",
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Trash",

View File

@ -158,7 +158,6 @@
"LuaScript": "require(\"core/VictoryDisplay\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"VictoryDisplay\"}",
"Name": "Custom_Token",
"Nickname": "Victory Display",
"Snap": false,

View File

@ -5,6 +5,8 @@ local optionPanelApi = require("core/OptionPanelApi")
local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local guidHandler = getObjectsWithTag("GUIDs")[1]
local campaignTokenData = {
Name = "Custom_Model",
Transform = {
@ -163,7 +165,8 @@ function createCampaignFromToken(importData)
Wait.time(function() optionPanelApi.loadSettings(importData["options"]) end, 0.5)
-- destroy Tour Starter token
getObjectsWithTag("TourStarter")[1].destruct()
local tourStarter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "TourStarter" })
tourStarter.destruct()
-- restore PlayArea image
playAreaApi.updateSurface(importData["playmat"])

View File

@ -10,6 +10,8 @@ local playmatApi = require("playermat/PlaymatApi")
local soundCubeApi = require("core/SoundCubeApi")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
local guidHandler = getObjectsWithTag("GUIDs")[1]
-- objects with this tag will be ignored
local IGNORE_TAG = "CleanUpHelper_ignore"
@ -143,7 +145,7 @@ end
-- reset doom on agenda
function resetDoomCounter()
local doomCounter = getObjectsWithTag("DoomCounter")[1]
local doomCounter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DoomCounter" })
if doomCounter ~= nil then
doomCounter.call("updateVal")
else
@ -228,7 +230,7 @@ end
function discardHands()
if not options["tidyPlayermats"] then return end
for i = 1, 4 do
local trash = getObjectsWithAllTags({COLORS[i], "Trash"})
local trash = guidHandler.call("getObjectByOwnerAndType", { owner = COLORS[i], type = "Trash" })
if trash == nil then return end
local hand = Player[playmatApi.getPlayerColor(COLORS[i])].getHandObjects()
for j = #hand, 1, -1 do
@ -239,8 +241,8 @@ end
-- clean up for play area
function tidyPlayareaCoroutine()
local trash = getObjectsWithAllTags({"Mythos", "Trash"})
local playAreaZone = getObjectsWithTag("PlayAreaZone")[1]
local trash = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "Trash" })
local playAreaZone = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "PlayAreaZone" })
if playAreaZone == nil then
printToAll("Scripting zone for main play area could not be found!", "Red")
@ -270,7 +272,7 @@ function tidyPlayerMatCoroutine()
for k = 1, 30 do coroutine.yield(0) end
-- get respective trash
local trash = getObjectsWithAllTags({COLORS[i], "Trash"})
local trash = guidHandler.call("getObjectByOwnerAndType", { owner = COLORS[i], type = "Trash" })
if trash == nil then
printToAll("Trashcan for " .. COLORS[i] .. " playmat could not be found!", "Red")
return 1
@ -300,7 +302,7 @@ function tidyPlayerMatCoroutine()
-- reset "activeInvestigatorId"
if i < 5 then
local playermat = getObjectsWithAllTags({COLORS[i], "Playermat"})
local playermat = guidHandler.call("getObjectByOwnerAndType", { owner = COLORS[i], type = "Playermat" })
if playermat then
playermat.setVar("activeInvestigatorId", "00000")
end
@ -308,7 +310,7 @@ function tidyPlayerMatCoroutine()
end
end
local datahelper = getObjectsWithTag("DataHelper")[1]
local datahelper = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DataHelper" })
if datahelper then
datahelper.setTable("SPAWNED_PLAYER_CARD_GUIDS", {})
end

View File

@ -1,11 +1,12 @@
do
local TokenArrangerApi = {}
local guidHandler = getObjectsWithTag("GUIDs")[1]
-- 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 = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "TokenArranger" })
if tokenArranger ~= nil then
tokenArranger.call(functionName, argument)
end

View File

@ -1,5 +1,6 @@
do
local DeckImporterApi = {}
local guidHandler = getObjectsWithTag("GUIDs")[1]
-- Returns a table with the full state of the UI, including options and deck IDs.
-- This can be used to persist via onSave(), or provide values for a load operation
@ -13,7 +14,7 @@ do
-- investigators: True if investigator cards should be spawned
DeckImporterApi.getUiState = function()
local passthroughTable = {}
local DeckImporter = getObjectsWithTag("DeckImporter")[1]
local DeckImporter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DeckImporter" })
for k,v in pairs(DeckImporter.call("getUiState")) do
passthroughTable[k] = v
end
@ -31,7 +32,7 @@ do
-- loadNewest: True if the most upgraded version of the deck should be loaded
-- investigators: True if investigator cards should be spawned
DeckImporterApi.setUiState = function(uiStateTable)
local DeckImporter = getObjectsWithTag("DeckImporter")[1]
local DeckImporter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DeckImporter" })
return DeckImporter.call("setUiState", uiStateTable)
end

View File

@ -1,14 +1,14 @@
do
local BlessCurseManagerApi = {}
local internal = {}
local guidHandler = getObjectsWithTag("GUIDs")[1]
internal.getManager = function()
return getObjectsWithTag("BlessCurseManager")[1]
local function getManager()
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "BlessCurseManager" })
end
-- removes all taken tokens and resets the counts
BlessCurseManagerApi.removeTakenTokensAndReset = function()
local BlessCurseManager = internal.getManager()
local BlessCurseManager = getManager()
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)
@ -16,30 +16,30 @@ do
-- updates the internal count (called by cards that seal bless/curse tokens)
BlessCurseManagerApi.sealedToken = function(type, guid)
internal.getManager().call("sealedToken", { type = type, guid = guid })
getManager().call("sealedToken", { type = type, guid = guid })
end
-- updates the internal count (called by cards that seal bless/curse tokens)
BlessCurseManagerApi.releasedToken = function(type, guid)
internal.getManager().call("releasedToken", { type = type, guid = guid })
getManager().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)
internal.getManager().call("broadcastStatus", playerColor)
getManager().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)
internal.getManager().call("doRemove", playerColor)
getManager().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)
internal.getManager().call("addMenuOptions", { playerColor = playerColor, hoveredObject = hoveredObject })
getManager().call("addMenuOptions", { playerColor = playerColor, hoveredObject = hoveredObject })
end
return BlessCurseManagerApi

View File

@ -4,6 +4,7 @@ local options = {
Playarea = true,
Playermats = true
}
local guidHandler = getObjectsWithTag("GUIDs")[1]
val = 0
@ -64,7 +65,7 @@ function startReset()
if options.Agenda then
updateVal(0)
end
local DoomInPlayCounter = getObjectsWithTag("DoomInPlayCounter")[1]
local DoomInPlayCounter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DoomInPlayCounter" })
if DoomInPlayCounter then
DoomInPlayCounter.call("removeDoom", options)
end

View File

@ -1,5 +1,7 @@
local playmatApi = require("playermat/PlaymatApi")
local guidHandler = getObjectsWithTag("GUIDs")[1]
local ZONE, TRASH, loopID
local doomURL = "https://i.imgur.com/EoL7yaZ.png"
local IGNORE_TAG = "DoomCounter_ignore"
@ -29,8 +31,8 @@ function onLoad()
color = { 0, 0, 0, 0 }
})
TRASH = getObjectsWithAllTags({"Mythos", "Trash"})
ZONE = getObjectsWithAllTags({"Mythos", "PlayAreaZone" })
TRASH = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "Trash" })
ZONE = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "PlayAreaZone" })
loopID = Wait.time(countDoom, 2, -1)
end

View File

@ -0,0 +1,99 @@
local GuidReferences = {
White = {
ClueCounter = "d86b7c",
ClickableClueCounter = "db85d6",
DamageCounter = "eb08d6",
HandZone = "a70eee",
HorrorCounter = "468e88",
InvestigatorSkillTracker = "e598c2",
Playermat = "8b081b",
ResourceCounter = "4406f0",
Trash = "147e80"
},
Orange = {
ClueCounter = "1769ed",
ClickableClueCounter = "3f22e5",
DamageCounter = "e64eec",
HandZone = "5fe087",
HorrorCounter = "0257d9",
InvestigatorSkillTracker = "b4a5f7",
Playermat = "bd0ff4",
ResourceCounter = "816d84",
Trash = "f7b6c8"
},
Green = {
ClueCounter = "032300",
ClickableClueCounter = "891403",
DamageCounter = "1f5a0a",
HandZone = "0285cc",
HorrorCounter = "7b5729",
InvestigatorSkillTracker = "af7ed7",
Playermat = "383d8b",
ResourceCounter = "cd15ac",
Trash = "5f896a"
},
Red = {
ClueCounter = "37be78",
ClickableClueCounter = "4111de",
DamageCounter = "591a45",
HandZone = "be2f17",
HorrorCounter = "beb964",
InvestigatorSkillTracker = "e74881",
Playermat = "0840d5",
ResourceCounter = "a4b60d",
Trash = "4b8594"
},
Mythos = {
AllCardsBag = "15bb07",
BlessCurseManager = "5933fb",
CampaignThePathToCarcosa = "aca04c",
DataHelper = "708279",
DeckImporter = "a28140",
DoomCounter = "85c4c6",
DoomInPlayCounter = "652ff3",
MasterClueCounter = "4a3aa4",
MythosArea = "9f334f",
NavigationOverlayHandler = "797ede",
OptionPanelSource = "830bd0",
PlayArea = "721ba2",
PlayAreaZone = "a2f932",
PlayerCardPanel = "2d30ee",
ResourceTokenBag = "9fadf9",
RulesReference = "d99993",
SoundCube = "3c988f",
TokenArranger = "022907",
TokenSource = "124381",
TokenSpawnTracker = "e3ffc9",
TourStarter = "0e5aa8",
Trash = "70b9f6",
VictoryDisplay = "6ccd6d"
}
}
function getObjectByOwnerAndType(param)
local owner = param.owner
local type = param.type
return getObjectFromGUID(GuidReferences[owner][type])
end
function getObjectsByType(type)
local objList = {}
for owner, objects in pairs(GuidReferences) do
local obj = getObjectFromGUID(objects[type])
if obj then
objList[owner] = obj
end
end
return objList
end
function getObjectsByOwner(owner)
local objList = {}
for type, guid in pairs(GuidReferences[owner]) do
local obj = getObjectFromGUID(guid)
if obj then
objList[type] = obj
end
end
return objList
end

View File

@ -3,6 +3,8 @@ local optionPanelApi = require("core/OptionPanelApi")
local playmatApi = require("playermat/PlaymatApi")
local victoryDisplayApi = require("core/VictoryDisplayApi")
local guidHandler = getObjectsWithTag("GUIDs")[1]
function onLoad()
addHotkey("Add Doom to Agenda", addDoomToAgenda)
addHotkey("Bless/Curse Status", showBlessCurseStatus)
@ -41,7 +43,8 @@ end
-- adds 1 doom to the agenda
function addDoomToAgenda()
getObjectsWithTag("DoomCounter")[1].call("addVal", 1)
local doomCounter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DoomCounter" })
doomCounter.call("addVal", 1)
end
-- moves the hovered card to the victory display

View File

@ -8,6 +8,8 @@ local tokenArrangerApi = require("accessories/TokenArrangerApi")
local tokenChecker = require("core/token/TokenChecker")
local tokenManager = require("core/token/TokenManager")
local guidHandler = getObjectsWithTag("GUIDs")[1]
---------------------------------------------------------
-- general setup
---------------------------------------------------------
@ -127,7 +129,7 @@ function onLoad(savedData)
if obj ~= nil then obj.interactable = false end
end
DATA_HELPER = getObjectsWithTag("DataHelper")[1]
--DATA_HELPER = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DataHelper" })
resetChaosTokenStatTracker()
getModVersion()
math.randomseed(os.time())
@ -957,7 +959,7 @@ end
---@param rotation Table Desired rotation of the object (defaults to object's rotation)
---@param color String Matcolor this object is spawned for to set memo
function spawnHelperObject(name, position, rotation, color)
local sourceBag = getObjectsWithTag("OptionPanelSource")[1]
local sourceBag = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "OptionPanelSource" })
-- error handling for missing sourceBag
if not sourceBag then

View File

@ -3,6 +3,8 @@ local tokenArrangerApi = require("accessories/TokenArrangerApi")
local tokenChecker = require("core/token/TokenChecker")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
local guidHandler = getObjectsWithTag("GUIDs")[1]
local ENCOUNTER_DECK_AREA = {
upperLeft = { x = 0.9, z = 0.42 },
lowerRight = { x = 0.86, z = 0.38 },
@ -33,8 +35,8 @@ function onLoad(saveState)
useFrontData = loadedState.useFrontData or true
tokenData = loadedState.tokenData or {}
end
TRASH = getObjectsWithAllTags({"Mythos", "Trash"})
DATA_HELPER = getObjectsWithTag("DataHelper")[1]
TRASH = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "Trash" })
DATA_HELPER = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DataHelper" })
collisionEnabled = true
end

View File

@ -1,16 +1,19 @@
do
local MythosAreaApi = {}
local guidHandler = getObjectsWithTag("GUIDs")[1]
local function getMythosArea()
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "MythosArea" })
end
-- returns the chaos token metadata (if provided through scenario reference card)
MythosAreaApi.returnTokenData = function()
local MythosArea = getObjectsWithTag("MythosArea")[1]
return MythosArea.call("returnTokenData")
getMythosArea().call("returnTokenData")
end
-- draw an encounter card to the requested position/rotation
MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)
local MythosArea = getObjectsWithTag("MythosArea")[1]
MythosArea.call("drawEncounterCard", {
getMythosArea().call("drawEncounterCard", {
pos = pos,
rotY = rotY,
alwaysFaceUp = alwaysFaceUp

View File

@ -1,12 +1,16 @@
do
local NavigationOverlayApi = {}
local guidHandler = getObjectsWithTag("GUIDs")[1]
local function getNOHandler()
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "NavigationOverlayHandler" })
end
-- Copies the visibility for the Navigation overlay
---@param startColor String Color of the player to copy from
---@param targetColor String Color of the targeted player
NavigationOverlayApi.copyVisibility = function(startColor, targetColor)
local handler = getObjectsWithTag("NavigationOverlayHandler")[1]
handler.call("copyVisibility", {
getNOHandler().call("copyVisibility", {
startColor = startColor,
targetColor = targetColor
})
@ -15,8 +19,7 @@ do
-- Changes the Navigation Overlay view ("Full View" --> "Play Areas" --> "Closed" etc.)
---@param playerColor String Color of the player to update the visibility for
NavigationOverlayApi.cycleVisibility = function(playerColor)
local handler = getObjectsWithTag("NavigationOverlayHandler")[1]
handler.call("cycleVisibility", playerColor)
getNOHandler().call("cycleVisibility", playerColor)
end
return NavigationOverlayApi

View File

@ -2,6 +2,8 @@
-- general setup
---------------------------------------------------------
local guidHandler = getObjectsWithTag("GUIDs")[1]
-- Location connection directional options
local BIDIRECTIONAL = 0
local ONE_WAY = 1
@ -506,7 +508,7 @@ function shiftContentsRight(playerColor)
end
function shiftContents(playerColor, direction)
local zone = getObjectsWithTag("PlayAreaZone")[1]
local zone = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "PlayAreaZone" })
if not zone then
broadcastToColor("Scripting zone couldn't be found.", playerColor, "Red")
return

View File

@ -1,105 +1,109 @@
do
local PlayAreaApi = {}
local internal = {}
local guidHandler = getObjectsWithTag("GUIDs")[1]
internal.getPlayArea = function()
return getObjectsWithTag("PlayArea")[1]
local function getPlayArea()
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "PlayArea" })
end
local function getInvestigatorCounter()
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "InvestigatorCounter" })
end
-- Returns the current value of the investigator counter from the playmat
---@return Integer. Number of investigators currently set on the counter
PlayAreaApi.getInvestigatorCount = function()
return getObjectsWithTag("InvestigatorCounter")[1].getVar("val")
getInvestigatorCounter().getVar("val")
end
-- Updates the current value of the investigator counter from the playmat
---@param count Number of investigators to set on the counter
PlayAreaApi.setInvestigatorCount = function(count)
return getObjectsWithTag("InvestigatorCounter")[1].call("updateVal", count)
getInvestigatorCounter().call("updateVal", count)
end
-- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain
-- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'
---@param playerColor Color Color of the player requesting the shift for messages
PlayAreaApi.shiftContentsUp = function(playerColor)
return internal.getPlayArea().call("shiftContentsUp", playerColor)
return getPlayArea().call("shiftContentsUp", playerColor)
end
PlayAreaApi.shiftContentsDown = function(playerColor)
return internal.getPlayArea().call("shiftContentsDown", playerColor)
return getPlayArea().call("shiftContentsDown", playerColor)
end
PlayAreaApi.shiftContentsLeft = function(playerColor)
return internal.getPlayArea().call("shiftContentsLeft", playerColor)
return getPlayArea().call("shiftContentsLeft", playerColor)
end
PlayAreaApi.shiftContentsRight = function(playerColor)
return internal.getPlayArea().call("shiftContentsRight", playerColor)
return getPlayArea().call("shiftContentsRight", playerColor)
end
-- Reset the play area's tracking of which cards have had tokens spawned.
PlayAreaApi.resetSpawnedCards = function()
return internal.getPlayArea().call("resetSpawnedCards")
return getPlayArea().call("resetSpawnedCards")
end
-- Event to be called when the current scenario has changed.
---@param scenarioName Name of the new scenario
PlayAreaApi.onScenarioChanged = function(scenarioName)
internal.getPlayArea().call("onScenarioChanged", scenarioName)
getPlayArea().call("onScenarioChanged", scenarioName)
end
-- Sets this playmat's snap points to limit snapping to locations or not.
-- If matchTypes is false, snap points will be reset to snap all cards.
---@param matchTypes Boolean Whether snap points should only snap for the matching card types.
PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)
internal.getPlayArea().call("setLimitSnapsByType", matchCardTypes)
getPlayArea().call("setLimitSnapsByType", matchCardTypes)
end
-- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged
-- cards before they're destroyed by entering the container
PlayAreaApi.tryObjectEnterContainer = function(container, object)
internal.getPlayArea().call("tryObjectEnterContainer", { container = container, object = object })
getPlayArea().call("tryObjectEnterContainer", { container = container, object = object })
end
-- counts the VP on locations in the play area
PlayAreaApi.countVP = function()
return internal.getPlayArea().call("countVP")
return getPlayArea().call("countVP")
end
-- highlights all locations in the play area without metadata
---@param state Boolean True if highlighting should be enabled
PlayAreaApi.highlightMissingData = function(state)
return internal.getPlayArea().call("highlightMissingData", state)
return getPlayArea().call("highlightMissingData", state)
end
-- highlights all locations in the play area with VP
---@param state Boolean True if highlighting should be enabled
PlayAreaApi.highlightCountedVP = function(state)
return internal.getPlayArea().call("highlightCountedVP", state)
return getPlayArea().call("highlightCountedVP", state)
end
-- Checks if an object is in the play area (returns true or false)
PlayAreaApi.isInPlayArea = function(object)
return internal.getPlayArea().call("isInPlayArea", object)
return getPlayArea().call("isInPlayArea", object)
end
PlayAreaApi.getSurface = function()
return internal.getPlayArea().getCustomObject().image
return getPlayArea().getCustomObject().image
end
PlayAreaApi.updateSurface = function(url)
return internal.getPlayArea().call("updateSurface", url)
return getPlayArea().call("updateSurface", url)
end
-- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the
-- data to the local token manager instance.
---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call
PlayAreaApi.updateLocations = function(args)
internal.getPlayArea().call("updateLocations", args)
getPlayArea().call("updateLocations", args)
end
PlayAreaApi.getCustomDataHelper = function()
return internal.getPlayArea().getVar("customDataHelper")
return getPlayArea().getVar("customDataHelper")
end
return PlayAreaApi

View File

@ -1,5 +1,6 @@
do
local SoundCubeApi = {}
local guidHandler = getObjectsWithTag("GUIDs")[1]
-- this table links the name of a trigger effect to its index
local soundIndices = {
@ -9,7 +10,7 @@ do
}
local function playTriggerEffect(index)
local SoundCube = getObjectsWithTag("SoundCube")[1]
local SoundCube = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "SoundCube" })
SoundCube.AssetBundle.playTriggerEffect(index)
end

View File

@ -10,12 +10,10 @@ local countedVP = {}
local highlightMissing = false
local highlightCounted = false
local TRASH
local guidHandler = getObjectsWithTag("GUIDs")[1]
-- button creation when loading the game
function onLoad()
TRASH = getObjectsWithAllTags({"Mythos", "Trash"})
-- index 0: VP - "Display"
local buttonParameters = {}
buttonParameters.label = "0"
@ -235,8 +233,7 @@ end
function highlightCountedVP()
self.editButton({
index = 4,
tooltip = (highlightCounted and "Enable" or "Disable") ..
" highlighting of cards with VP."
tooltip = (highlightCounted and "Enable" or "Disable") .. " highlighting of cards with VP."
})
for _, obj in pairs(countedVP) do
if obj ~= nil then
@ -253,6 +250,8 @@ end
-- places the provided card in the first empty spot
function placeCard(card)
local TRASH = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "Trash" })
-- check snap point states
local snaps = self.getSnapPoints()
table.sort(snaps, function(a, b) return a.position.x > b.position.x end)

View File

@ -1,19 +1,22 @@
do
local VictoryDisplayApi = {}
local guidHandler = getObjectsWithTag("GUIDs")[1]
local function getVictoryDisplay()
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "VictoryDisplay" })
end
-- triggers an update of the Victory count
---@param delay Number Delay in seconds after which the update call is executed
VictoryDisplayApi.update = function(delay)
local VictoryDisplay = getObjectsWithTag("VictoryDisplay")[1]
VictoryDisplay.call("startUpdate", delay)
getVictoryDisplay().call("startUpdate", delay)
end
-- moves a card to the victory display (in the first empty spot)
---@param object Object Object that should be checked and potentially moved
VictoryDisplayApi.placeCard = function(object)
if object ~= nil and object.tag == "Card" then
local VictoryDisplay = getObjectsWithTag("VictoryDisplay")[1]
VictoryDisplay.call("placeCard", object)
getVictoryDisplay().call("getObjectByOwnerAndType", { owner = "Mythos", type = "VictoryDisplay" }).call("placeCard", object)
end
end

View File

@ -3,6 +3,8 @@ do
local playAreaApi = require("core/PlayAreaApi")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
local guidHandler = getObjectsWithTag("GUIDs")[1]
local PLAYER_CARD_TOKEN_OFFSETS = {
[1] = {
Vector(0, 3, -0.2)
@ -335,7 +337,7 @@ do
return
end
tokenTemplates = { }
local tokenSource = getObjectsWithTag("TokenSource")[1]
local tokenSource = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "TokenSource" })
for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do
local tokenName = tokenTemplate.Memo
tokenTemplates[tokenName] = tokenTemplate
@ -347,7 +349,7 @@ do
if playerCardData ~= nil then
return
end
local dataHelper = getObjectsWithTag("DataHelper")[1]
local dataHelper = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DataHelper" })
playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')
locationData = dataHelper.getTable('LOCATIONS_DATA')
end

View File

@ -1,33 +1,33 @@
do
local TokenSpawnTracker = {}
local internal = {}
local guidHandler = getObjectsWithTag("GUIDs")[1]
internal.getSpawnTracker = function()
return getObjectsWithTag("TokenSpawnTracker")[1]
local function getSpawnTracker()
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "TokenSpawnTracker" })
end
TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)
return internal.getSpawnTracker().call("hasSpawnedTokens", cardGuid)
return getSpawnTracker().call("hasSpawnedTokens", cardGuid)
end
TokenSpawnTracker.markTokensSpawned = function(cardGuid)
return internal.getSpawnTracker().call("markTokensSpawned", cardGuid)
return getSpawnTracker().call("markTokensSpawned", cardGuid)
end
TokenSpawnTracker.resetTokensSpawned = function(cardGuid)
return internal.getSpawnTracker().call("resetTokensSpawned", cardGuid)
return getSpawnTracker().call("resetTokensSpawned", cardGuid)
end
TokenSpawnTracker.resetAllAssetAndEvents = function()
return internal.getSpawnTracker().call("resetAllAssetAndEvents")
return getSpawnTracker().call("resetAllAssetAndEvents")
end
TokenSpawnTracker.resetAllLocations = function()
return internal.getSpawnTracker().call("resetAllLocations")
return getSpawnTracker().call("resetAllLocations")
end
TokenSpawnTracker.resetAll = function()
return internal.getSpawnTracker().call("resetAll")
return getSpawnTracker().call("resetAll")
end
return TokenSpawnTracker

View File

@ -1,9 +1,9 @@
do
local AllCardsBagApi = {}
local internal = {}
local guidHandler = getObjectsWithTag("GUIDs")[1]
internal.getAllCardsBag = function()
return getObjectsWithTag("AllCardsBag")[1]
local function getAllCardsBag()
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "AllCardsBag" })
end
-- Returns a specific card from the bag, based on ArkhamDB ID
@ -14,7 +14,7 @@ do
-- cardData: TTS object data, suitable for spawning the card
-- cardMetadata: Table of parsed metadata
AllCardsBagApi.getCardById = function(id)
internal.getAllCardsBag().call("getCardById", {id = id})
return getAllCardsBag().call("getCardById", {id = id})
end
-- Gets a random basic weakness from the bag. Once a given ID has been returned
@ -23,11 +23,11 @@ do
-- weaknesses.
---@return id String ID of the selected weakness.
AllCardsBagApi.getRandomWeaknessId = function()
internal.getAllCardsBag().call("getRandomWeaknessId")
return getAllCardsBag().call("getRandomWeaknessId")
end
AllCardsBagApi.isIndexReady = function()
internal.getAllCardsBag().call("isIndexReady")
return getAllCardsBag().call("isIndexReady")
end
-- Called by Hotfix bags when they load. If we are still loading indexes, then
@ -36,7 +36,7 @@ do
-- called once indexing is complete it means the hotfix bag has been added
-- later, and we should rebuild the index to integrate the hotfix bag.
AllCardsBagApi.rebuildIndexForHotfix = function()
internal.getAllCardsBag().call("rebuildIndexForHotfix")
return getAllCardsBag().call("rebuildIndexForHotfix")
end
-- Searches the bag for cards which match the given name and returns a list. Note that this is
@ -44,11 +44,11 @@ do
---@param name String or string fragment to search for names
---@param exact Boolean Whether the name match should be exact
AllCardsBagApi.getCardsByName = function(name, exact)
internal.getAllCardsBag().call("getCardsByName", {name = name, exact = exact})
return getAllCardsBag().call("getCardsByName", {name = name, exact = exact})
end
AllCardsBagApi.isBagPresent = function()
internal.getAllCardsBag() and true
return getAllCardsBag() and true
end
-- Returns a list of cards from the bag matching a class and level (0 or upgraded)
@ -59,15 +59,15 @@ do
-- cardData: TTS object data, suitable for spawning the card
-- cardMetadata: Table of parsed metadata
AllCardsBagApi.getCardsByClassAndLevel = function(class, upgraded)
internal.getAllCardsBag().call("getCardsByClassAndLevel", {class = class, upgraded = upgraded})
return getAllCardsBag().call("getCardsByClassAndLevel", {class = class, upgraded = upgraded})
end
AllCardsBagApi.getCardsByCycle = function(cycle)
internal.getAllCardsBag().call("getCardsByCycle", cycle)
return getAllCardsBag().call("getCardsByCycle", cycle)
end
AllCardsBagApi.getUniqueWeaknesses = function()
internal.getAllCardsBag().call("getUniqueWeaknesses")
return getAllCardsBag().call("getUniqueWeaknesses")
end
return AllCardsBagApi

View File

@ -7,13 +7,12 @@ local validCountItemList = {
["Clue"] = 1,
[""] = 1
}
local MATCOLOR, TRASH
exposedValue = 0
function onLoad()
self.createButton({
label = "",
click_function = "removeAllClues",
click_function = "countItems",
function_owner = self,
position = { 0, 0.1, 0 },
height = 0,
@ -21,9 +20,6 @@ function onLoad()
font_color = { 0, 0, 0 },
font_size = 2000
})
-- set MATCOLOR based on memo
MATCOLOR = JSON.decode(self.getMemo()).matColor
TRASH = getObjectsWithAllTags({MATCOLOR, "Trash"})
loopID = Wait.time(countItems, 1, -1)
end
@ -69,20 +65,8 @@ function findValidItemsInSphere()
return retval
end
function removeAllClues()
startLuaCoroutine(self, "clueRemovalCoroutine")
end
function clueRemovalCoroutine()
for _, entry in ipairs(findValidItemsInSphere()) do
-- Do not put the table in the garbage
if entry.hit_object.getGUID() ~= "4ee1f2" then
-- delay for animation purposes
for k = 1, 10 do
coroutine.yield(0)
end
TRASH.putObject(entry.hit_object)
end
function removeAllClues(trash)
for _, obj in ipairs(findValidItemsInSphere()) do
trash.putObject(obj)
end
return 1
end
end

View File

@ -4,6 +4,8 @@ local navigationOverlayApi = require("core/NavigationOverlayApi")
local tokenChecker = require("core/token/TokenChecker")
local tokenManager = require("core/token/TokenManager")
local guidHandler = getObjectsWithTag("GUIDs")[1]
-- set true to enable debug logging and show Physics.cast()
local DEBUG = false
@ -83,7 +85,7 @@ activeInvestigatorId = "00000"
-- table of type-object reference pairs of all owned objects
local ownedObjects = {}
local matColor = JSON.decode(self.getMemo()).matColor
local matColor = self.getMemo()
-- variable to track the status of the "Show Draw Button" option
local isDrawButtonVisible = false
@ -103,7 +105,7 @@ function onLoad(saveState)
self.interactable = DEBUG
-- get object references to owned objects
getOwnedObjects()
ownedObjects = guidHandler.call("getObjectsByOwner", matColor)
-- button creation
for i = 1, 6 do
@ -152,13 +154,6 @@ function onLoad(saveState)
math.randomseed(os.time())
end
function getOwnedObjects()
local objList = getObjectsWithTag(matColor)
for _, obj in ipairs(objList) do
end
end
---------------------------------------------------------
-- utility functions
---------------------------------------------------------
@ -873,7 +868,7 @@ function clickableClues(showCounter)
clueCount = ownedObjects.ClueCounter.getVar("exposedValue")
-- remove clues
ownedObjects.ClueCounter.call("removeAllClues")
ownedObjects.ClueCounter.call("removeAllClues", ownedObjects.Trash)
-- set value for clue clickers
ownedObjects.ClickableClueCounter.call("updateVal", clueCount)
@ -900,7 +895,7 @@ end
-- removes all clues (moving tokens to the trash and setting counters to 0)
function removeClues()
ownedObjects.ClueCounter.call("removeAllClues")
ownedObjects.ClueCounter.call("removeAllClues", ownedObjects.Trash)
ownedObjects.ClickableClueCounter.call("updateVal", 0)
end

View File

@ -163,7 +163,7 @@ do
---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier
PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)
for _, mat in ipairs(internal.getMatForColor(matColor)) do
mat.call("updateCounter", {type = type, newValue = newValue, modifier = modifier})
mat.call("updateCounter", { type = type, newValue = newValue, modifier = modifier })
end
end
@ -216,10 +216,11 @@ do
---@param matColor String Color of the playmat - White, Orange, Green, Red or All
---@return array Table Single-element if only single playmat is requested
internal.getMatForColor = function(matColor)
local guidHandler = getObjectsWithTag("GUIDs")[1]
if matColor == "All" then
return getObjectsWithTag("Playermat")
return guidHandler.call("getObjectsByType", "Playermat")
else
return {matColor = getObjectsWithAllTags({matColor, "Playermat"}) }
return { matColor = guidHandler.call("getObjectByOwnerAndType", { owner = matColor, type = "Playermat" }) }
end
end