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