fix: simplify crafting turtle detection logic by removing unnecessary method checks

This commit is contained in:
MayaTheShy
2026-03-22 22:19:08 -04:00
parent 904d4ec7f7
commit f095e18e95

View File

@@ -224,20 +224,13 @@ local function main()
log.warn("INIT", "No modem found for client sync")
end
-- Detect crafting turtle on network (must have craft() method)
-- Detect crafting turtle on network
-- The actual craft message goes on CRAFT_CHANNEL which only the crafting
-- turtle listens to, so we just need any turtle name for presence checks.
for _, name in ipairs(peripheral.getNames()) do
if name:match("^turtle_") then
local methods = peripheral.getMethods(name)
if methods then
local hasCraft = false
for _, m in ipairs(methods) do
if m == "craft" then hasCraft = true; break end
end
if hasCraft then
ctx.craftTurtleName = name
break
end
end
ctx.craftTurtleName = name
break
end
end
if ctx.craftTurtleName then