feat(inferium-harvester): fetch the remote plan before getting the local plan
This commit is contained in:
parent
11b6f140e1
commit
6071fdb6b4
@ -3,7 +3,7 @@ local utils = require('libs/utils')
|
|||||||
local turtleUtils = require('libs/turtle-utils')
|
local turtleUtils = require('libs/turtle-utils')
|
||||||
local config = require('config/harvesting')
|
local config = require('config/harvesting')
|
||||||
|
|
||||||
local VERSION = "2.2.0"
|
local VERSION = "2.3.0"
|
||||||
local INFERIUM_SERVER = 'inferium.com'
|
local INFERIUM_SERVER = 'inferium.com'
|
||||||
local IDLE_TIME = 2
|
local IDLE_TIME = 2
|
||||||
local WAIT_ITEM_IDLE_TIME = 5
|
local WAIT_ITEM_IDLE_TIME = 5
|
||||||
@ -399,6 +399,12 @@ local function replantSeeds()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function replantProcedure()
|
local function replantProcedure()
|
||||||
|
local remotePlan = fetchRemotePlan()
|
||||||
|
|
||||||
|
if remotePlan == nil then
|
||||||
|
error('cannot fetch the remote plan')
|
||||||
|
end
|
||||||
|
|
||||||
if localPlan == nil then
|
if localPlan == nil then
|
||||||
retrieveLocalPlan()
|
retrieveLocalPlan()
|
||||||
end
|
end
|
||||||
@ -407,12 +413,6 @@ local function replantProcedure()
|
|||||||
error('cannot retrieve the local plan')
|
error('cannot retrieve the local plan')
|
||||||
end
|
end
|
||||||
|
|
||||||
local remotePlan = fetchRemotePlan()
|
|
||||||
|
|
||||||
if remotePlan == nil then
|
|
||||||
error('cannot fetch the remote plan')
|
|
||||||
end
|
|
||||||
|
|
||||||
local seedsToRemove = utils.shallowDiff(localPlan, remotePlan)
|
local seedsToRemove = utils.shallowDiff(localPlan, remotePlan)
|
||||||
local seedsToPlant = utils.shallowDiff(remotePlan, localPlan)
|
local seedsToPlant = utils.shallowDiff(remotePlan, localPlan)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user