Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local shield = peripheral.find("warpdriveForceFieldProjector")
- local laser = peripheral.find("warpdriveLaserCamera")
- -- Sets the frequency of the laser to 1420
- laser.beamFrequency(1420)
- local _, upgrades = shield.getUpgrades()
- ---
- --- this function is really janky but I don't want to make it better
- 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
- -- Waits for a "laserScanning" event
- os.pullEvent("laserScanning")
- 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
- print(tx, ty, tz)
- shield.translation(tx, ty, tz)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement