From e3b95264481e378f8e1aa7f10ec02ee03a61dbdb Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 13 Jul 2024 14:05:16 +0200 Subject: [PATCH] reset clue spawning for locations when new scenario starts --- src/core/MythosArea.ttslua | 3 +++ src/core/token/TokenSpawnTrackerApi.ttslua | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/core/MythosArea.ttslua b/src/core/MythosArea.ttslua index d986136b..83a10cf6 100644 --- a/src/core/MythosArea.ttslua +++ b/src/core/MythosArea.ttslua @@ -116,6 +116,9 @@ function fireScenarioChangedEvent() -- maybe update the playarea image local playAreaImageSelector = guidReferenceApi.getObjectByOwnerAndType("Mythos", "PlayAreaImageSelector") playAreaImageSelector.call("maybeUpdatePlayAreaImage", currentScenario) + + -- reset the token spawning for locations + tokenSpawnTrackerApi.resetAllLocations() end -- fires if the scenario title or the difficulty changes diff --git a/src/core/token/TokenSpawnTrackerApi.ttslua b/src/core/token/TokenSpawnTrackerApi.ttslua index e8176296..3766b40b 100644 --- a/src/core/token/TokenSpawnTrackerApi.ttslua +++ b/src/core/token/TokenSpawnTrackerApi.ttslua @@ -1,34 +1,34 @@ do - local TokenSpawnTracker = {} + local TokenSpawnTrackerApi = {} local guidReferenceApi = require("core/GUIDReferenceApi") local function getSpawnTracker() return guidReferenceApi.getObjectByOwnerAndType("Mythos", "TokenSpawnTracker") end - TokenSpawnTracker.hasSpawnedTokens = function(cardGuid) + TokenSpawnTrackerApi.hasSpawnedTokens = function(cardGuid) return getSpawnTracker().call("hasSpawnedTokens", cardGuid) end - TokenSpawnTracker.markTokensSpawned = function(cardGuid) + TokenSpawnTrackerApi.markTokensSpawned = function(cardGuid) return getSpawnTracker().call("markTokensSpawned", cardGuid) end - TokenSpawnTracker.resetTokensSpawned = function(card) + TokenSpawnTrackerApi.resetTokensSpawned = function(card) return getSpawnTracker().call("resetTokensSpawned", card) end - TokenSpawnTracker.resetAllAssetAndEvents = function() + TokenSpawnTrackerApi.resetAllAssetAndEvents = function() return getSpawnTracker().call("resetAllAssetAndEvents") end - TokenSpawnTracker.resetAllLocations = function() + TokenSpawnTrackerApi.resetAllLocations = function() return getSpawnTracker().call("resetAllLocations") end - TokenSpawnTracker.resetAll = function() + TokenSpawnTrackerApi.resetAll = function() return getSpawnTracker().call("resetAll") end - return TokenSpawnTracker + return TokenSpawnTrackerApi end