clean up of skill tracker

This commit is contained in:
Chr1Z93 2022-11-16 19:08:19 +01:00
parent 9f1415901e
commit 752d9a8b43

View File

@ -1,20 +1,15 @@
-- Stat Tracker -- Stat Tracker
-- made by: Chr1Z -- made by: Chr1Z
-- description: helps tracking the stats of your investigator -- description: helps tracking the stats of your investigator
information = {
version = "1.1",
last_updated = "12.11.2022"
}
local BUTTON_PARAMETERS = {} local BUTTON_PARAMETERS = {}
BUTTON_PARAMETERS.function_owner = self BUTTON_PARAMETERS.function_owner = self
BUTTON_PARAMETERS.height = 650 BUTTON_PARAMETERS.height = 650
BUTTON_PARAMETERS.width = 700 BUTTON_PARAMETERS.width = 700
BUTTON_PARAMETERS.position = { -4.775, 0.1, -0.03 } BUTTON_PARAMETERS.position = { x = -4.775, y = 0.1, z = -0.03 }
BUTTON_PARAMETERS.color = { 0, 0, 0, 0 } BUTTON_PARAMETERS.color = { 0, 0, 0, 0 }
BUTTON_PARAMETERS.font_color = { 0, 0, 0, 100 } BUTTON_PARAMETERS.font_color = { 0, 0, 0, 100 }
BUTTON_PARAMETERS.font_size = 450 BUTTON_PARAMETERS.font_size = 450
X_OFFSET = 1.91
function onSave() return JSON.encode(stats) end function onSave() return JSON.encode(stats) end
@ -23,17 +18,12 @@ function onLoad(saved_data)
stats = JSON.decode(saved_data) or { 1, 1, 1, 1 } stats = JSON.decode(saved_data) or { 1, 1, 1, 1 }
for i = 1, 4 do for i = 1, 4 do
BUTTON_PARAMETERS.position[1] = BUTTON_PARAMETERS.position[1] + X_OFFSET
BUTTON_PARAMETERS.label = stats[i] .. " " BUTTON_PARAMETERS.label = stats[i] .. " "
BUTTON_PARAMETERS.position.x = BUTTON_PARAMETERS.position.x + 1.91
BUTTON_PARAMETERS.click_function = attachIndex("button_click", i) BUTTON_PARAMETERS.click_function = attachIndex("button_click", i)
self.createButton(BUTTON_PARAMETERS) self.createButton(BUTTON_PARAMETERS)
end end
self.addContextMenuItem("More Information", function()
printToAll("------------------------------", "White")
printToAll("Stat Tracker v" .. information["version"] .. " by Chr1Z", "Orange")
printToAll("last updated: " .. information["last_updated"], "White")
end)
self.addContextMenuItem("Reset to 1s", function() updateStats({ 1, 1, 1, 1 }) end) self.addContextMenuItem("Reset to 1s", function() updateStats({ 1, 1, 1, 1 }) end)
end end