mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 22:41:49 +00:00
add entities.get_all(...), .get_all_in_box(...), .get_all_in_radius(...)
This commit is contained in:
parent
b499714d4b
commit
1eac343619
7 changed files with 100 additions and 0 deletions
|
|
@ -111,5 +111,16 @@ return {
|
|||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
get_all = function(uids)
|
||||
if uids == nil then
|
||||
return entities
|
||||
else
|
||||
local values = {}
|
||||
for _, uid in ipairs(uids) do
|
||||
values[uid] = entities[uid]
|
||||
end
|
||||
return values
|
||||
end
|
||||
end
|
||||
}
|
||||
|
|
|
|||
|
|
@ -307,6 +307,17 @@ end
|
|||
|
||||
stdcomp = require "core:internal/stdcomp"
|
||||
entities.get = stdcomp.get_Entity
|
||||
entities.get_all = function(uids)
|
||||
if uids == nil then
|
||||
local values = {}
|
||||
for k,v in pairs(stdcomp.get_all()) do
|
||||
values[k] = v
|
||||
end
|
||||
return values
|
||||
else
|
||||
return stdcomp.get_all(uids)
|
||||
end
|
||||
end
|
||||
|
||||
math.randomseed(time.uptime()*1536227939)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue