updated clue counter for kate
This commit is contained in:
parent
26ecd631c4
commit
8394e7de3f
@ -1,6 +1,11 @@
|
|||||||
|
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||||
|
local playmatApi = require("playermat/PlaymatApi")
|
||||||
local searchLib = require("util/SearchLib")
|
local searchLib = require("util/SearchLib")
|
||||||
|
|
||||||
exposedValue = 0
|
exposedValue = 0
|
||||||
|
|
||||||
|
local playmat
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
self.createButton({
|
self.createButton({
|
||||||
label = "",
|
label = "",
|
||||||
@ -12,10 +17,16 @@ function onLoad()
|
|||||||
font_color = { 0, 0, 0 },
|
font_color = { 0, 0, 0 },
|
||||||
font_size = 2000
|
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
|
end
|
||||||
|
|
||||||
-- Activated once per second, counts items in bowls
|
-- activated once per second, counts clues on the playmat
|
||||||
function countItems()
|
function countItems()
|
||||||
local totalValue = 0
|
local totalValue = 0
|
||||||
for _, item in ipairs(getClues()) do
|
for _, item in ipairs(getClues()) do
|
||||||
@ -32,5 +43,5 @@ function removeAllClues(trash)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function getClues()
|
function getClues()
|
||||||
return searchLib.inArea(self.getPosition(), self.getRotation(), { 2, 1, 2 }, "isClue")
|
return searchLib.onObject(playmat, "isClue")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user