SHARE
TWEET

EasyTurrets (OpenModularTurrets)

FeodorKekovich Feb 2nd, 2017 (edited) 338 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local a=require('component')local b=require('event')local c=require('term')local d=require('computer')local e=a.gpu;local f,g=e.getResolution()local h,i=30,15;local j=true;local k='(C)FeodorKekovich'local l={green=0x17E600,red=0xff0000,gray=0x474747,white=0xFFFFFF,black=0x000000}function connect()turrets={}for m,n in a.list()do if string.match(n,'TurretBase')~=nil then table.insert(turrets,m)end end end;function addWhite()b.ignore('touch',clicker)c.setCursor(1,5)c.clearLine()io.write('Ник >> ')player=io.read()if#turrets>0 then for o=1,#turrets do a.proxy(turrets[o]).addTrustedPlayer(player)end end;b.listen('touch',clicker)end;function remWhite()b.ignore('touch',clicker)c.setCursor(1,7)c.clearLine()io.write('Ник >> ')player=io.read()connect()if#turrets>0 then for o=1,#turrets do a.proxy(turrets[o]).removeTrustedPlayer(player)end end;b.listen('touch',clicker)end;function attackMobs(p)connect()if#turrets>0 then for o=1,#turrets do a.proxy(turrets[o]).setAttacksMobs(p)end end end;function attackNeutrals(p)connect()if#turrets>0 then for o=1,#turrets do a.proxy(turrets[o]).setAttacksNeutrals(p)end end end;function attackPlayers(p)connect()if#turrets>0 then for o=1,#turrets do a.proxy(turrets[o]).setAttacksPlayers(p)end end end;function sl()os.sleep(0.3)end;function start()if e.getDepth()==1 then d.beep(1500)print('EasyTurrets: Ошибка! Монитор и видеокарта 1 тира не поддерживаются!')j=false else run()end end;function run()e.setBackground(l.black)e.setForeground(l.green)c.clear()e.setResolution(h,i)d.beep(1300)e.set(7,1,'-- EasyTurrets --')e.setForeground(l.gray)e.set(2,6,'Турели без SerialPort Addon')e.set(5,7,'и турели первого тира')e.set(2,8,'не совместимы с программой!')e.set(10,9,'Учтите это...')e.setForeground(l.red)e.set(11,4,'ВНИМАНИЕ!!')e.set(13,12,'[ OK ]')b.pull('touch')connect()gui()b.listen('touch',clicker)end;function pointer(q,r)d.beep(1500)e.setForeground(l.red)e.set(q,r,'>')sl()end;function gui()c.clear()e.setForeground(l.red)e.set(24,15,'[ВЫХОД]')e.setForeground(l.green)e.set(1,1,'Турелей: '..#turrets)e.set(21,1,'[ОБНОВИТЬ]')e.set(6,5,'[ Добавление игрока ]')e.set(6,7,'[  Удаление игрока  ]')e.set(14,11,'[ДА]   [НЕТ]')e.set(14,12,'[ДА]   [НЕТ]')e.set(14,13,'[ДА]   [НЕТ]')e.setForeground(l.gray)e.set(11,3,'ВАЙТ ЛИСТ:')e.set(11,9,'АТАКОВАТЬ:')e.set(5,11,'МОБЫ:  ')e.set(5,12,'ИГРОКИ:')e.set(5,13,'МИРНЫЕ:')e.set(1,i,k)end;function clicker(s,s,t,u)if t>=24 and u==i then pointer(23,15)exit()elseif t>=21 and u==1 then pointer(20,1)connect()gui()elseif t>=1 and u==5 then pointer(5,5)addWhite()gui()elseif t>=1 and u==7 then pointer(5,7)remWhite()gui()elseif t>=14 and t<=17 and u==11 then pointer(13,11)attackMobs(true)gui()elseif t>=14 and t<=17 and u==12 then pointer(13,12)attackPlayers(true)gui()elseif t>=14 and t<=17 and u==13 then pointer(13,13)attackNeutrals(true)gui()elseif t>=21 and t<=25 and u==11 then pointer(20,11)attackMobs(false)gui()elseif t>=21 and t<=25 and u==12 then pointer(20,12)attackPlayers(false)gui()elseif t>=21 and t<=25 and u==13 then pointer(20,13)attackNeutrals(false)gui()end end;function b.shouldInterrupt()return false end;start()function exit()j=false;b.ignore('touch',clicker)c.clear()e.setForeground(l.white)e.setResolution(f,g)end;while j do e.setResolution(h,i)sl()end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top