Less spammy doom counter message

This commit is contained in:
Chr1Z93 2024-10-29 09:15:49 +01:00
parent 5621ed2270
commit 808b6c45d2
2 changed files with 10 additions and 14 deletions

View File

@ -89,8 +89,10 @@ function broadcastDoom(val)
local doomInPlayCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomInPlayCounter")
if doomInPlayCounter and md.subtractDoomInPlay then
doomInPlayCounter.call("toggleSubtractDoom", true)
broadcastToAll("Right-click the small 'Doom in Play' counter and select 'Toggle Doom Mode' to change this.")
local previousState = doomInPlayCounter.call("toggleSubtractDoom", true)
if previousState == false then
broadcastToAll("Right-click the small 'Doom in Play' counter and select 'Toggle Doom Mode' to change this.")
end
end
local doomInPlay = doomInPlayCounter and doomInPlayCounter.call("getDoomCount") or 0
local totalDoom = val + doomInPlay

View File

@ -5,16 +5,10 @@ local ZONE, TRASH
local doomURL = "https://i.imgur.com/EoL7yaZ.png"
local IGNORE_TAG = "DoomCounter_ignore"
local TOTAL_PLAY_AREA = {
upperLeft = {
x = -9,
z = -35
},
lowerRight = {
x = -60,
z = 35
}
upperLeft = { x = -9, z = -35 },
lowerRight = { x = -60, z = 35 }
}
local subtractDoom = false
local subtractDoom = false
function updateSave()
self.script_state = JSON.encode(subtractDoom)
@ -23,7 +17,7 @@ end
-- create button, context menu and start loop
function onLoad(savedData)
if savedData and savedData ~= "" then
subtractDoom = JSON.decode(savedData)
subtractDoom = JSON.decode(savedData) or false
end
self.addContextMenuItem("Toggle Doom Mode", function() toggleSubtractDoom() end)
@ -52,9 +46,9 @@ function toggleSubtractDoom(override)
else
subtractDoom = not subtractDoom
end
-- early exit if nothing was changed
if previousState == subtractDoom then return end
if previousState == subtractDoom then return previousState end
updateSave()