From 6071fdb6b45c0f1fe1857ded4e1d8157667f7309 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Tue, 21 May 2024 23:39:12 +0200 Subject: [PATCH] feat(inferium-harvester): fetch the remote plan before getting the local plan --- inferium-harvester.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/inferium-harvester.lua b/inferium-harvester.lua index f47b244..0827817 100644 --- a/inferium-harvester.lua +++ b/inferium-harvester.lua @@ -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)