added SearchLib
This commit is contained in:
parent
019e7bcfe3
commit
198716174f
@ -1,10 +1,9 @@
|
|||||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||||
local playmatApi = require("playermat/PlaymatApi")
|
local playmatApi = require("playermat/PlaymatApi")
|
||||||
local objects
|
|
||||||
|
|
||||||
function onClick_hideShow(player, matColor)
|
function onClick_hideShow(player, matColor)
|
||||||
objects = guidReferenceApi.getObjectsByOwner(matColor)
|
local objects = guidReferenceApi.getObjectsByOwner(matColor)
|
||||||
local actionTokens = playmatApi.searchAroundPlaymat(matColor, isActionToken)
|
local actionTokens = playmatApi.searchAroundPlaymat(matColor, "isActionToken")
|
||||||
local pos = objects.Playermat.getPosition()
|
local pos = objects.Playermat.getPosition()
|
||||||
local mod = (pos.y > 0) and -2 or 2
|
local mod = (pos.y > 0) and -2 or 2
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ function searchSelf()
|
|||||||
clickableResourceCounter = nil
|
clickableResourceCounter = nil
|
||||||
foundTokens = 0
|
foundTokens = 0
|
||||||
|
|
||||||
for _, obj in ipairs(searchLib.onObject(self)) do
|
for _, obj in ipairs(searchLib.onObject(self), "isTileOrToken") do
|
||||||
local image = obj.getCustomObject().image
|
local image = obj.getCustomObject().image
|
||||||
if image == "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/" then
|
if image == "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/" then
|
||||||
foundTokens = foundTokens + math.abs(obj.getQuantity())
|
foundTokens = foundTokens + math.abs(obj.getQuantity())
|
||||||
|
@ -199,7 +199,7 @@ do
|
|||||||
|
|
||||||
-- finds all objects on the playmat and associated set aside zone and returns a table
|
-- 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 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)
|
PlaymatApi.searchAroundPlaymat = function(matColor, filter)
|
||||||
local objList = {}
|
local objList = {}
|
||||||
for _, mat in pairs(getMatForColor(matColor)) do
|
for _, mat in pairs(getMatForColor(matColor)) do
|
||||||
|
@ -24,8 +24,7 @@ do
|
|||||||
orientation = rot or { 0, 0, 0 },
|
orientation = rot or { 0, 0, 0 },
|
||||||
type = 3,
|
type = 3,
|
||||||
size = size,
|
size = size,
|
||||||
max_distance = maxDistance or 0,
|
max_distance = maxDistance or 0
|
||||||
debug = true
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- filtering the result
|
-- filtering the result
|
||||||
|
Loading…
Reference in New Issue
Block a user