Advertisement
9551

Untitled

Jul 2nd, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. --pastebin run WKwVv39i
  2. --auto turret by elektrobom1--
  3. local kill = {
  4.     --examples:
  5.     --"Creeper",
  6.     --"Spider",
  7.     --"Skeleton",
  8.     --"Zombie"
  9.     }
  10. local noKill = {
  11.     --examples:
  12.     --"Wolf",
  13.     --"Pig"
  14. }
  15.     local a = require("ang")
  16.     local x = peripheral.wrap("back")
  17.     local arg = {...}
  18.     if arg[1] == nil then
  19.         arg[1] = 5
  20.     end
  21.     local num = tonumber(arg[1])
  22.     if arg[2] == nil then
  23.         powah = 1
  24.     elseif type(tonumber(arg[2])) == "number" then
  25.         powah = tonumber(arg[2])
  26.     end
  27.     local function shot()
  28.         if
  29.             (cord[1] < num) and (cord[1] > num - num * 2) and (cord[2] < num) and (cord[2] > num - num * 2) and
  30.                 (cord[3] < num / 4) and
  31.                 (cord[3] > num / 4 - num / 2 * 2)
  32.         then
  33.             deg = a.deg(e[queue])
  34.             x.fire(deg[1], deg[2], powah)
  35.         end
  36.     end
  37.     while true do
  38.         e = x.sense()
  39.         queue = math.random(1, #e)
  40.         cord = {e[queue].x, e[queue].z, e[queue].y}
  41.         for i = 1, #e do
  42.             if e[queue].name == kill[i] and e[queue].name ~= noKill[i] then
  43.                 shot()
  44.             end
  45.         end
  46.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement