From c2cfe2473189dfb304517d639a064e8b249ecda3 Mon Sep 17 00:00:00 2001
From: Someone <someone@somenet.org>
Date: Wed, 23 Oct 2024 11:47:52 +0200
Subject: [PATCH] RELEASE 2.0.1 - Fixed search + hopefully a desync

---
 changelog.txt | 7 +++++++
 control.lua   | 9 +++++----
 info.json     | 2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/changelog.txt b/changelog.txt
index 83f1c2b..ee5c6a6 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,10 @@
+---------------------------------------------------------------------------------------------------
+Version: 2.0.1
+Date: 2024-10-23
+
+  Changed:
+    - Fixed search + hopefully a desync.
+
 ---------------------------------------------------------------------------------------------------
 Version: 2.0.0
 Date: 2024-10-21
diff --git a/control.lua b/control.lua
index e34ea1c..7688dd8 100644
--- a/control.lua
+++ b/control.lua
@@ -215,13 +215,14 @@ function startNextResearch(force, override_spam_detection)
         end
     end
 
+    -- keep queue, just put next_research at the start.
     if next_research then
         local rq = {}
         table.insert(rq, next_research)
 
         for i=1,6 do
           if force.research_queue[i] == nil then break end
-          table.insert(rq, force.research_queue[i])
+          table.insert(rq, force.research_queue[i].name)
         end
 
         force.research_queue = rq
@@ -577,7 +578,7 @@ gui = {
                 --     -- show techs that match by localised name
                 --     showtech = true
                 else
-                    for _, effect in pairs(tech.effects) do
+                    for _, effect in pairs(tech.prototype.effects) do
                         if string.find(effect.type, text, 1, true) then
                             -- show techs that match by effect type
                             showtech = true
@@ -589,7 +590,7 @@ gui = {
                             --     -- show techs that match by unlocked recipe localised name
                             --     showtech = true
                             else
-                                for _, product in pairs(game.recipe_prototypes[effect.recipe].products) do
+                                for _, product in pairs(prototypes.recipe[effect.recipe].products) do
                                     if string.find(product.name, text, 1, true) then
                                         -- show techs that match by unlocked recipe product name
                                         showtech = true
@@ -597,7 +598,7 @@ gui = {
                                     --     -- show techs that match by unlocked recipe product localised name
                                     --     showtech = true
                                     else
-                                        local prototype = game.item_prototypes[product.name]
+                                        local prototype = prototypes.item[product.name]
                                         if prototype then
                                             if prototype.place_result then
                                                 if string.find(prototype.place_result.name, text, 1, true) then
diff --git a/info.json b/info.json
index 1b0508f..4151d21 100644
--- a/info.json
+++ b/info.json
@@ -1,6 +1,6 @@
 {
     "name": "some-autoresearch",
-    "version": "2.0.0",
+    "version": "2.0.1",
     "title": "Auto Research (fixed + re-published)",
     "author": "Someone (originally canidae)",
     "homepage": "https://git.somenet.org/factorio/some-autoresearch.git",
-- 
2.43.0