added SearchLib

This commit is contained in:
Chr1Z93 2023-12-11 18:28:25 +01:00
parent 019e7bcfe3
commit 198716174f
4 changed files with 5 additions and 7 deletions

View File

@ -1,10 +1,9 @@
local guidReferenceApi = require("core/GUIDReferenceApi")
local playmatApi = require("playermat/PlaymatApi")
local objects
function onClick_hideShow(player, matColor)
objects = guidReferenceApi.getObjectsByOwner(matColor)
local actionTokens = playmatApi.searchAroundPlaymat(matColor, isActionToken)
local objects = guidReferenceApi.getObjectsByOwner(matColor)
local actionTokens = playmatApi.searchAroundPlaymat(matColor, "isActionToken")
local pos = objects.Playermat.getPosition()
local mod = (pos.y > 0) and -2 or 2

View File

@ -15,7 +15,7 @@ function searchSelf()
clickableResourceCounter = nil
foundTokens = 0
for _, obj in ipairs(searchLib.onObject(self)) do
for _, obj in ipairs(searchLib.onObject(self), "isTileOrToken") do
local image = obj.getCustomObject().image
if image == "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/" then
foundTokens = foundTokens + math.abs(obj.getQuantity())

View File

@ -199,7 +199,7 @@ do
-- finds all objects on the playmat and associated set aside zone and returns a table
---@param matColor String Color of the playmat - White, Orange, Green, Red or All
---@param filter Function Optional filter function (return true for desired objects)
---@param filter String Name of the filte function (see util/SearchLib)
PlaymatApi.searchAroundPlaymat = function(matColor, filter)
local objList = {}
for _, mat in pairs(getMatForColor(matColor)) do

View File

@ -24,8 +24,7 @@ do
orientation = rot or { 0, 0, 0 },
type = 3,
size = size,
max_distance = maxDistance or 0,
debug = true
max_distance = maxDistance or 0
})
-- filtering the result