feat(inferium-harvester): fetch the remote plan before getting the local plan

This commit is contained in:
Guillaume ARM 2024-05-21 23:39:12 +02:00
parent 11b6f140e1
commit 6071fdb6b4

View File

@ -3,7 +3,7 @@ local utils = require('libs/utils')
local turtleUtils = require('libs/turtle-utils')
local config = require('config/harvesting')
local VERSION = "2.2.0"
local VERSION = "2.3.0"
local INFERIUM_SERVER = 'inferium.com'
local IDLE_TIME = 2
local WAIT_ITEM_IDLE_TIME = 5
@ -399,6 +399,12 @@ local function replantSeeds()
end
local function replantProcedure()
local remotePlan = fetchRemotePlan()
if remotePlan == nil then
error('cannot fetch the remote plan')
end
if localPlan == nil then
retrieveLocalPlan()
end
@ -407,12 +413,6 @@ local function replantProcedure()
error('cannot retrieve the local plan')
end
local remotePlan = fetchRemotePlan()
if remotePlan == nil then
error('cannot fetch the remote plan')
end
local seedsToRemove = utils.shallowDiff(localPlan, remotePlan)
local seedsToPlant = utils.shallowDiff(remotePlan, localPlan)