forked from hkc/cc-stuff
32 lines
1.1 KiB
Lua
32 lines
1.1 KiB
Lua
return function()
|
|
local cache = {}
|
|
while _G._running do
|
|
for id, entry in pairs(cache) do
|
|
if nearbyEntitiesByUUID[id] == nil then
|
|
entry.cube.remove()
|
|
entry.frame.remove()
|
|
cache[id] = nil
|
|
end
|
|
end
|
|
|
|
for id, entity in pairs(nearbyEntitiesByUUID) do
|
|
if id ~= player.id then
|
|
if cache[id] == nil then
|
|
cache[id] = {}
|
|
cache[id].cube = canvas3d.addBox(0, 0, 0)
|
|
cache[id].frame = canvas3d.addFrame({ 0, 0, 0 })
|
|
cache[id].text = cache[id].frame.addText({ 0, 0 }, "")
|
|
end
|
|
cache[id].cube.setDepthTested(false)
|
|
cache[id].frame.setDepthTested(false)
|
|
cache[id].cube.setPosition(entity.x, entity.y, entity.z)
|
|
cache[id].frame.setPosition(entity.x, entity.y, entity.z)
|
|
cache[id].text.setAlpha(0xFF)
|
|
cache[id].text.setText(entity.name)
|
|
cache[id].text.setColor(0xFF0000FF)
|
|
end
|
|
end
|
|
os.sleep(0.05)
|
|
end
|
|
end
|