resolving review comments

This commit is contained in:
Chr1Z93 2023-04-08 20:04:30 +02:00
parent 6f795dfc82
commit 2a1033c5c4
2 changed files with 7 additions and 6 deletions

View File

@ -134,8 +134,8 @@ function doRemove(color)
broadcastToColor("Removed " .. count.Bless .. " Bless and " .. broadcastToColor("Removed " .. count.Bless .. " Bless and " ..
count.Curse .. " Curse tokens from the chaos bag.", color, "White") count.Curse .. " Curse tokens from the chaos bag.", color, "White")
broadcastToColor("Removed " .. removeType("Bless") .. " Bless and " .. broadcastToColor("Removed " .. removeTakenTokens("Bless") .. " Bless and " ..
removeType("Curse") .. " Curse tokens from play.", color, "White") removeTakenTokens("Curse") .. " Curse tokens from play.", color, "White")
doReset(color) doReset(color)
end end
@ -150,7 +150,7 @@ function doReset(color)
end end
-- removing tokens that were 'taken' -- removing tokens that were 'taken'
function removeType(type) function removeTakenTokens(type)
local count = 0 local count = 0
for _, guid in ipairs(tokensTaken[type]) do for _, guid in ipairs(tokensTaken[type]) do
local token = getObjectFromGUID(guid) local token = getObjectFromGUID(guid)
@ -268,10 +268,10 @@ function releasedToken(param)
end end
if not updating then if not updating then
updating = true updating = true
Wait.time(function() Wait.frames(function()
broadcastCount(param.type) broadcastCount(param.type)
updating = false updating = false
end, 0.1) end, 1)
end end
end end

View File

@ -69,7 +69,7 @@ local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi") local tokenArrangerApi = require("accessories/TokenArrangerApi")
local sealedTokens = {} local sealedTokens = {}
local ID_URL_MAP = {} local ID_URL_MAP = {}
tokensInBag = {} local tokensInBag = {}
function onSave() return JSON.encode(sealedTokens) end function onSave() return JSON.encode(sealedTokens) end
@ -189,6 +189,7 @@ function releaseMultipleTokens(playerColor)
printToColor("Not enough " .. name .. " tokens sealed.", playerColor) printToColor("Not enough " .. name .. " tokens sealed.", playerColor)
end end
end end
-- releases all sealed tokens -- releases all sealed tokens
function releaseAllTokens(playerColor) function releaseAllTokens(playerColor)
if not Global.call("canTouchChaosTokens") then return end if not Global.call("canTouchChaosTokens") then return end