From 1ff1a03c4cafae6d2b7a064f27023d480f8a8107 Mon Sep 17 00:00:00 2001
From: Someone <someone@somenet.org>
Date: Wed, 23 Oct 2024 15:14:09 +0200
Subject: [PATCH] RELEASE 2.0.2 - Better research queue handling when switching
 between researches

---
 changelog.txt | 7 +++++++
 control.lua   | 4 +++-
 info.json     | 7 ++++---
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/changelog.txt b/changelog.txt
index ee5c6a6..fd14a8c 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,10 @@
+---------------------------------------------------------------------------------------------------
+Version: 2.0.2
+Date: 2024-10-23
+
+  Changed:
+    - Better research queue handling when switching between researches.
+
 ---------------------------------------------------------------------------------------------------
 Version: 2.0.1
 Date: 2024-10-23
diff --git a/control.lua b/control.lua
index 7688dd8..f0080bb 100644
--- a/control.lua
+++ b/control.lua
@@ -222,7 +222,9 @@ function startNextResearch(force, override_spam_detection)
 
         for i=1,6 do
           if force.research_queue[i] == nil then break end
-          table.insert(rq, force.research_queue[i].name)
+          if not (force.current_research and config.allow_switching and i == 1) then
+            table.insert(rq, force.research_queue[i].name)
+          end
         end
 
         force.research_queue = rq
diff --git a/info.json b/info.json
index 4151d21..d8eae35 100644
--- a/info.json
+++ b/info.json
@@ -1,6 +1,6 @@
 {
     "name": "some-autoresearch",
-    "version": "2.0.1",
+    "version": "2.0.2",
     "title": "Auto Research (fixed + re-published)",
     "author": "Someone (originally canidae)",
     "homepage": "https://git.somenet.org/factorio/some-autoresearch.git",
@@ -9,7 +9,8 @@
     "dependencies": [
         "base>=2.0.0",
 
-      "! factorio-research-queue",
-      "! sonaxaton-research-queue"
+        "! auto-research",
+        "! factorio-research-queue",
+        "! sonaxaton-research-queue"
     ]
 }
-- 
2.43.0