merged changes into updateSave function

This commit is contained in:
dscarpac 2024-07-31 07:14:33 -05:00
parent d62456258a
commit ec315a2b3a

View File

@ -104,7 +104,9 @@ local tokenColor = {
[""] = "#77674DE6" [""] = "#77674DE6"
} }
function onSave() return JSON.encode(sealedTokens) end function updateSave()
self.script_state = JSON.encode(sealedTokens)
end
function onLoad(savedData) function onLoad(savedData)
sealedTokens = JSON.decode(savedData) or {} sealedTokens = JSON.decode(savedData) or {}
@ -184,11 +186,11 @@ function readBag()
end end
-- save state when going into bags / decks -- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end function onDestroy() updateSave() end
function resetSealedTokens() function resetSealedTokens()
sealedTokens = {} sealedTokens = {}
self.script_state = onSave() updateSave()
end end
-- native event from TTS - used to update the context menu for cards like "Unrelenting" -- native event from TTS - used to update the context menu for cards like "Unrelenting"
@ -280,7 +282,7 @@ function releaseAllTokens(playerColor)
putTokenAway(guid) putTokenAway(guid)
end end
sealedTokens = {} sealedTokens = {}
self.script_state = onSave() updateSave()
end end
end end
@ -340,6 +342,7 @@ function resolveSealed()
end end
function updateStackSize() function updateStackSize()
updateSave()
if MAX_SEALED == 1 then return end if MAX_SEALED == 1 then return end
if #sealedTokens == 0 then return end if #sealedTokens == 0 then return end
-- get topmost sealed token -- get topmost sealed token