Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sides = peripheral.getNames()
- print("Found " .. tostring(table.getn(sides)) .. " peripherals")
- local mainLaser = nil
- local lasers = {}
- for _, side in pairs(sides) do
- if peripheral.getType(side) == "warpdriveLaser" then
- local laser = peripheral.wrap(side)
- local lx, ly, lz = laser.getLocalPosition()
- if (lx == 324) then
- mainLaser = peripheral.wrap(side)
- mainLaser["lx"], mainLaser["ly"], mainLaser["lz"] = mainLaser.getLocalPosition()
- mainLaser.beamFrequency(30000)
- elseif (lx == 333 or lx == 333) then
- local newIndex = #lasers+1
- lasers[newIndex] = peripheral.wrap(side)
- lasers[newIndex]["lx"], lasers[newIndex]["ly"], lasers[newIndex]["lz"] = lasers[newIndex].getLocalPosition()
- lasers[newIndex].beamFrequency(30000)
- if (lasers[newIndex].getEnergyStatus() < 1000000) then
- print("Laser at " .. lasers[newIndex].lx .. "; " .. lasers[newIndex].ly .. "; " .. lasers[newIndex].lz.. "; has insufficient energy, aborting...")
- return
- end
- end
- end
- end
- if (mainLaser == nil) then
- print("Laser not found")
- end
- print("Preparing to fire...")
- while true do
- if (mainLaser.getEnergyStatus() < 1000000) then
- sleep(0.2)
- else
- print("Firing: " .. os.clock())
- print(mainLaser.emitBeam(0, 0, -50))
- sleep(2)
- end
- end
- -- print("Firing in 2 seconds")
- -- sleep(2)
- -- while true do
- -- local skip = nil
- -- repeat
- -- skip = false
- -- for _,l in ipairs(lasers) do
- -- if (l.getEnergyStatus() < 1000000) then
- -- skip = true
- -- break
- -- end
- -- end
- -- if (skip) then
- -- sleep(0.5)
- -- end
- -- until (skip == false)
- -- for _,l in ipairs(lasers) do
- -- l.emitBeam(mainLaser.lx - l.lx, mainLaser.ly - l.ly, mainLaser.lz - l.lz)
- -- end
- -- sleep(0.1) -- min 0.05 max 0.25
- -- mainLaser.emitBeam(0, 0, -50)
- -- sleep(2.5)
- -- end
- -- salvoCnt = 0
- -- while true do
- -- for _,l in ipairs(lasers) do
- -- --l.emitBeam(mainLaser.lx - l.lx, mainLaser.ly - l.ly, mainLaser.lz - l.lz)
- -- if (salvoCnt > 3) then
- -- salvoCnt = 0
- -- sleep(5)
- -- end
- -- if (l.getEnergyStatus() == 1000000) then
- -- l.emitBeam(000 - l.lx, 29 - l.ly, -000 - l.lz)
- -- salvoCnt = salvoCnt + 1
- -- end
- -- end
- -- end
- --sleep(0.1) -- min 0.05 max 0.25
- --mainLaser.emitBeam(0, 0, -50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement