Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this program for CC: Tweaked is a Travel manager for a Tablet to overlook the operations of a Create Train system
- --HIGHLY WIP
- Settings_TrainID = 0
- Settings_TrainState = "Standby"
- Settings_TabletState = "Ready"
- Settings_CurrentStation = "unknown"
- Settings_TargetDestination[0,0]
- --Temp
- Train_X = 0
- Train_Y = 0
- Train_Z = 0
- Point_X = []
- Point_Y = []
- start()
- function start()
- TabletBootManager()
- GPSManager()
- if Settings_TrainState == "Standby" then
- Point_X[0] = Train_X
- Point_Z[0] = Train_Z
- end
- Menu()
- end
- function Menu()
- term.clear()
- term.setCursorPos(1,1)
- print("MAIN MENU")
- print("PLEASE CHOOSE AN OPTION")
- print("1 = Travel Map")
- print("2 = Train Logs")
- print("3 = Train Manager")
- print("4 = Resync Train")
- local event, key = os.pullEvent("key")
- while true do
- TrainManager()
- if key == keys.1 then
- TravelMenu()
- else if key == keys.2 then
- TrainLogsMenu()
- else if key == keys.3 then
- else if key == keys.4 then
- end
- end
- end
- function TravelMenu()
- term.clear()
- term.setCursorPos(1,1)
- print("To return to menu, press M")
- print("Travel Map")
- MapDrawer()
- local event, key = os.pullEvent("key")
- while true do
- if key == keys.m then
- Menu()
- end
- end
- end
- function TrainLogsMenu()
- end
- function TravelManager()
- local I = #Point_X
- GPSManager()
- Point_X[I] = Train_X
- Point_Z[I] = Train_Z
- end
- function TrainManager()
- sleep(10)
- if Settings_TrainState == "Moving" then
- TravelManager()
- PathCorrector()
- end
- end
- function PathCorrector()
- end
- function MapDrawer()
- for i = 1, #Point_X do
- paintutils.drawPoint(Point_X[i],Point_Z[i],colors.blue)
- end
- paintutils.drawPoint(Train_X,Train_Z,Colors.red)
- end
- function GPSManager()
- locate([timeout=2 [,debug=false]])
- Train_X = x
- Train_Y = y
- Train_Z = z
- end
- function NetworkManager(Action,Target,Signal)
- end
- function TabletBootManager()
- local h = fs.open(".TrainSettings","r")
- Settings_TrainState = h.readline(1)
- Settings_CurrentStation = h.readline(2)
- Settings_TrainID = h.readline(3)
- Settings_NextStation = h.readline(4)
- h.close()
- end
Add Comment
Please, Sign In to add comment