Advertisement
Wojbie

Fast GPS

Feb 27th, 2015 (edited)
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.80 KB | None | 0 0
  1. ------------------------------------------------------------------
  2. -- Wojbies Program 4.0 - FastGPS - Fast GPS Server Initializing --
  3. ------------------------------------------------------------------
  4. --   Copyright (c) 2015-2021 Wojbie (wojbie@wojbie.net)
  5. --   Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
  6. --   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  7. --   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  8. --   3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  9. --   4. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  10. --   5. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  11. --   NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. YOU ACKNOWLEDGE THAT THIS SOFTWARE IS NOT DESIGNED, LICENSED OR INTENDED FOR USE IN THE DESIGN, CONSTRUCTION, OPERATION OR MAINTENANCE OF ANY NUCLEAR FACILITY.
  12.  
  13. if fs.exists("/startup") then
  14.     local newName = "/oldstartup" .. math.random(1, 999)
  15.     while fs.exists(newName) do
  16.         newName = "/oldstartup" .. math.random(1, 999)
  17.     end
  18.     fs.move("/startup", newName)
  19. end
  20.  
  21. local x, y, z = gps.locate(2, true)
  22. local coord = ""
  23. if x then
  24.     coord = x .. " " .. y .. " " .. z
  25. else
  26.     print("Write coords'x y z':")
  27.     coord = read()
  28. end
  29.  
  30. local function save(name, data, binary) local file = fs.open(tostring(name), binary and "wb" or "w") if not file then return false end file.write(data) file.close() return true end
  31. save("/startup", [[term.clear()
  32. term.setCursorPos(1, 1)
  33. print(turtle and "__          __     _  _      _       \n\\ \\        / /    (_)| |    (_)      \n \\ \\  /\\  / /___   _ | |__   _   ___ \n  \\ \\/  \\/ // _ \\ | || '_ \\ | | / _ \\\n   \\  /\\  /| (_) || || |_) || ||  __/\n    \\/  \\/  \\___/ | ||_.__/ |_| \\___|\n                 _/ |                \n                |__/                 " or " __      __                __                      \n/\\ \\  __/\\ \\           __ /\\ \\       __            \n\\ \\ \\/\\ \\ \\ \\    ___  /\\_\\\\ \\ \\____ /\\_\\      __   \n \\ \\ \\ \\ \\ \\ \\  / __'\\\\/\\ \\\\ \\ '__'\\\\/\\ \\   /'__'\\ \n  \\ \\ \\_/ \\_\\ \\/\\ \\L\\ \\\\ \\ \\\\ \\ \\L\\ \\\\ \\ \\ /\\  __/ \n   \\ '\\___x___/\\ \\____/_\\ \\ \\\\ \\_,__/ \\ \\_\\\\ \\____\\\n    '\\/__//__/  \\/___//\\ \\_\\ \\\\/___/   \\/_/ \\/____/\n                      \\ \\____/                     \n                       \\/___/                      ")
  34. print()
  35. shell.run("gps host ]] .. coord .. [[ ")]])
  36.  
  37. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement