countDoom() bugfix

This commit is contained in:
Chr1Z93 2023-09-30 00:40:25 +02:00
parent 947bf1dc4c
commit 9a1898ca4d

View File

@ -1,6 +1,6 @@
local playmatApi = require("playermat/PlaymatApi")
local ZONE, TRASH
local ZONE, TRASH, loopID
local doomURL = "https://i.imgur.com/EoL7yaZ.png"
local IGNORE_TAG = "DoomCounter_ignore"
local COLORS = { "White", "Orange", "Green", "Red" }
@ -28,15 +28,10 @@ end
-- main function
function countDoom()
local doom = 0
for i = 1, 5 do
if i = 5 then
objList = ZONE.getObjects()
else
objList = playmatApi.searchAroundPlaymat(COLORS[i])
end
doom = doom + countDoomFromList(objList)
for i = 1, 4 do
doom = doom + countDoomFromList(playmatApi.searchAroundPlaymat(COLORS[i]))
end
doom = doom + countDoomFromList(ZONE.getObjects())
self.editButton({ index = 0, label = tostring(doom) })
end
@ -69,7 +64,7 @@ function removeDoom(options)
end
broadcastToAll(count .. " doom removed from Playermats.", "White")
end
if options.Playarea then
count = removeDoomFromList(ZONE.getObjects())
broadcastToAll(count .. " doom removed from Playerarea.", "White")