resolving review comments

This commit is contained in:
Chr1Z93 2022-12-16 11:53:11 +01:00
parent 2474660947
commit 2932ac2c31
2 changed files with 10 additions and 18 deletions

View File

@ -50,7 +50,7 @@
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScriptState": "{\"options\":{\"importTrauma\":true,\"removeDrawnLines\":false,\"tidyPlayermats\":true},\"optionsVisible\":false}",
"LuaScriptState": "{\"options\":{\"importTrauma\":true,\"removeDrawnLines\":false,\"tidyPlayermats\":true}}",
"LuaScript_path": "Fan-MadeAccessories.aa8b38/CleanUpHelper.26cf4b.ttslua",
"MeasureMovement": false,
"Name": "Custom_Token",

View File

@ -82,8 +82,7 @@ buttonParameters.function_owner = self
function onSave()
return JSON.encode({
options = options,
optionsVisible = optionsVisible
options = options
})
end
@ -91,8 +90,10 @@ function onLoad(savedData)
if savedData ~= nil then
local loadedData = JSON.decode(savedData)
options = loadedData.options
optionsVisible = loadedData.optionsVisible or false
updateOptionState()
-- update UI to match saved state
for id, state in pairs(options) do
self.UI.setAttribute(id, "image", state and "option_on" or "option_off")
end
end
-- index 0: button as label
@ -155,16 +156,6 @@ function showOrHideOptions()
end
end
function updateOptionState()
for id, state in pairs(options) do
self.UI.setAttribute(id, "image", state and "option_on" or "option_off")
end
if optionsVisible then
self.UI.show("options")
end
end
---------------------------------------------------------
-- main function
---------------------------------------------------------
@ -207,7 +198,7 @@ function updateCounters(tableOfGUIDs, tableOfNewValues, info)
if TOKEN ~= nil then
TOKEN.call("updateVal", tableOfNewValues[i])
else
printToAll(info .. ": Token number " .. i .. " could not be found and was skipped.", "Yellow")
printToAll(info .. ": No. " .. i .. " could not be found.", "Yellow")
end
end
end
@ -220,7 +211,7 @@ function resetSkillTrackers()
if obj ~= nil then
obj.call("updateStats", { 1, 1, 1, 1 })
else
printToAll("Skill tracker number " .. i .. " could not be found and was skipped.", "Yellow")
printToAll("Skill tracker number " .. i .. " could not be found.", "Yellow")
end
end
end
@ -232,7 +223,7 @@ function resetDoomCounter()
if doomcounter ~= nil then
doomcounter.call("updateVal")
else
printToAll("Doom counter could not be found and was skipped.", "Yellow")
printToAll("Doom counter could not be found.", "Yellow")
end
end
@ -292,6 +283,7 @@ end
-- discard all hand objects
function discardHands()
if not options["tidyPlayermats"] then return end
for i = 1, 4 do
local trashcan = getObjectFromGUID(TRASHCAN_GUIDS[i])
if trashcan == nil then return end