Add barrel sorting functionality with optional barrel name override
This commit is contained in:
@@ -2097,8 +2097,9 @@ end
|
||||
-- Barrel auto-sort
|
||||
-------------------------------------------------
|
||||
|
||||
local function sortBarrel()
|
||||
local barrel = peripheral.wrap(BARREL_NAME)
|
||||
local function sortBarrel(barrelOverride)
|
||||
local barrelTarget = (barrelOverride and barrelOverride ~= "") and barrelOverride or BARREL_NAME
|
||||
local barrel = peripheral.wrap(barrelTarget)
|
||||
if not barrel then return end
|
||||
|
||||
local contents = barrel.list()
|
||||
@@ -3181,6 +3182,10 @@ local function main()
|
||||
saveDisabledRecipes()
|
||||
smelterNeedsRedraw = true
|
||||
pcall(broadcastState)
|
||||
elseif message.type == "sort_barrel" and message.barrelName then
|
||||
print("[NET] Sort barrel: " .. message.barrelName)
|
||||
pcall(sortBarrel, message.barrelName)
|
||||
pcall(broadcastState)
|
||||
elseif message.type == "craft" and message.recipeIdx then
|
||||
print(string.format("[NET] Craft request: recipe #%d", message.recipeIdx))
|
||||
local ok, err = craftItem(message.recipeIdx)
|
||||
|
||||
Reference in New Issue
Block a user