update RA tutorial
This commit is contained in:
parent
e2737bbe08
commit
bddf4c8e9b
1 changed files with 39 additions and 32 deletions
71
readme.md
71
readme.md
|
|
@ -81,36 +81,43 @@ You can also run `wget run https://files.sad.ovh/public/storage-solution/.beta-i
|
||||||
## RA
|
## RA
|
||||||
SiSS has a remote access system that allows you to access your items via modem.
|
SiSS has a remote access system that allows you to access your items via modem.
|
||||||
To use it, first set up your config.lua correctly. After that you need to implement the tiny_ra_library into your program.
|
To use it, first set up your config.lua correctly. After that you need to implement the tiny_ra_library into your program.
|
||||||
You can download it by using `wget https://git.sad.ovh/sophie/storage-solution/raw/branch/main/tiny_ra_library.lua`.
|
You can download it by downloading SiSS itself, and importing.
|
||||||
|
```
|
||||||
Example program:
|
package.path = package.path .. ";/storage-solution/?.lua"
|
||||||
```lua
|
|
||||||
local ra = require("tiny_ra_library")
|
local ra = require("storage-solution/tiny_ra_library")
|
||||||
local modem = peripheral.find("modem")
|
```
|
||||||
|
|
||||||
-- modem, port, password
|
|
||||||
ra.init(modem, 42420, "test123")
|
Example program (takes sand out of your inventory while you're farming sand):
|
||||||
|
```lua
|
||||||
print("withdraws 64 of dirt")
|
package.path = package.path .. ";/storage-solution/?.lua"
|
||||||
ra.withdraw("minecraft:dirt")
|
local ra = require("storage-solution/tiny_ra_library")
|
||||||
sleep(2)
|
|
||||||
|
local modules = peripheral.wrap("back")
|
||||||
print("deposits 64 of dirt")
|
local inv = modules.getInventory()
|
||||||
ra.depositByItemName("minecraft:dirt")
|
|
||||||
sleep(2)
|
local yourManipulator = "manipulator_76"
|
||||||
|
|
||||||
print("withdraws 12 dirt")
|
--- use any registered enderstorage, it'll work the exact same
|
||||||
ra.withdraw("minecraft:dirt", 12)
|
ra.init(peripheral.find("modem"), 00000, "my_password")
|
||||||
sleep(2)
|
|
||||||
|
while true do
|
||||||
print("deposits the first slot")
|
|
||||||
ra.depositBySlots({1})
|
local yes = false
|
||||||
sleep(2)
|
local amount = 0
|
||||||
|
for _, item in pairs(inv.list()) do
|
||||||
print("withdraws 32 dirt")
|
if item.name == "minecraft:sand" then
|
||||||
ra.withdraw("minecraft:dirt", 32)
|
yes = true
|
||||||
sleep(2)
|
amount = amount + item.count
|
||||||
|
end
|
||||||
print("deposits 16 items from the first slot")
|
end
|
||||||
ra.depositBySlots({1}, 16)
|
|
||||||
|
if yes and amount > 100 then
|
||||||
|
print("Moved " .. tostring(amount) .. " of sand.")
|
||||||
|
ra.depositFromManipulator(yourManipulator, "minecraft:sand", amount, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
sleep(1)
|
||||||
|
end
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue