diff --git a/src/accessories/CleanUpHelper.ttslua b/src/accessories/CleanUpHelper.ttslua index 85b95587..134e2620 100644 --- a/src/accessories/CleanUpHelper.ttslua +++ b/src/accessories/CleanUpHelper.ttslua @@ -172,7 +172,7 @@ function resetDoomCounter() -- reset subtractDoom setting local doomInPlayCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomInPlayCounter") if doomInPlayCounter ~= nil then - toggleSubtractDoom(false) + doomInPlayCounter.call("toggleSubtractDoom", true) end end diff --git a/src/core/DoomCounter.ttslua b/src/core/DoomCounter.ttslua index 4f4167cb..25cc836e 100644 --- a/src/core/DoomCounter.ttslua +++ b/src/core/DoomCounter.ttslua @@ -89,7 +89,7 @@ function broadcastDoom(val) local doomInPlayCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomInPlayCounter") if doomInPlayCounter and md.subtractDoomInPlay then - toggleSubtractDoom(true) + doomInPlayCounter.call("toggleSubtractDoom", true) end local doomInPlay = doomInPlayCounter and doomInPlayCounter.call("getDoomCount") or 0 local totalDoom = val + doomInPlay diff --git a/src/core/DoomInPlayCounter.ttslua b/src/core/DoomInPlayCounter.ttslua index b2898429..89bf5d02 100644 --- a/src/core/DoomInPlayCounter.ttslua +++ b/src/core/DoomInPlayCounter.ttslua @@ -46,17 +46,22 @@ function onLoad(savedData) end function toggleSubtractDoom(override) + local previousState = subtractDoom if override then subtractDoom = override else subtractDoom = not subtractDoom end + + -- early exit if nothing was changed + if previousState == subtractDoom then return end + updateSave() if subtractDoom then - broadcastToAll("Doom in play: Subtract from the total doom count.") + printToAll("Doom in play: Subtract from the total doom count.", "Orange") else - broadcastToAll("Doom in play: Add to the total doom count.") + printToAll("Doom in play: Add to the total doom count.", "Orange") end end