cc-stuff/augment/modules/wh.lua

31 lines
1.0 KiB
Lua
Raw Normal View History

return function()
2023-10-12 21:25:20 +03:00
local cache = {}
while _G._running do
2023-10-12 21:25:20 +03:00
local el = _G.nearbyEntities
for i, entry in ipairs(cache) do
if el[i] == nil then
2023-10-12 21:25:20 +03:00
entry.cube.setSize(0.0, 0.0, 0.0)
entry.frame.setAlpha(0x00)
end
end
2023-10-12 21:25:20 +03:00
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
2023-10-12 21:25:20 +03:00
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