1
0
mirror of https://github.com/tacigar/maidroid.git synced 2025-01-25 15:00:22 +01:00

Add maidroid_core's aux

This commit is contained in:
tacigar 2016-12-19 12:00:22 +09:00
parent 829481ce87
commit 53d90b4b86

View File

@ -0,0 +1,28 @@
------------------------------------------------------------
-- Copyright (c) 2016 tacigar. All rights reserved.
-- https://github.com/tacigar/maidroid
------------------------------------------------------------
maidroid_core._aux = {}
local default_searching_range = {
x = 5, y = 1, z = 5,
}
-- maidroid_core._aux.search_surrounding searchs maidroid surrounding.
function maidroid_core._aux.search_surrounding(self, pred, searching_range)
if searching_range == nil then
searching_range = default_searching_range
end
for x = -searching_range.x, searching_range.x do
for y = -searching_range.y, searching_range.y do
for z = -searching_range.z, searching_range.z do
local pos = {x = x, y = y, z = z}
if pred(self, pos) then
return pos
end
end
end
end
return nil
end