Advertisement
jaklsfjlsak

护盾设置(采矿用)

Jul 12th, 2023
976
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. --- detects if there even is a force field attached
  2. local shield = peripheral.find("warpdriveForceFieldProjector")
  3.  
  4. if not shield then
  5.     print("No Force Field Projector Connected.")
  6. end
  7.  
  8. if shield.isInterfaced() == false then
  9.     print("No Computer Interface Upgrade Installed.")
  10. end
  11.  
  12. local _, upgrades = shield.getUpgrades()
  13. ---
  14.  
  15. --- this function is really janky but I don't want to make it better
  16. function getRange()
  17.     if upgrades:match("1/4 x Range") then
  18.         return 1
  19.     elseif upgrades:match("2/4 x Range") then
  20.         return 2
  21.     elseif upgrades:match("3/4 x Range") then
  22.         return 3
  23.     elseif upgrades:match("4/4 x Range") then
  24.         return 4
  25.     elseif upgrades:match("0/4 x Range") then
  26.         return 0
  27.     end
  28. end
  29.  
  30. Size = getRange() * 16
  31.  
  32. function getTranslation()
  33.     if upgrades:match("1/1 x Translation") then
  34.         return true
  35.     end
  36. end
  37.  
  38. ---
  39. function freq()
  40.     print("Input frequency (use 0 for no change): ")
  41.     local input = tonumber(read())
  42.     if input > 0 then
  43.         shield.beamFrequency(input)
  44.         print("Frequency has been changed to " ..input)
  45.     end
  46. end
  47.  
  48. function scale()
  49.     print("Input the amount of blocks you would like the Force Field to be wide on the X axis, the max and default is " ..Size*2+1)
  50.     sx = ((read() / 2) -1) / Size
  51.     --print(sx)
  52.     print("Input the amount of blocks you would like the Force Field to be wide on the Y axis, the max and default is " ..Size*2+1)
  53.     sy = ((read() / 2) -1) / Size
  54.     --print(sy)
  55.     print("Input the amount of blocks you would like the Force Field to be wide on the Z axis, the max and default is " ..Size*2+1)
  56.     sz = ((read() / 2) -1) / Size
  57.     --print(sz)
  58.     shield.max(sx, sy, sz)
  59.     --print(shield.max())
  60.     shield.min(-sx, -sy, -sz)
  61.     --print(shield.min())
  62.     print("Shield scale has been changed accordingly")
  63. end
  64.  
  65. freq()
  66. scale()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement