Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local lasers = {}
- lasers.A = {}
- lasers.B = {}
- lasers.C = {}
- lasers.D = {}
- local tmpLasers = {peripheral.find("warpdriveLaser")}
- for k,v in pairs(tmpLasers) do
- if v.isInterfaced() then
- v.lx, v.ly, v.lz = v.getLocalPosition()
- v.beamFrequency(30000)
- if (v.lz==-704) then
- --main laser
- if (v.lx == 326) then
- lasers.Amain = v
- elseif (v.lx == 322) then
- lasers.Cmain = v
- elseif (v.ly == 74) then
- lasers.Bmain = v
- elseif (v.ly == 70) then
- lasers.Dmain = v
- else
- print("wtf main")
- end
- elseif (v.lz==-703) then
- --aux laser
- if (v.lx >327) then
- table.insert(lasers.A, v)
- elseif (v.lx < 321) then
- table.insert(lasers.C, v)
- elseif (v.ly > 75) then
- table.insert(lasers.B, v)
- elseif (v.ly < 69) then
- table.insert(lasers.D, v)
- else
- print("wtf\n")
- end
- end
- else
- print("Found uninterfaced laser!")
- end
- end
- print("Test firing in 5 seconds")
- sleep (5)
- local target = {}
- target.x = 325
- target.y = 68
- target.z = -744
- -- for k,v in pairs(tmpLasers) do
- -- v.emitBeam(target.x - v.lx, target.y - v.ly, target.z - v.lz)
- -- sleep(0.2)
- -- end
- while true do
- --energy check
- local bool ok = true
- for k,v in pairs(tmpLasers) do
- if (v.getEnergyStatus() < 1000000) then
- print("Laser at " ..v.lx .. "; " .. v.ly .. "; " .. v.lz.. "; has insufficient energy, waiting...")
- ok = false
- sleep(1)
- break
- end
- sleep(0.2)
- end
- if (ok) then
- print("FIRING")
- for k,v in pairs(lasers.A) do
- v.emitBeam(lasers.Amain.lx - v.lx, lasers.Amain.ly - v.ly, lasers.Amain.lz - v.lz)
- end
- for k,v in pairs(lasers.B) do
- v.emitBeam(lasers.Bmain.lx - v.lx, lasers.Bmain.ly - v.ly, lasers.Bmain.lz - v.lz)
- end
- for k,v in pairs(lasers.C) do
- v.emitBeam(lasers.Cmain.lx - v.lx, lasers.Cmain.ly - v.ly, lasers.Cmain.lz - v.lz)
- end
- for k,v in pairs(lasers.D) do
- v.emitBeam(lasers.Dmain.lx - v.lx, lasers.Dmain.ly - v.ly, lasers.Dmain.lz - v.lz)
- end
- sleep(0.05)
- lasers.Amain.emitBeam(target.x - lasers.Amain.lx, target.y - lasers.Amain.ly, target.z - lasers.Amain.lz)
- lasers.Bmain.emitBeam(target.x - lasers.Bmain.lx, target.y - lasers.Bmain.ly, target.z - lasers.Bmain.lz)
- lasers.Cmain.emitBeam(target.x - lasers.Cmain.lx, target.y - lasers.Cmain.ly, target.z - lasers.Cmain.lz)
- lasers.Dmain.emitBeam(target.x - lasers.Dmain.lx, target.y - lasers.Dmain.ly, target.z - lasers.Dmain.lz)
- print("Waiting 10 seconds to recharge")
- sleep(10)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement