less spammy feedback message

This commit is contained in:
Chr1Z93 2024-10-05 16:32:01 +02:00
parent c9dfdc9171
commit 488d465679
3 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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