SHOW:
|
|
- or go back to the newest paste.
1 | --[[ | |
2 | Title: Community goals screen | |
3 | Date: 4-29-21 | |
4 | creator: irnotbeowulf | |
5 | Description: When the item router collects an item. | |
6 | it is exported to the rs system. Then the contents | |
7 | of the rs system are written to the screen. A small | |
8 | delay has been added to be more server friendly. | |
9 | --]] | |
10 | -- Declare Peripherals | |
11 | barrel = "metalbarrels:diamond_tile_1" | |
12 | rsbridge = "rsBridge_1" | |
13 | router = "modularrouters:item_router_0" | |
14 | playerDetector = "playerDetector_1" | |
15 | chatBox = "chatBox_1" | |
16 | -- Wrap Peripherals | |
17 | inv = peripheral.wrap(barrel) | |
18 | rtr = peripheral.wrap(router) | |
19 | chat = peripheral.wrap(chatBox) | |
20 | mon = peripheral.find("monitor") | |
21 | rsb = peripheral.wrap(rsbridge) | |
22 | player = peripheral.wrap(playerDetector) | |
23 | ||
24 | item = inv.getItemDetail | |
25 | input = rtr.getItemDetail | |
26 | ||
27 | local function eject() | |
28 | rs.setAnalogOutput("right",5) | |
29 | sleep(3) | |
30 | rs.setAnalogOutput("right",0) | |
31 | return | |
32 | end | |
33 | local function newLine() | |
34 | local _,cY=mon.getCursorPos() | |
35 | mon.setCursorPos(1, cY+1) | |
36 | end | |
37 | ||
38 | local function writeInventory() | |
39 | if input(1) then | |
40 | rsb.importItemFromChest(input(1), router) | |
41 | local itemList = rsb.listItems() | |
42 | mon.clear() | |
43 | mon.setCursorPos(1,1) | |
44 | for i=1, #itemList do | |
45 | mon.write(itemList[i].displayName.. " = ".. itemList[i].amount) | |
46 | newLine() | |
47 | end | |
48 | end | |
49 | end | |
50 | writeInventory() | |
51 | ||
52 | while true do | |
53 | writeInventory() | |
54 | sleep(1) | |
55 | end |