Refactor turtle status check in smelter page
- Updated the turtle status check logic to use ctx.craftTurtleOk for determining if the crafting turtle is available. - Adjusted the logic to fall back on checking ctx.craftTurtleName and its peripheral presence if ctx.craftTurtleOk is not set.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -958,8 +958,9 @@ local function buildSmelterPage()
|
||||
turtleStatus = UI.Window {
|
||||
x = -14, y = 0, width = 14, height = 1,
|
||||
draw = function(self)
|
||||
local turtleOk = ctx.craftTurtleName
|
||||
and peripheral.isPresent(ctx.craftTurtleName)
|
||||
local turtleOk = ctx.craftTurtleOk
|
||||
or (ctx.craftTurtleName
|
||||
and peripheral.isPresent(ctx.craftTurtleName))
|
||||
local label = turtleOk and " Turtle OK " or " No Turtle "
|
||||
local bg = turtleOk and colors.lime or colors.red
|
||||
local fg = turtleOk and colors.black or colors.white
|
||||
@@ -1140,8 +1141,9 @@ local function buildSmelterPage()
|
||||
local recipeIdx = event.selected.idx
|
||||
local recipe = cfg.CRAFTABLE[recipeIdx]
|
||||
if recipe then
|
||||
local turtleOk = ctx.craftTurtleName
|
||||
and peripheral.isPresent(ctx.craftTurtleName)
|
||||
local turtleOk = ctx.craftTurtleOk
|
||||
or (ctx.craftTurtleName
|
||||
and peripheral.isPresent(ctx.craftTurtleName))
|
||||
if not turtleOk then
|
||||
self.notification:error("No crafting turtle!")
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user