Calame

TurtleFleet_Installer

Mar 6th, 2021 (edited)
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. local git_path = "https://raw.githubusercontent.com/Calame321/TurtleFleet/main/"
  2.  
  3. function update()
  4.     fs.delete( "startup" )
  5.     fs.delete( "TurtleFleet" )
  6.     get_file_from_github( git_path .. "Turtle/advanced_turtle.lua"  ,"TurtleFleet/Turtle/advanced_turtle.lua" )
  7.     get_file_from_github( git_path .. "Turtle/pathfind.lua"         ,"TurtleFleet/Turtle/pathfind.lua" )
  8.     get_file_from_github( git_path .. "Stations/station.lua"        ,"TurtleFleet/Stations/station.lua" )
  9.     get_file_from_github( git_path .. "Stations/treefarm.lua"       ,"TurtleFleet/Stations/treefarm.lua" )
  10.     get_file_from_github( git_path .. "Jobs/job.lua"                ,"TurtleFleet/Jobs/job.lua" )
  11.     get_file_from_github( git_path .. "Jobs/builder.lua"            ,"TurtleFleet/Jobs/builder.lua" )
  12.     get_file_from_github( git_path .. "Jobs/cooker.lua"             ,"TurtleFleet/Jobs/cooker.lua" )
  13.     get_file_from_github( git_path .. "Jobs/Miner.lua"              ,"TurtleFleet/Jobs/miner.lua" )
  14.     get_file_from_github( git_path .. "startup.lua"                 ,"startup" )
  15.  
  16.     rs.setAnalogueOutput( "back", 1 )
  17.     os.sleep( 0.05 )
  18.     rs.setAnalogueOutput( "back", 0 )
  19. end
  20.  
  21. function get_file_from_github( url, file_path )
  22.     local f = fs.open( file_path, "w" )
  23.     local w, m = http.get( url )
  24.     if w then
  25.         f.write( w.readAll() )
  26.         f.flush()
  27.         f.close()
  28.     else
  29.         print( "Cant load '" .. url .. "' : " .. m )
  30.     end
  31. end
  32.  
  33. update()
Add Comment
Please, Sign In to add comment