SHOW:
|
|
- or go back to the newest paste.
1 | - | local PORT = 666 |
1 | + | local PORT = 666 |
2 | - | local COMP = "586ce2fa-dd5f-4b3f-b2a7-235f6fb921e3" |
2 | + | local COMP = "586ce2fa-dd5f-4b3f-b2a7-235f6fb921e3" |
3 | - | --- |
3 | + | --- |
4 | - | local com = require("component") |
4 | + | local com = require("component") |
5 | - | local inv = com.inventory_controller |
5 | + | local inv = com.inventory_controller |
6 | - | local modem = com.modem |
6 | + | local modem = com.modem |
7 | - | local ser = require("serialization") |
7 | + | local ser = require("serialization") |
8 | - | --- |
8 | + | --- |
9 | - | |
9 | + | |
10 | - | print("Программа сканирования рецептов") |
10 | + | print("Программа сканирования рецептов") |
11 | - | print("Убедитесь, что принимающий компьютер готов") |
11 | + | print("Убедитесь, что принимающий компьютер готов") |
12 | - | os.sleep(1) |
12 | + | os.sleep(1) |
13 | - | io.write("\nСканирование...") |
13 | + | io.write("\nСканирование...") |
14 | - | local recipe = {} |
14 | + | local recipe = {} |
15 | - | for i = 1, 9, 1 do |
15 | + | for i = 1, 9, 1 do |
16 | - | local slot = i + (math.floor(i - 1) / 3) |
16 | + | local slot = i + (math.floor(i - 1) / 3) |
17 | - | local stack = inv.getStackInInternalSlot(slot) |
17 | + | local stack = inv.getStackInInternalSlot(slot) |
18 | - | if stack == nil then stack = "" end |
18 | + | if stack == nil then stack = "" end |
19 | - | table.insert(recipe, stack) |
19 | + | table.insert(recipe, stack) |
20 | - | end |
20 | + | end |
21 | - | table.insert(recipe, inv.getStackInInternalSlot(8)) |
21 | + | table.insert(recipe, inv.getStackInInternalSlot(8)) |
22 | print(" [OK]") | |
23 | - | io.write("Передача данных...") |
23 | + | io.write("Передача данных...") |
24 | - | |
24 | + | |
25 | - | local toSend = ser.serialize(recipe) |
25 | + | local toSend = ser.serialize(recipe) |
26 | - | modem.send(COMP, PORT, toSend) |
26 | + | modem.send(COMP, PORT, toSend) |
27 | print(" [OK]") |