Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- coords={openperipheral_sensor_110={z=345,y=199,x=74,},openperipheral_sensor_45={z=290,y=199,x=-3,},openperipheral_sensor_28={z=268,y=199,x=74,},openperipheral_sensor_25={z=268,y=199,x=41,},openperipheral_sensor_98={z=334,y=199,x=74,},openperipheral_sensor_71={z=312,y=199,x=30,},openperipheral_sensor_61={z=301,y=199,x=52,},openperipheral_sensor_127={z=367,y=199,x=-3,},openperipheral_sensor_67={z=312,y=199,x=-14,},openperipheral_sensor_74={z=312,y=199,x=63,},openperipheral_sensor_85={z=323,y=199,x=63,},openperipheral_sensor_134={z=367,y=199,x=74,},openperipheral_sensor_75={z=312,y=199,x=74,},openperipheral_sensor_141={z=378,y=199,x=19,},openperipheral_sensor_48={z=290,y=199,x=30,},openperipheral_sensor_90={z=334,y=199,x=-14,},openperipheral_sensor_9={z=257,y=199,x=-3,},openperipheral_sensor_120={z=356,y=199,x=52,},openperipheral_sensor_77={z=323,y=199,x=-36,},openperipheral_sensor_24={z=268,y=199,x=30,},openperipheral_sensor_111={z=356,y=199,x=-47,},openperipheral_sensor_42={z=290,y=199,x=-36,},openperipheral_sensor_23={z=268,y=199,x=19,},openperipheral_sensor_116={z=356,y=199,x=8,},openperipheral_sensor_43={z=290,y=199,x=-25,},openperipheral_sensor_18={z=268,y=199,x=-36,},openperipheral_sensor_145={z=378,y=199,x=74,},openperipheral_sensor_91={z=334,y=199,x=-3,},openperipheral_sensor_26={z=268,y=199,x=52,},openperipheral_sensor_96={z=334,y=199,x=52,},openperipheral_sensor_40={z=279,y=199,x=74,},openperipheral_sensor_37={z=279,y=199,x=41,},openperipheral_sensor_34={z=279,y=199,x=8,},openperipheral_sensor_7={z=257,y=199,x=-25,},openperipheral_sensor_76={z=323,y=199,x=-47,},openperipheral_sensor_104={z=345,y=199,x=8,},openperipheral_sensor_130={z=367,y=199,x=30,},openperipheral_sensor_140={z=378,y=199,x=8,},openperipheral_sensor_86={z=323,y=199,x=74,},openperipheral_sensor_52={z=290,y=199,x=74,},openperipheral_sensor_83={z=323,y=199,x=41,},openperipheral_sensor_6={z=257,y=199,x=-36,},openperipheral_sensor_103={z=345,y=199,x=-3,},openperipheral_sensor_82={z=323,y=199,x=30,},openperipheral_sensor_47={z=290,y=199,x=19,},openperipheral_sensor_144={z=378,y=199,x=52,},openperipheral_sensor_80={z=323,y=199,x=-3,},openperipheral_sensor_88={z=334,y=199,x=-36,},openperipheral_sensor_118={z=356,y=199,x=30,},openperipheral_sensor_124={z=367,y=199,x=-36,},openperipheral_sensor_125={z=367,y=199,x=-25,},openperipheral_sensor_21={z=268,y=199,x=-3,},openperipheral_sensor_122={z=356,y=199,x=74,},openperipheral_sensor_126={z=367,y=199,x=-14,},openperipheral_sensor_108={z=345,y=199,x=52,},openperipheral_sensor_31={z=279,y=199,x=-25,},openperipheral_sensor_133={z=367,y=199,x=63,},openperipheral_sensor_79={z=323,y=199,x=-14,},openperipheral_sensor_49={z=290,y=199,x=41,},openperipheral_sensor_95={z=334,y=199,x=41,},openperipheral_sensor_143={z=378,y=199,x=41,},openperipheral_sensor_15={z=257,y=199,x=63,},openperipheral_sensor_4={z=301,y=199,x=-14,},openperipheral_sensor_10={z=257,y=199,x=8,},openperipheral_sensor_101={z=345,y=199,x=-25,},openperipheral_sensor_97={z=334,y=199,x=63,},openperipheral_sensor_27={z=268,y=199,x=63,},openperipheral_sensor_39={z=279,y=199,x=63,},openperipheral_sensor_32={z=279,y=199,x=-14,},openperipheral_sensor_123={z=367,y=199,x=-47,},openperipheral_sensor_5={z=257,y=199,x=-47,},openperipheral_sensor_87={z=334,y=199,x=-47,},openperipheral_sensor_102={z=345,y=199,x=-14,},openperipheral_sensor_68={z=312,y=199,x=-3,},openperipheral_sensor_138={z=378,y=199,x=-14,},openperipheral_sensor_14={z=257,y=199,x=52,},openperipheral_sensor_70={z=312,y=199,x=19,},openperipheral_sensor_93={z=334,y=199,x=19,},openperipheral_sensor_117={z=356,y=199,x=19,},openperipheral_sensor_128={z=367,y=199,x=8,},openperipheral_sensor_44={z=290,y=199,x=-14,},openperipheral_sensor_12={z=257,y=199,x=30,},openperipheral_sensor_81={z=323,y=199,x=8,},openperipheral_sensor_41={z=290,y=199,x=-47,},openperipheral_sensor_66={z=312,y=199,x=-25,},openperipheral_sensor_100={z=345,y=199,x=-36,},openperipheral_sensor_63={z=301,y=199,x=74,},openperipheral_sensor_55={z=301,y=199,x=-25,},openperipheral_sensor_213={z=378,y=199,x=-25,},openperipheral_sensor_51={z=290,y=199,x=63,},openperipheral_sensor_146={z=378,y=199,x=63,},openperipheral_sensor_139={z=378,y=199,x=-3,},openperipheral_sensor_57={z=301,y=199,x=8,},openperipheral_sensor_16={z=257,y=199,x=74,},openperipheral_sensor_106={z=345,y=199,x=30,},openperipheral_sensor_22={z=268,y=199,x=8,},openperipheral_sensor_142={z=378,y=199,x=30,},openperipheral_sensor_11={z=257,y=199,x=19,},openperipheral_sensor_72={z=312,y=199,x=41,},openperipheral_sensor_115={z=356,y=199,x=-3,},openperipheral_sensor_109={z=345,y=199,x=63,},openperipheral_sensor_119={z=356,y=199,x=41,},openperipheral_sensor_129={z=367,y=199,x=19,},openperipheral_sensor_78={z=323,y=199,x=-25,},openperipheral_sensor_92={z=334,y=199,x=8,},openperipheral_sensor_8={z=257,y=199,x=-14,},openperipheral_sensor_84={z=323,y=199,x=52,},openperipheral_sensor_89={z=334,y=199,x=-25,},openperipheral_sensor_19={z=268,y=199,x=-25,},openperipheral_sensor_65={z=312,y=199,x=-36,},openperipheral_sensor_17={z=268,y=199,x=-47,},openperipheral_sensor_54={z=301,y=199,x=-36,},openperipheral_sensor_53={z=301,y=199,x=-47,},openperipheral_sensor_46={z=290,y=199,x=8,},openperipheral_sensor_33={z=279,y=199,x=-3,},openperipheral_sensor_59={z=301,y=199,x=30,},openperipheral_sensor_56={z=301,y=199,x=-3,},openperipheral_sensor_50={z=290,y=199,x=52,},openperipheral_sensor_112={z=356,y=199,x=-36,},openperipheral_sensor_113={z=356,y=199,x=-25,},openperipheral_sensor_36={z=279,y=199,x=30,},openperipheral_sensor_131={z=367,y=199,x=41,},openperipheral_sensor_132={z=367,y=199,x=52,},openperipheral_sensor_62={z=301,y=199,x=63,},openperipheral_sensor_29={z=279,y=199,x=-47,},openperipheral_sensor_30={z=279,y=199,x=-36,},openperipheral_sensor_35={z=279,y=199,x=19,},openperipheral_sensor_69={z=312,y=199,x=8,},openperipheral_sensor_64={z=312,y=199,x=-47,},openperipheral_sensor_135={z=378,y=199,x=-47,},openperipheral_sensor_107={z=345,y=199,x=41,},openperipheral_sensor_73={z=312,y=199,x=52,},openperipheral_sensor_13={z=257,y=199,x=41,},openperipheral_sensor_114={z=356,y=199,x=-14,},openperipheral_sensor_105={z=345,y=199,x=19,},openperipheral_sensor_121={z=356,y=199,x=63,},openperipheral_sensor_99={z=345,y=199,x=-47,},openperipheral_sensor_38={z=279,y=199,x=52,},openperipheral_sensor_136={z=378,y=199,x=-36,},openperipheral_sensor_94={z=334,y=199,x=30,},openperipheral_sensor_60={z=301,y=199,x=41,},openperipheral_sensor_20={z=268,y=199,x=-14,},}
- x0=47
- z0=-256
- function wrapPs(peripheralName)
- periTab={}
- sideTab={}
- if peripheralName==nil then
- print("Fehler")
- end
- local peripherals = peripheral.getNames()
- local i2 = 1
- for i =1, #peripherals do
- if peripheral.getType(peripherals[i])==peripheralName then
- periTab[i2]=peripheral.wrap(peripherals[i])
- sideTab[i2]=peripherals[i]
- i2=i2+1
- end
- end
- if periTab~={} then
- return periTab,sideTab
- else
- return nil
- end
- end
- s=wrapPs("openperipheral_sensor")
- t=wrapPs("openperipheral_bridge")[1]
- function scan(s,mode)
- if mode==nil then
- mode="all"
- end
- if mode=="mob" or mode=="all" then
- mobs=s.getEntityIds("mob")
- for i=1, #mobs do
- data=nil
- data=s.getEntityData(mobs[i],"mob")
- if data~=nil then
- entity.mob[#entity.mob+1]=data.all()
- else
- entity.mob[#entity.mob+1]="lost"
- end
- end
- end
- if mode=="item" or mode=="all" then
- items=s.getEntityIds("item")
- for i=1, #items do
- data=nil
- data=s.getEntityData(items[i],"item")
- if data~=nil then
- entity.item[#entity.item+1]=data.all()
- else
- entity.item[#entity.item+1]="lost"
- end
- end
- end
- if mode=="player" or mode=="all" then
- players=s.getPlayers()
- for i=1, #players do
- data=nil
- data=s.getPlayerByName(players[i].name)
- if data~=nil then
- entity.player[#entity.player+1]=data.all()
- inv=entity.player[#entity.player].player.inventory
- for i2=1, 40 do
- if inv[i2]~=nil then
- fp=fs.open("temp","w")
- itemp=#entity.player
- i2temp=i2
- error=true
- fp.write("entity.player[itemp].player.inventory[i2temp]=inv[i2temp].all() error=false")
- fp.close()
- shell.run("temp")
- shell.run("rm temp")
- if error then
- entity.player[itemp].player.inventory[i2temp]=nil
- end
- end
- end
- else
- entity.player[#entity.player+1]="lost"
- end
- end
- end
- if mode=="minecart" or mode=="all" then
- minecarts=s.getEntityIds("minecart")
- for i=1, #minecarts do
- data=nil
- data=s.getEntityData(minecarts[i],"minecart")
- if data~=nil then
- entity.minecart[#entity.minecart+1]=data.all()
- else
- entity.minecart[#entity.minecart+1]="lost"
- end
- end
- end
- if mode=="frame" or mode=="all" then
- itemFrames=s.getEntityIds("item_frame")
- for i=1, #itemFrames do
- data=nil
- data=s.getEntityData(itemFrames[i],"item_frame")
- if data~=nil then
- entity.itemFrame[#entity.itemFrame+1]=data.all()
- else
- entity.itemFrame[#entity.itemFrame+1]="lost"
- end
- end
- end
- return entity
- end
- function string.cut(txt,char)
- while string.find(txt,char) do
- txt=string.sub(txt,1,string.find(txt,char)-1)..string.sub(txt,string.find(txt,char)+1,#txt)
- end
- return txt
- end
- function format(txt)
- txt=string.cut(txt,'\n')
- txt=string.cut(txt,'\r')
- txt=string.cut(txt,'\t')
- txt=string.cut(txt," ")
- txt=string.sub(txt,1,4000)
- return txt
- end
- function scanAll(mode)
- s=wrapPs("openperipheral_sensor")
- entity={}
- entity.item={}
- entity.mob={}
- entity.player={}
- entity.minecart={}
- entity.itemFrame={}
- for i42=1,#s do
- scan(s[i42],mode)
- term.clear()
- term.setCursorPos(1,1)
- term.write(math.floor(100/#s*i42).."%")
- end
- end
- function scanPos(mode)
- entity={}
- entity.item={}
- entity.mob={}
- entity.player={}
- entity.minecart={}
- entity.itemFrame={}
- el=1
- ePos={}
- eName={}
- s,ss=wrapPs("openperipheral_sensor")
- for i42=1,#s do
- scan(s[i42],mode)
- for i=1,#entity.mob do
- ePos[format(entity.mob[i].name)..entity.mob[i].id]={x=coords[ss[i42]].x+entity.mob[i].position.x,y=coords[ss[i42]].y+entity.mob[i].position.y,z=coords[ss[i42]].z+entity.mob[i].position.z}
- eName[el]=format(entity.mob[i].name)..entity.mob[i].id
- el=el+1
- end
- for i=1,#entity.player do
- ePos[format(entity.player[i].name)..entity.player[i].id]={x=coords[ss[i42]].x+entity.player[i].position.x,y=coords[ss[i42]].y+entity.player[i].position.y,z=coords[ss[i42]].z+entity.player[i].position.z}
- eName[el]=format(entity.player[i].name)..entity.player[i].id
- el=el+1
- end
- entity={}
- entity.item={}
- entity.mob={}
- entity.player={}
- entity.minecart={}
- entity.itemFrame={}
- term.clear()
- term.setCursorPos(1,1)
- term.write(i42.."/"..#s)
- end
- end
- function shootAt(target, shots)
- if shots==nil then shots=1 end
- target=ePos[target]
- c,cs=wrapPs("airCannon")
- for i=1, #c do
- success=c[i].setTargetLocation(target.x,target.y,target.z)
- if success then
- for i2=1,shots do
- c[i].fire()
- sleep(0.2)
- end
- end
- end
- end
- function shootAtPos(target, shots)
- if shots==nil then shots=1 end
- c,cs=wrapPs("airCannon")
- for i=1, #c do
- success=c[i].setTargetLocation(target[1],target[2],target[3])
- if success then
- for i2=1,shots do
- c[i].fire()
- sleep(0.2)
- end
- end
- end
- end
- function findAndShoot(target, shots)
- for i=1, #eName do
- if string.find(eName[i],target)~=nil then
- shootAt(eName[i],shots)
- end
- end
- end
- function autoShoot(target, shots)
- alive=true
- while alive do
- alive=false
- scanPos("mob")
- for i=1, #eName do
- if string.find(eName[i],target)~=nil then
- alive=true
- shootAt(eName[i],shots)
- end
- end
- end
- end
- function shootArea(target, radius, shots)
- if shots==nil then shots=1 end
- c,cs=wrapPs("airCannon")
- for i=1, #eName do
- if string.find(eName[i],target)~=nil then
- targetPos=ePos[eName[i]]
- for i2=1,shots do
- for x=-radius, radius do
- for y=-radius, radius do
- for n=1, #c do
- success=c[n].setTargetLocation(targetPos.x+x,targetPos.y+y,targetPos.z)
- if success then
- c[n].fire()
- sleep(0.2)
- end
- end
- end
- end
- end
- end
- end
- end
- function showInventory(playerName)
- t.clear()
- for i=1, #entity.player do
- if entity.player[i].name==playerName then
- y=1
- x=1
- i1=1
- while i1<=40 do
- while x<=180 do
- if entity.player[i].player.inventory[i1]~=nil then
- t.addIcon(x,y,entity.player[i].player.inventory[i1].id)
- if entity.player[i].player.inventory[i1].qty>1 then
- t.addText(x,y+10,tostring(entity.player[i].player.inventory[i1].qty),0)
- end
- end
- print(i1)
- i1=i1+1
- x=x+20
- end
- x=1
- y=y+20
- end
- end
- end
- t.sync()
- end
- function showMap(mode)
- t.clear()
- scanPos(mode)
- for i=1, #eName do
- pos=ePos[eName[i]]
- t.addText((pos.x-x0),(pos.z-z0),eName[i],0)
- end
- t.sync()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement