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:
MayaTheShy
2026-03-22 20:20:07 -04:00
parent 85228b134b
commit ee76a61240
2 changed files with 6 additions and 1274 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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