Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- detects if there even is a force field attached
- local shield = peripheral.find("warpdriveForceFieldProjector")
- if not shield then
- print("No Force Field Projector Connected.")
- end
- if shield.isInterfaced() == false then
- print("No Computer Interface Upgrade Installed.")
- end
- 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
- function getTranslation()
- if upgrades:match("1/1 x Translation") then
- return true
- elseif upgrades:match("0/1 x Translation") then
- print("No Translation Upgrade Installed.")
- end
- end
- ---
- function position()
- local laser = peripheral.find("warpdriveLaserCamera")
- -- Sets the frequency of the laser to 1420
- laser.beamFrequency(1420)
- 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()
- shield.translation(lx-fx, ly-fy, lz-fz)
- print("Shield has been adjusted accordingly.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement