Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if #tArgs ~= 1 then
- print( "Usage: build <router_name>" )
- return
- end
- local name=tArgs[1]
- local filename='routers'
- local file=fs.open(shell.dir()..'/'..filename,'r')
- if not file then
- print('File '..filename..' not found')
- return
- end
- local line=file.readLine()
- while line do
- n,x,z=line:match('(%S+)%s+([%+%-%d]%d*)%s+([%+%-%d]%d*)')
- if n==name then break end
- n=nil
- line=file.readLine()
- end
- file.close()
- if n then
- x=tonumber(x)
- z=tonumber(z)
- print(name,' ',x,' ',z)
- else
- print(name..' not registered')
- return
- end
- p=peripheral.wrap('bottom')
- w = p.getWorld(p.getPeripheralWorldID())
- y=253
- if w.getBlockID(x, y, z)~=0 then
- print('Place is not empty. Continue? (y/n)')
- if read()~='y' then
- return
- end
- end
- blocks={{id=7,md=0},{id=451,md=4},{id=1226,md=1},{id=1225,md=0},{id=7,md=0}}
- for i=5,1,-1 do
- for k=-1,1 do
- for l=-1,1 do
- if k==0 and l==0 then
- w.setBlock(x,y+i-4,z,blocks[i].id,blocks[i].md)
- else
- w.setBlock(x+k,y+i-4,z+l,7,0)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement