From 0e4beda9502428ac22a7bf6960db2db11f405801 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Wed, 29 Nov 2023 13:24:14 +0100 Subject: [PATCH] added option panel hook --- src/core/PlayAreaImageData.ttslua | 6 +++--- src/core/PlayAreaSelector.ttslua | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/core/PlayAreaImageData.ttslua b/src/core/PlayAreaImageData.ttslua index 1279086d..c7cc294b 100644 --- a/src/core/PlayAreaImageData.ttslua +++ b/src/core/PlayAreaImageData.ttslua @@ -208,15 +208,15 @@ PLAYAREA_IMAGE_DATA = { URL = "http://cloud-3.steamusercontent.com/ugc/2279446315725447579/F7C3FB9E31147430C1384684887FC66E616D0302/" }, { - Name = "II - The Doom of Etzli 1", + Name = "II - The Doom of Eztli 1", URL = "http://cloud-3.steamusercontent.com/ugc/2279446315725447752/44EF68E1BF3C2D9DCD5306DD90B4CCCFBE03891C/" }, { - Name = "II - The Doom of Etzli 2", + Name = "II - The Doom of Eztli 2", URL = "http://cloud-3.steamusercontent.com/ugc/2279446315725448027/F5F14EC590C33BC87D8F0CFF43D7E4DF80D61133/" }, { - Name = "II - The Doom of Etzli 3", + Name = "II - The Doom of Eztli 3", URL = "http://cloud-3.steamusercontent.com/ugc/2279446315725448215/BFD9D940DB8EC9AC8D818C48BBAE3338A8E48A3B/" }, { diff --git a/src/core/PlayAreaSelector.ttslua b/src/core/PlayAreaSelector.ttslua index 31e13045..24a802e8 100644 --- a/src/core/PlayAreaSelector.ttslua +++ b/src/core/PlayAreaSelector.ttslua @@ -1,4 +1,5 @@ require("core/PlayAreaImageData") -- this fills the variable "PLAYAREA_IMAGE_DATA" +local optionPanelApi = require("core/OptionPanelApi") local playAreaApi = require("core/PlayAreaApi") local typeIndex, selectionIndex, plainNameCache @@ -150,6 +151,10 @@ function round(num, numDecimalPlaces) end function maybeUpdatePlayAreaImage(scenarioName) + -- check if option is enabled + local optionPanelState = optionPanelApi.getOptions() + if not optionPanelState["changePlayAreaImage"] then return end + -- initialize cache if nil if not plainNameCache then plainNameCache = {} @@ -157,7 +162,12 @@ function maybeUpdatePlayAreaImage(scenarioName) for j, dataForCycle in pairs(dataForType) do for k, data in ipairs(dataForCycle) do local plainName = getPlainName(data.Name) - log(plainName) + + -- override plainName for all images in the "Other Images" category (except the default image) + if i == "Other Images" and data.Name ~= "Default Image" then + plainName = "Generic" + end + if not plainNameCache[plainName] then plainNameCache[plainName] = {} end