add AR
This commit is contained in:
parent
29d3da0737
commit
a55e1d9b46
28
classic_tech/ar.lua
Normal file
28
classic_tech/ar.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
local ar = peripheral.find "arController"
|
||||
local pl_detector = peripheral.find "playerDetector"
|
||||
|
||||
if ar == nil or pl_detector == nil then
|
||||
error "couldnt find all peripherals. need ar controller and player detector"
|
||||
end
|
||||
|
||||
while true do
|
||||
local text = {}
|
||||
|
||||
text[1] = "Players:"
|
||||
for _, p in pairs(pl_detector.getOnlinePlayers()) do
|
||||
local pos = pl_detector.getPlayerPos(p)
|
||||
|
||||
if pos == nil then
|
||||
table.insert(text, p .. " @ ?")
|
||||
else
|
||||
table.insert(text, p .. " @ X: " .. pos.x .. " Y: " .. pos.y .. " Z: " .. pos.z)
|
||||
end
|
||||
end
|
||||
|
||||
ar.clear()
|
||||
for i, l in ipairs(text) do
|
||||
ar.drawRightboundString(l, 10 * i - 1, 0, 0xffffff)
|
||||
end
|
||||
|
||||
sleep(1)
|
||||
end
|
Loading…
Reference in a new issue