Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Inventory Manager (Receiver)
- Written by TheShadow989
- ]]--
- --[[
- Modem Channels (Inverse of Sender)
- senderChannel = Unique channel number used for modem communication.
- replyChannel = Unique channel for this computer to reply back.
- ]]--
- local senderChannel = 1
- local replyChannel = 2
- -- Working Variables (DO NOT CHANGE)
- local sides = {"top", "bottom", "left", "right", "front", "back"}
- local modem = "" -- Modem
- --Find Modem Side
- for i=1, #sides do
- if peripheral.isPresent(sides[i]) then
- if peripheral.getType(sides[i]) == "modem" then
- modem = sides[i]
- end
- end
- end
- -- Sender Channel
- modem.open(senderChannel)
- --------------------------------------------------------------------------
- -- PROGRAM LOOP
- --------------------------------------------------------------------------
- while true do
- local e = {os.pullEvent()}
- if e[1] == "modem_message" and e[3] == senderChannel then
- local message
- local index = 1
- for str in string.gmatch(e[5], "[^;]+") do
- message[index] = str
- index = index + 1
- end
- if message[1] == "Mob" then
- if message[2] == "ON" then
- redstone.setBundledOutput("back", colors.combine(redstone.getBundledOutput("back"), colors.red))
- else
- redstone.setBundledOutput("back", colors.subtract(redstone.getBundledOutput("back"), colors.red))
- end
- elseif message[1] == "Mining" then
- if message[2] == "ON" then
- redstone.setBundledOutput("back", colors.combine(redstone.getBundledOutput("back"), colors.blue))
- else
- redstone.setBundledOutput("back", colors.subtract(redstone.getBundledOutput("back"), colors.blue))
- end
- elseif message[1] == "Option3" then
- if message[2] == "ON" then
- redstone.setBundledOutput("back", colors.combine(redstone.getBundledOutput("back"), colors.yellow))
- else
- redstone.setBundledOutput("back", colors.subtract(redstone.getBundledOutput("back"), colors.yellow))
- end
- elseif message[1] == "Option4" then
- if message[2] == "ON" then
- redstone.setBundledOutput("back", colors.combine(redstone.getBundledOutput("back"), colors.orange))
- else
- redstone.setBundledOutput("back", colors.subtract(redstone.getBundledOutput("back"), colors.orange))
- end
- elseif message[1] == "Option5" then
- if message[2] == "ON" then
- redstone.setBundledOutput("back", colors.combine(redstone.getBundledOutput("back"), colors.green))
- else
- redstone.setBundledOutput("back", colors.subtract(redstone.getBundledOutput("back"), colors.green))
- end
- end
- modem.transmit(replyChannel, senderChannel, message[1] + ";" + message[2])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement