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
|
||||
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.
|
||||
You can download it by using `wget https://git.sad.ovh/sophie/storage-solution/raw/branch/main/tiny_ra_library.lua`.
|
||||
|
||||
Example program:
|
||||
```lua
|
||||
local ra = require("tiny_ra_library")
|
||||
local modem = peripheral.find("modem")
|
||||
|
||||
-- modem, port, password
|
||||
ra.init(modem, 42420, "test123")
|
||||
|
||||
print("withdraws 64 of dirt")
|
||||
ra.withdraw("minecraft:dirt")
|
||||
sleep(2)
|
||||
|
||||
print("deposits 64 of dirt")
|
||||
ra.depositByItemName("minecraft:dirt")
|
||||
sleep(2)
|
||||
|
||||
print("withdraws 12 dirt")
|
||||
ra.withdraw("minecraft:dirt", 12)
|
||||
sleep(2)
|
||||
|
||||
print("deposits the first slot")
|
||||
ra.depositBySlots({1})
|
||||
sleep(2)
|
||||
|
||||
print("withdraws 32 dirt")
|
||||
ra.withdraw("minecraft:dirt", 32)
|
||||
sleep(2)
|
||||
|
||||
print("deposits 16 items from the first slot")
|
||||
ra.depositBySlots({1}, 16)
|
||||
You can download it by downloading SiSS itself, and importing.
|
||||
```
|
||||
package.path = package.path .. ";/storage-solution/?.lua"
|
||||
|
||||
local ra = require("storage-solution/tiny_ra_library")
|
||||
```
|
||||
|
||||
|
||||
Example program (takes sand out of your inventory while you're farming sand):
|
||||
```lua
|
||||
package.path = package.path .. ";/storage-solution/?.lua"
|
||||
local ra = require("storage-solution/tiny_ra_library")
|
||||
|
||||
local modules = peripheral.wrap("back")
|
||||
local inv = modules.getInventory()
|
||||
|
||||
local yourManipulator = "manipulator_76"
|
||||
|
||||
--- use any registered enderstorage, it'll work the exact same
|
||||
ra.init(peripheral.find("modem"), 00000, "my_password")
|
||||
|
||||
while true do
|
||||
|
||||
local yes = false
|
||||
local amount = 0
|
||||
for _, item in pairs(inv.list()) do
|
||||
if item.name == "minecraft:sand" then
|
||||
yes = true
|
||||
amount = amount + item.count
|
||||
end
|
||||
end
|
||||
|
||||
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