Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glass = peripheral.wrap("top")
- item = peripheral.wrap("right")
- rednet.open( "back" )
- -- We always reset when starting back up
- glass.clear()
- container = glass.addBox( 10, 10, 102, 30, 0x000000, 0.3 )
- helpText = glass.addText( 27, 15, "Items queued: ", 0xFFFFFF )
- itemCount = glass.addText( 45, 25, "0", 0xFFFFFF )
- timeText = glass.addText( 457, 75, " ", 0xFFFFFF )
- -- Various settings go here, the ones that won't change
- timeText.setScale( 0.6 )
- -- Fancy borders
- borderTop = glass.addBox( 11, 45, 100, 1, 0x000000, 1 )
- borderLeft = glass.addBox( 10, 45, 1, 7, 0x000000, 1 )
- borderRight = glass.addBox( 111, 45, 1, 7, 0x000000, 1 )
- borderBottom = glass.addBox( 11, 51, 100, 1, 0x000000, 1 )
- -- Quarry status
- statusQuarry = glass.addText( 40, 55, "Quarry", 0xFF0000 )
- while true do
- items = 0
- types = 0
- device = ""
- senderID, message, distance = rednet.receive()
- print( senderID .. ": " .. message )
- for i in string.gmatch( message, "%S+" ) do
- if not device then
- device = i
- else
- if i == "off" then
- statusQuarry.setColor( 0x229000 )
- else
- statusQuarry.setColor( 0xFF0000 )
- end
- end
- end
- rednet.broadcast( "get quarry" )
- local time = os.time()
- time = textutils.formatTime( time, true )
- timeText.setText( " " .. time )
- itemList = item.list(5)
- for key,value in pairs( itemList ) do
- types = types + 1
- items = items + value
- end
- itemCount.setText( " " .. types .. " (" .. items .. ")" )
- -- Here we calculate a percentage of the item pressure
- -- Color code the count text
- if types < 3 then
- itemCount.setColor( 0x229000 )
- elseif items < 7 then
- itemCount.setColor( 0x00FFFF )
- elseif items < 15 then
- itemCount.setColor( 0xFFFF00 )
- else
- itemCount.setColor( 0xFF0000 )
- end
- sleep(1)
- end
- rednet.close( "back" )
Advertisement
Add Comment
Please, Sign In to add comment