From a312ede891b7fd8105119fc4b855592e5de05797 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Mon, 12 Dec 2022 09:38:29 +0100 Subject: [PATCH] repairing save function, XML animation added --- objects/DoomCounter.85c4c6.xml | 20 ++++---------------- src/core/DoomCounter.ttslua | 14 +++++++++----- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/objects/DoomCounter.85c4c6.xml b/objects/DoomCounter.85c4c6.xml index d6bb38f8..32cbbfca 100644 --- a/objects/DoomCounter.85c4c6.xml +++ b/objects/DoomCounter.85c4c6.xml @@ -16,22 +16,10 @@ - + - Doom on Agenda - Doom in Playarea - Doom on Playermats + Doom on Agenda + Doom in Playarea + Doom on Playermats diff --git a/src/core/DoomCounter.ttslua b/src/core/DoomCounter.ttslua index 553bafbb..9fa128c5 100644 --- a/src/core/DoomCounter.ttslua +++ b/src/core/DoomCounter.ttslua @@ -18,9 +18,7 @@ function onLoad(savedData) -- restore state for option panel for key, bool in pairs(options) do - if bool then - self.UI.setAttribute("option" .. key, "isOn", 0) - end + self.UI.setAttribute("option" .. key, "isOn", not bool) end end @@ -41,7 +39,9 @@ end -- called by the invisible button to change displayed value function addOrSubtract(_, _, isRightClick) local newVal = math.min(math.max(val + (isRightClick and -1 or 1), 0), 99) - if val ~= newVal then updateVal(newVal) end + if val ~= newVal then + updateVal(newVal) + end end function updateVal(number) @@ -55,7 +55,11 @@ function startReset() if options.Agenda then updateVal(0) end - getObjectFromGUID("652ff3").call("removeDoom", options) + -- call the "Doom-in-Play"-counter + local DoomInPlayCounter = getObjectFromGUID("652ff3") + if DoomInPlayCounter then + DoomInPlayCounter.call("removeDoom", options) + end end -- XML UI functions