mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
refactor(turtle_miner): 移除不必要的延迟以提升效率
移除了挖掘过程中的os.sleep调用,这些延迟对于功能并非必需且影响性能。保留必要的延迟以避免CPU占用过高。
This commit is contained in:
@@ -271,18 +271,18 @@ local function startMining()
|
|||||||
print("Mining...")
|
print("Mining...")
|
||||||
turtle.dig()
|
turtle.dig()
|
||||||
-- 检查是否有掉落物需要捡起
|
-- 检查是否有掉落物需要捡起
|
||||||
_G.os.sleep(0.5)
|
-- os.sleep(0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 检查上方是否有方块可以挖掘
|
-- 检查上方是否有方块可以挖掘
|
||||||
if turtle.detectUp() then
|
if turtle.detectUp() then
|
||||||
print("Mining above...")
|
print("Mining above...")
|
||||||
turtle.digUp()
|
turtle.digUp()
|
||||||
_G.os.sleep(0.5)
|
-- os.sleep(0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 短暂延迟避免CPU占用过高
|
-- 短暂延迟避免CPU占用过高
|
||||||
_G.os.sleep(0.1)
|
-- os.sleep(0.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
print(colors.yellow .. "Auto mining stopped." .. colors.white)
|
print(colors.yellow .. "Auto mining stopped." .. colors.white)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
-- LeonOS installer
|
-- LeonOS installer
|
||||||
local INSTALLER_VERSION = "0.3.8 Beta 10"
|
local INSTALLER_VERSION = "0.3.8 Beta 11"
|
||||||
local DEFAULT_ROM_DIR = "/leonos"
|
local DEFAULT_ROM_DIR = "/leonos"
|
||||||
|
|
||||||
print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")
|
print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")
|
||||||
|
|||||||
Reference in New Issue
Block a user