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"
}
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