Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(fs.exists("conf") == false) then
- shell.run("pastebin get 38M5cNbZ conf")
- term.clear()
- end
- local shield = peripheral.find("warpdriveForceFieldProjector")
- local laser = peripheral.find("warpdriveLaserCamera")
- local lever = "front" -- format: front,back,left,right,top,bottom ONLY
- -- Sets the frequency of the laser to 1420
- laser.beamFrequency(1420)
- -- initial message
- print("Control System Online, Toggle Redstone To Toggle Shields, Press C to Configure")
- local _, upgrades = shield.getUpgrades()
- function getRange()
- if upgrades:match("1/4 x Range") then
- return 1
- elseif upgrades:match("2/4 x Range") then
- return 2
- elseif upgrades:match("3/4 x Range") then
- return 3
- elseif upgrades:match("4/4 x Range") then
- return 4
- elseif upgrades:match("0/4 x Range") then
- return 0
- end
- end
- Size = getRange() * 16
- while true do
- os.sleep(0.5)
- local event, key = os.pullEvent()
- if event == "redstone" then
- local on = redstone.getAnalogInput(lever)
- if on > 6 then
- shield.enable(true)
- elseif on < 5 then
- shield.enable(false)
- end
- elseif event == "key" then
- -- keys are represented by numbers, the number for 'C' is 46
- if key == 46 then
- print("C key pressed, running 'conf' script...")
- shell.run("conf")
- end
- elseif event == "laserScanning" then
- local type, lx, ly, lz, block = laser.getScanResult()
- local fx, fy, fz = shield.getLocalPosition()
- tx = (lx-fx) / Size
- ty = (ly-fy) / Size
- tz = (lz-fz) / Size
- shield.translation(tx, ty, tz)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement