diff --git a/config/harvesting.lua b/config/harvesting.lua index 282c591..8af9e2b 100644 --- a/config/harvesting.lua +++ b/config/harvesting.lua @@ -1,21 +1,4 @@ -local function mystical(essenceName) - return 'mysticalagriculture:' .. essenceName .. '_seeds' -end - --- FALLBACK WHEN CANNOT FETCH THE REMOTE PLAN -local DEFAULT_REMOTE_PLAN = { - mystical('coal'), - mystical('inferium'), - mystical('inferium'), - mystical('inferium'), - mystical('inferium'), - mystical('inferium'), - mystical('inferium'), - mystical('inferium') -} - return { length = 8, - firstCropZ = 2, - defaultRemotePlan = DEFAULT_REMOTE_PLAN + firstCropZ = 2 } diff --git a/inferium-harvester.lua b/inferium-harvester.lua index 2100d9e..21ba859 100644 --- a/inferium-harvester.lua +++ b/inferium-harvester.lua @@ -263,14 +263,12 @@ local function retrieveLocalPlan() goBackToHome() end --- TODO: fetch timeout ? +-- TODO: fetch retry + timeout ? local function fetchRemotePlan() - local fallbackPlan = config.defaultRemotePlan or {} - local modem = peripheral.find("modem") if not modem then - return fallbackPlan + error('no modem found') end modem.open(INFERIUM_REPLY_PORT) @@ -286,7 +284,7 @@ local function fetchRemotePlan() modem.close(INFERIUM_REPLY_PORT) if not replyRawMessage then - return fallbackPlan + error('empty response from the server') end local replyMessage = textutils.unserialize(replyRawMessage) @@ -295,7 +293,7 @@ local function fetchRemotePlan() return replyMessage.payload end - return fallbackPlan + error('message received but there is no payload: ' .. replyRawMessage) end local function removeSeeds(seeds)