updated clue counter for kate

This commit is contained in:
Chr1Z93 2024-02-13 12:04:29 +01:00
parent 26ecd631c4
commit 8394e7de3f

View File

@ -1,6 +1,11 @@
local guidReferenceApi = require("core/GUIDReferenceApi")
local playmatApi = require("playermat/PlaymatApi")
local searchLib = require("util/SearchLib")
exposedValue = 0
local playmat
function onLoad()
self.createButton({
label = "",
@ -12,10 +17,16 @@ function onLoad()
font_color = { 0, 0, 0 },
font_size = 2000
})
loopID = Wait.time(countItems, 1.5, -1)
-- get closest playmat
local matColor = playmatApi.getMatColorByPosition(self.getPosition())
playmat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat")
-- start loop
Wait.time(countItems, 1.5, -1)
end
-- Activated once per second, counts items in bowls
-- activated once per second, counts clues on the playmat
function countItems()
local totalValue = 0
for _, item in ipairs(getClues()) do
@ -32,5 +43,5 @@ function removeAllClues(trash)
end
function getClues()
return searchLib.inArea(self.getPosition(), self.getRotation(), { 2, 1, 2 }, "isClue")
return searchLib.onObject(playmat, "isClue")
end