View difference between Paste ID: av5VUBwn and M1wmEUG2
SHOW: | | - or go back to the newest paste.
1
local lasers = peripheral.getNames()
2
3
rednet.open("top")
4
 
5
for i = #lasers, 1, -1 do
6
    if peripheral.getType(lasers[i]) ~= "warpdriveLaserCamera" then
7
        table.remove(lasers, i)
8
    else
9
        peripheral.wrap(lasers[i]).beamFrequency(1420)
10
    end
11
end
12
13
print("Emit Scanning Laser to Target a Block")
14
 
15
while true do
16
    local event, laserName, lx, ly, lz, block, _, _, _, type, metadata, resistance = os.pullEvent()
17
 
18
    if event == "laserScanning" then
19
        -- Convert the laser scanning coordinates to numbers and store them
20
        local lastLx = tonumber(lx)
21
        local lastLy = tonumber(ly)
22
        local lastLz = tonumber(lz)
23
        
24
        
25
        print("Laser target: X:" .. lastLx .. " Y:" .. lastLy .. " Z:" .. lastLz)
26
27
            -- Package the coordinates into a table (you can also send a formatted string)
28
            local data = { x = lastLx, y = lastLy, z = lastLz }
29
            
30
            -- Broadcast the coordinates using a custom protocol ("coordBroadcast")
31
            rednet.broadcast(data, "SMineBroadcast")
32
end
33
end
34