perf: compact only if needed
This commit is contained in:
parent
66968b0186
commit
be8ab78425
@ -1,9 +1,10 @@
|
||||
local turtleUtils = require('libs/turtle-utils')
|
||||
local config = require('config/harvesting')
|
||||
|
||||
local VERSION = "0.3.0"
|
||||
local VERSION = "0.3.1"
|
||||
local IDLE_TIME = 2
|
||||
local MIN_FUEL_NEEDED = (10 + config.firstCropZ + config.length) * 2
|
||||
local MIN_FREE_SLOTS_BEFORE_COMPACT = 4
|
||||
|
||||
-- UTILS
|
||||
|
||||
@ -128,8 +129,10 @@ local function harvestDown()
|
||||
error('turtle cannot place crop')
|
||||
end
|
||||
|
||||
if turtleUtils.countFreeSlots() < MIN_FREE_SLOTS_BEFORE_COMPACT then
|
||||
turtleUtils.compactInventory()
|
||||
end
|
||||
end
|
||||
|
||||
local function forward()
|
||||
if not turtle.forward() then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user