From 76120ef6f756da59522e839ce29d534f8a909539 Mon Sep 17 00:00:00 2001 From: bankey Date: Sat, 9 Sep 2023 16:11:03 -0400 Subject: [PATCH] adds onSave and additional logic to fix an issue where saving and loading would break the helper --- .../UnderworldMarketHelper.3650ea.ttslua | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/objects/Fan-MadeAccessories.aa8b38/UnderworldMarketHelper.3650ea.ttslua b/objects/Fan-MadeAccessories.aa8b38/UnderworldMarketHelper.3650ea.ttslua index 8df1a607..af9fbce2 100644 --- a/objects/Fan-MadeAccessories.aa8b38/UnderworldMarketHelper.3650ea.ttslua +++ b/objects/Fan-MadeAccessories.aa8b38/UnderworldMarketHelper.3650ea.ttslua @@ -1,8 +1,4 @@ function onload(saved_data) - if saved_data != '' then - local loaded_data = JSON.decode(saved_data) - end - revealCardPositions = { Vector(3.5, 0.25, 0), Vector(-3.5, 0.25, 0) @@ -31,6 +27,20 @@ function onload(saved_data) movingCards = false self.addContextMenuItem('Reset helper', resetHelper) + + if saved_data != '' then + local loaded_data = JSON.decode(saved_data) + hiddenCards = loaded_data.saved_hiddenCards + + isSetup = true + refreshButtons() + end +end + +function onSave() + return JSON.encode({ + saved_hiddenCards = hiddenCards + }) end function onObjectEnterContainer(container, object)