bug fixes

This commit is contained in:
dscarpac 2024-10-23 07:24:35 -05:00
parent 92af8fa963
commit cf4a12afbb
2 changed files with 9 additions and 6 deletions

View File

@ -90,7 +90,7 @@ function broadcastDoom(val)
local doomInPlayCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomInPlayCounter")
if doomInPlayCounter and md.subtractDoomInPlay then
doomInPlayCounter.call("toggleSubtractDoom", true)
printToAll("Right-click the small 'Doom in Play' counter and select 'Toggle Doom Mode' to change this.")
broadcastToAll("Right-click the small 'Doom in Play' counter and select 'Toggle Doom Mode' to change this.")
end
local doomInPlay = doomInPlayCounter and doomInPlayCounter.call("getDoomCount") or 0
local totalDoom = val + doomInPlay
@ -102,7 +102,7 @@ function broadcastDoom(val)
table.insert(broadcastParts, " doom on the agenda (")
-- add the middle part
if doomThreshold then
if doomThreshold - mod > 0 then
-- maybe add color if threshold is reached
if totalDoom >= doomThreshold then
table.insert(broadcastParts, "[" .. Color.fromString("Red"):toHex() .. "]")
@ -118,8 +118,12 @@ function broadcastDoom(val)
table.insert(broadcastParts, " total)")
else
table.insert(broadcastParts, val + math.abs(doomInPlay))
table.insert(broadcastParts, " in play)")
table.insert(broadcastParts, val + doomInPlay)
if doomInPlay < 0 then
table.insert(broadcastParts, " total)")
else
table.insert(broadcastParts, " in play)")
end
end
broadcastToAll(table.concat(broadcastParts, ""))

View File

@ -26,7 +26,7 @@ function onLoad(savedData)
subtractDoom = JSON.decode(savedData)
end
self.addContextMenuItem("Toggle Doom Mode", toggleSubtractDoom)
self.addContextMenuItem("Toggle Doom Mode", function() toggleSubtractDoom() end)
self.createButton({
label = "0",
click_function = "none",
@ -52,7 +52,6 @@ function toggleSubtractDoom(override)
else
subtractDoom = not subtractDoom
end
-- early exit if nothing was changed
if previousState == subtractDoom then return end