From ec315a2b3a0d97313c35ab8b8a97ae65c05ab510 Mon Sep 17 00:00:00 2001 From: dscarpac Date: Wed, 31 Jul 2024 07:14:33 -0500 Subject: [PATCH] merged changes into updateSave function --- src/playercards/CardsThatSealTokens.ttslua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/playercards/CardsThatSealTokens.ttslua b/src/playercards/CardsThatSealTokens.ttslua index 2c87487a..74cc7746 100644 --- a/src/playercards/CardsThatSealTokens.ttslua +++ b/src/playercards/CardsThatSealTokens.ttslua @@ -104,7 +104,9 @@ local tokenColor = { [""] = "#77674DE6" } -function onSave() return JSON.encode(sealedTokens) end +function updateSave() + self.script_state = JSON.encode(sealedTokens) +end function onLoad(savedData) sealedTokens = JSON.decode(savedData) or {} @@ -184,11 +186,11 @@ function readBag() end -- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end +function onDestroy() updateSave() end function resetSealedTokens() sealedTokens = {} - self.script_state = onSave() + updateSave() end -- native event from TTS - used to update the context menu for cards like "Unrelenting" @@ -280,7 +282,7 @@ function releaseAllTokens(playerColor) putTokenAway(guid) end sealedTokens = {} - self.script_state = onSave() + updateSave() end end @@ -340,6 +342,7 @@ function resolveSealed() end function updateStackSize() + updateSave() if MAX_SEALED == 1 then return end if #sealedTokens == 0 then return end -- get topmost sealed token