Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Call Functions
- function Init_Addons()
- -- Global Variables
- hasMODEM = false
- hasMONITOR = false
- hasPRINTER = false
- -- Checkside: Variables
- local addonTOP = peripheral.getType("top")
- local addonBOTTOM = peripheral.getType("bottom")
- local addonLEFT = peripheral.getType("left")
- local addonRIGHT = peripheral.getType("right")
- local addonFRONT = peripheral.getType("front")
- local addonBACK = peripheral.getType("back")
- -- Peripheral Initializers
- local peripheralMODEM = nil
- local peripheralMONITOR = nil
- local peripheralPRINTER = nil
- -- Other Types of Peripherals:
- -- computer
- -- turtle
- -- drive
- -- if "Top" Slot is Occupied
- if peripheral.isPresent("top") then
- -- Check Top for Modem
- if addonTOP == "modem" then
- peripheralMODEM = "top"
- hasMODEM = true
- print("Modem detected on Node: " ..peripheralMODEM)
- end
- -- Check Top for Monitor
- if addonTOP == "monitor" then
- peripheralMONITOR = "top"
- hasMONITOR = true
- print("Monitor detected on Node: " ..peripheralMONITOR)
- end
- -- Check Top for Printer
- if addonTOP == "printer" then
- peripheralPRINTER = "top"
- hasPRINTER = true
- print("Printer detected on Node: " ..peripheralPRINTER)
- end
- end
- -- if "Bottom" Slot is Occupied
- if peripheral.isPresent("bottom") then
- -- Check Bottom for Modem
- if addonBOTTOM == "modem" then
- peripheralMODEM = "bottom"
- hasMODEM = true
- print("Modem detected on Node: " ..peripheralMODEM)
- end
- -- Check Bottom for Monitor
- if addonBOTTOM == "monitor" then
- peripheralMONITOR = "bottom"
- hasMONITOR = true
- print("Monitor detected on Node: " ..peripheralMONITOR)
- end
- -- Check Bottom for Printer
- if addonBOTTOM == "printer" then
- peripheralPRINTER = "bottom"
- hasPRINTER = true
- print("Printer detected on Node: " ..peripheralPRINTER)
- end
- end
- -- if "Left" Slot is Occupied
- if peripheral.isPresent("left") then
- -- Check Left for Modem
- if addonLEFT == "modem" then
- peripheralMODEM = "left"
- hasMODEM = true
- print("Modem detected on Node: " ..peripheralMODEM)
- end
- -- Check Left for Monitor
- if addonLEFT == "monitor" then
- peripheralMONITOR = "left"
- hasMONITOR = true
- print("Monitor detected on Node: " ..peripheralMONITOR)
- end
- -- Check Left for Printer
- if addonLEFT == "printer" then
- peripheralPRINTER = "left"
- hasPRINTER = true
- print("Printer detected on Node: " ..peripheralPRINTER)
- end
- end
- -- if "Right" Slot is Occupied
- if peripheral.isPresent("right") then
- -- Check Right for Modem
- if addonRIGHT == "modem" then
- peripheralMODEM = "right"
- hasMODEM = true
- print("Modem detected on Node: " ..peripheralMODEM)
- end
- -- Check Right for Monitor
- if addonRIGHT == "monitor" then
- peripheralMONITOR = "right"
- hasMONITOR = true
- print("Monitor detected on Node: " ..peripheralMONITOR)
- end
- -- Check Right for Printer
- if addonRIGHT == "printer" then
- peripheralPRINTER = "right"
- hasPRINTER = true
- print("Printer detected on Node: " ..peripheralPRINTER)
- end
- end
- -- if "Front" Slot is Occupied
- if peripheral.isPresent("front") then
- -- Check Front for Modem
- if addonFRONT == "modem" then
- peripheralMODEM = "front"
- hasMODEM = true
- print("Modem detected on Node: " ..peripheralMODEM)
- end
- -- Check Front for Monitor
- if addonFRONT == "monitor" then
- peripheralMONITOR = "front"
- hasMONITOR = true
- print("Monitor detected on Node: " ..peripheralMONITOR)
- end
- -- Check Front for Printer
- if addonFRONT == "printer" then
- peripheralPRINTER = "front"
- hasPRINTER = true
- print("Printer detected on Node: " ..peripheralPRINTER)
- end
- end
- -- if "Back" Slot is Occupied
- if peripheral.isPresent("back") then
- -- Check Back for Modem
- if addonBACK == "modem" then
- peripheralMODEM = "back"
- hasMODEM = true
- print("Modem detected on Node: " ..peripheralMODEM)
- end
- -- Check Back for Monitor
- if addonBACK == "monitor" then
- peripheralMONITOR = "back"
- hasMONITOR = true
- print("Monitor detected on Node: " ..peripheralMONITOR)
- end
- -- Check Back for Printer
- if addonBACK == "printer" then
- peripheralPRINTER = "back"
- hasPRINTER = true
- print("Printer detected on Node: " ..peripheralPRINTER)
- end
- end
- -- Initialize Hardware
- if hasMODEM then
- rednet.close(peripheralMODEM)
- rednet.open(peripheralMODEM)
- end
- if hasMONITOR then
- Monitor = peripheral.wrap(peripheralMONITOR)
- Monitor.clear()
- Monitor.setCursorPos(1,1)
- Monitor.write("MoseOS is Online.")
- end
- if hasPRINTER then
- Printer = peripheral.wrap(peripheralPrinter)
- end
- -- End of Function
- end
- function Init_Wireless_Machines()
- rednet.broadcast("Initialize")
- print("Connecting to Rednet.")
- if hasMONITOR then
- Monitor.setCursorPos(1,2)
- Monitor.write("Connecting to Rednet.")
- end
- end
- -- Runtime
- Init_Addons()
- if hasMODEM then
- Init_Wireless_Machines()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement