SHOW:
|
|
- or go back to the newest paste.
1 | //https://mcskill.net/mcforum/index.php?/topic/119757-opencomputers-%D0%B8%D0%B7%D0%B2%D0%BB%D0%B5%D1%87%D0%B5%D0%BD%D0%B8%D0%B5-%D1%81%D1%83%D0%BC%D0%BE%D0%BA-%D0%B8-%D0%BF%D1%80%D0%BE%D1%87%D0%B5%D0%B3%D0%BE-%D1%85%D0%BB%D0%B0%D0%BC%D0%B0-%D1%81-%D0%BA%D1%83%D1%87%D0%B5%D0%B9-nbt-%D1%82%D0%B5%D0%B3%D0%BE%D0%B2-%D0%B8%D0%B7-%D0%BC%D1%8D/ | |
2 | ||
3 | ||
4 | local component = require("component") | |
5 | local db = component.database | |
6 | local exportbus = component.me_exportbus | |
7 | local controller = component.me_controller | |
8 | local args = {...} | |
9 | local item = args[1] | |
10 | ||
11 | ||
12 | local function getDbSize() | |
13 | if not pcall(function() db.get(10) end) then | |
14 | return 9 | |
15 | elseif not pcall(function() db.get(26) end) then | |
16 | return 25 | |
17 | else | |
18 | return 81 | |
19 | end | |
20 | end | |
21 | ||
22 | ||
23 | local function noneItemID() | |
24 | if item == nil then | |
25 | print("Enter the object ID as an argument. For example: rescue minecraft:axe") | |
26 | return true | |
27 | end | |
28 | end | |
29 | ||
30 | ||
31 | local function mainExport() | |
32 | for i = 1, getDbSize() do | |
33 | db.clear(i) | |
34 | end | |
35 | end | |
36 | ||
37 | ||
38 | local function setExportConfig() | |
39 | controller.store({name = item}, db.addres, 1, 1) | |
40 | for i=1,6 do | |
41 | if exportbus.setExportConfiguration(i, 1, db.address, 1) then | |
42 | break | |
43 | end | |
44 | end | |
45 | end | |
46 | ||
47 | checkItem = controller.getItemsInNetwork({name = item}).n | |
48 | ||
49 | if checkItem == 0 then | |
50 | print("You have 0 items. Programm stops. Cooldown is approx. 1 min.") | |
51 | else | |
52 | print("You have", checkItem, "items. Be patient... Export will start soon...") | |
53 | for i = 1, checkItem do | |
54 | if noneItemID() then break end | |
55 | setExportConfig() | |
56 | mainExport() | |
57 | end | |
58 | print("Check the storage.") | |
59 | end |