Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Installer script for AxoTurtle
- local configDir = "AxoTurtleConfig"
- local devOffFile = configDir .. "/dev_off"
- -- Function to create a directory if it doesn't exist
- local function createDirIfNotExists(dir)
- if not fs.exists(dir) then
- fs.makeDir(dir)
- end
- end
- -- Function to write the development status file
- local function writeDevStatus(status)
- local file = fs.open(devOffFile, "w")
- file.write(status)
- file.close()
- end
- -- Create configuration directory and dev_off file
- createDirIfNotExists(configDir)
- writeDevStatus("off")
- -- Modify the startup script
- local startupScript = "/startup"
- local startupCode = [[
- -- Existing startup code if any
- if fs.exists("startup_backup") then
- shell.run("startup_backup")
- end
- -- AxoTurtle startup additions
- local devStatusFile = "]] .. devOffFile .. [["
- local function getDevStatus()
- if not fs.exists(devStatusFile) then
- return "off"
- end
- local file = fs.open(devStatusFile, "r")
- local status = file.readAll()
- file.close()
- return status:match("^%s*(.-)%s*$") -- trim whitespace
- end
- local devStatus = getDevStatus()
- if devStatus == "on" then
- print("Development mode active")
- -- Custom development mode behavior here
- else
- print("Production mode active")
- -- Phase 1: Launch Phase
- local function launchPhase()
- print("Running Launch Phase...")
- -- Insert launch phase logic here
- end
- -- Phase 2: Idle Phase
- local function idlePhase()
- print("Entering Idle Phase...")
- while true do
- -- Wait for user input or other events
- local event, param = os.pullEvent()
- if event == "key" then
- -- Process user input
- print("Key pressed:", param)
- -- Phase 3: Action Phase
- actionPhase()
- end
- end
- end
- -- Phase 3: Action Phase
- local function actionPhase()
- print("Performing Action...")
- -- Insert action phase logic here
- end
- launchPhase()
- idlePhase()
- end
- ]]
- -- Backup existing startup script
- if fs.exists(startupScript) then
- fs.copy(startupScript, "startup_backup")
- end
- -- Write new startup script
- local file = fs.open(startupScript, "w")
- file.write(startupCode)
- file.close()
- print("AxoTurtle installed successfully!")
Advertisement
Comments
-
- can u add me bro i have questions
- https://steamcommunity.com/profiles/76561199091249086
Add Comment
Please, Sign In to add comment
Advertisement