Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --pastebin run WKwVv39i
- --auto turret by elektrobom1--
- local kill = {
- --examples:
- --"Creeper",
- --"Spider",
- --"Skeleton",
- --"Zombie"
- }
- local noKill = {
- --examples:
- --"Wolf",
- --"Pig"
- }
- local a = require("ang")
- local x = peripheral.wrap("back")
- local arg = {...}
- if arg[1] == nil then
- arg[1] = 5
- end
- local num = tonumber(arg[1])
- if arg[2] == nil then
- powah = 1
- elseif type(tonumber(arg[2])) == "number" then
- powah = tonumber(arg[2])
- end
- local function shot()
- if
- (cord[1] < num) and (cord[1] > num - num * 2) and (cord[2] < num) and (cord[2] > num - num * 2) and
- (cord[3] < num / 4) and
- (cord[3] > num / 4 - num / 2 * 2)
- then
- deg = a.deg(e[queue])
- x.fire(deg[1], deg[2], powah)
- end
- end
- while true do
- e = x.sense()
- queue = math.random(1, #e)
- cord = {e[queue].x, e[queue].z, e[queue].y}
- for i = 1, #e do
- if e[queue].name == kill[i] and e[queue].name ~= noKill[i] then
- shot()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement