fix(turtle_miner): 将os.sleep替换为_G.os.sleep以避免全局变量冲突

修改turtle_miner.lua中的os.sleep调用为_G.os.sleep,确保在可能存在全局变量os被覆盖的环境中仍能正常工作。这解决了在某些情况下可能出现的函数调用失败问题。
This commit is contained in:
2025-09-05 19:26:08 +08:00
parent 23517f2b53
commit 67deb425bf
2 changed files with 4 additions and 4 deletions

View File

@@ -271,18 +271,18 @@ local function startMining()
print("Mining...")
turtle.dig()
-- 检查是否有掉落物需要捡起
os.sleep(0.5)
_G.os.sleep(0.5)
end
-- 检查上方是否有方块可以挖掘
if turtle.detectUp() then
print("Mining above...")
turtle.digUp()
os.sleep(0.5)
_G.os.sleep(0.5)
end
-- 短暂延迟避免CPU占用过高
os.sleep(0.1)
_G.os.sleep(0.1)
end
print(colors.yellow .. "Auto mining stopped." .. colors.white)

View File

@@ -1,5 +1,5 @@
-- LeonOS installer
local INSTALLER_VERSION = "0.3.8 Beta 9"
local INSTALLER_VERSION = "0.3.8 Beta 10"
local DEFAULT_ROM_DIR = "/leonos"
print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")