first commit

This commit is contained in:
Soph :3 2025-11-11 17:58:10 +02:00
commit d533cad870
12 changed files with 2726 additions and 0 deletions

42
src/main.lua Normal file
View file

@ -0,0 +1,42 @@
---@class Config
---@field inventories string[]
---@field import string[]|nil
---@field chatbox table<string, string>|nil
local inv = require("modules.inv")
local ui = require("modules.ui")
local chatbox = require("modules.chatbox")
local config = require("../config") ---@type Config
local function importMechanism()
if config.import == nil then
return
end
if #config.import == 0 then
return
end
while true do
for _, import_from_inv in ipairs(config.import) do
---@type ccTweaked.peripheral.Inventory
local perip = peripheral.wrap(import_from_inv)
if perip and perip.size then
local slotsToSend = {}
for slot = 1, perip.size() do
local item = perip.getItemDetail(slot)
if item then
table.insert(slotsToSend, slot)
end
end
if #slotsToSend > 0 then
inv.sendItemAwayMultiple(slotsToSend, perip, import_from_inv)
end
end
end
sleep(0.1)
end
end
inv.sync()
parallel.waitForAll(chatbox.run, inv.getAIL().run, importMechanism, ui.runUi, inv.detectPlayerInsert)