Less spammy doom counter message
This commit is contained in:
parent
5621ed2270
commit
808b6c45d2
@ -89,8 +89,10 @@ function broadcastDoom(val)
|
|||||||
|
|
||||||
local doomInPlayCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomInPlayCounter")
|
local doomInPlayCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomInPlayCounter")
|
||||||
if doomInPlayCounter and md.subtractDoomInPlay then
|
if doomInPlayCounter and md.subtractDoomInPlay then
|
||||||
doomInPlayCounter.call("toggleSubtractDoom", true)
|
local previousState = doomInPlayCounter.call("toggleSubtractDoom", true)
|
||||||
broadcastToAll("Right-click the small 'Doom in Play' counter and select 'Toggle Doom Mode' to change this.")
|
if previousState == false then
|
||||||
|
broadcastToAll("Right-click the small 'Doom in Play' counter and select 'Toggle Doom Mode' to change this.")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local doomInPlay = doomInPlayCounter and doomInPlayCounter.call("getDoomCount") or 0
|
local doomInPlay = doomInPlayCounter and doomInPlayCounter.call("getDoomCount") or 0
|
||||||
local totalDoom = val + doomInPlay
|
local totalDoom = val + doomInPlay
|
||||||
|
@ -5,16 +5,10 @@ local ZONE, TRASH
|
|||||||
local doomURL = "https://i.imgur.com/EoL7yaZ.png"
|
local doomURL = "https://i.imgur.com/EoL7yaZ.png"
|
||||||
local IGNORE_TAG = "DoomCounter_ignore"
|
local IGNORE_TAG = "DoomCounter_ignore"
|
||||||
local TOTAL_PLAY_AREA = {
|
local TOTAL_PLAY_AREA = {
|
||||||
upperLeft = {
|
upperLeft = { x = -9, z = -35 },
|
||||||
x = -9,
|
lowerRight = { x = -60, z = 35 }
|
||||||
z = -35
|
|
||||||
},
|
|
||||||
lowerRight = {
|
|
||||||
x = -60,
|
|
||||||
z = 35
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
local subtractDoom = false
|
local subtractDoom = false
|
||||||
|
|
||||||
function updateSave()
|
function updateSave()
|
||||||
self.script_state = JSON.encode(subtractDoom)
|
self.script_state = JSON.encode(subtractDoom)
|
||||||
@ -23,7 +17,7 @@ end
|
|||||||
-- create button, context menu and start loop
|
-- create button, context menu and start loop
|
||||||
function onLoad(savedData)
|
function onLoad(savedData)
|
||||||
if savedData and savedData ~= "" then
|
if savedData and savedData ~= "" then
|
||||||
subtractDoom = JSON.decode(savedData)
|
subtractDoom = JSON.decode(savedData) or false
|
||||||
end
|
end
|
||||||
|
|
||||||
self.addContextMenuItem("Toggle Doom Mode", function() toggleSubtractDoom() end)
|
self.addContextMenuItem("Toggle Doom Mode", function() toggleSubtractDoom() end)
|
||||||
@ -52,9 +46,9 @@ function toggleSubtractDoom(override)
|
|||||||
else
|
else
|
||||||
subtractDoom = not subtractDoom
|
subtractDoom = not subtractDoom
|
||||||
end
|
end
|
||||||
|
|
||||||
-- early exit if nothing was changed
|
-- early exit if nothing was changed
|
||||||
if previousState == subtractDoom then return end
|
if previousState == subtractDoom then return previousState end
|
||||||
|
|
||||||
updateSave()
|
updateSave()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user