31 lines
1.0 KiB
Lua
31 lines
1.0 KiB
Lua
return function()
|
|
local cache = {}
|
|
while _G._running do
|
|
local el = _G.nearbyEntities
|
|
for i, entry in ipairs(cache) do
|
|
if el[i] == nil then
|
|
entry.cube.setSize(0.0, 0.0, 0.0)
|
|
entry.frame.setAlpha(0x00)
|
|
end
|
|
end
|
|
for i, entity in ipairs(nearbyEntities) do
|
|
if cache[i] == nil then
|
|
cache[i] = {}
|
|
cache[i].cube = canvas3d.addBox(0, 0, 0)
|
|
cache[i].frame = canvas3d.addFrame(0, 0, 0)
|
|
cache[i].text = cache[i].frame.addText({ 0, 0 }, "")
|
|
|
|
cache[i].cube.setDepthTested(false)
|
|
cache[i].frame.setDepthTested(false)
|
|
end
|
|
|
|
cache[i].cube.setPosition(entity.x, entity.y, entity.z)
|
|
cache[i].frame.setPosition(entity.x, entity.y, entity.z)
|
|
cache[i].frame.setAlpha(0xFF)
|
|
cache[i].text.setText(entity.name)
|
|
cache[i].text.setColor(0xFF0000FF)
|
|
end
|
|
os.sleep(0.05)
|
|
end
|
|
end
|