Deadlock Stacking For Bobs


Add stacked items for Bob's

4 months ago
0.18 - 1.1
11.6K

b Some raw material recipes not stacked at first tier

3 years ago

The raw material recipes that are unlocked without any tech research, then later get additional recipes with tech research can not be stacked until the second recipe is unlocked. At the moment copper-plate and lead-plate are the only two that come to mind.

You get a second copper-plate recipe with cobalt-processing, and another lead-plate recipe with lead-processing. This shadows the tech defined in items.lua such that copper-plate cannot be stacked until you research cobalt-processing, and lead cannot-be stacked until you research lead-processing. Here is a patch that resolves this and the incorrect stack icons from https://mods.factorio.com/mod/DeadlockStackingForBobs/discussion/5fe4ba15122234f86f4088c6

diff --git a/dist/data-final-fixes.lua b/dist/data-final-fixes.lua
index 9ccd97f..6d3da24 100644
--- a/dist/data-final-fixes.lua
+++ b/dist/data-final-fixes.lua
@@ -118,6 +118,9 @@ local function main()
         if tech_by_product[name] then
             techs = dedup_list(tech_by_product[name].tech)
             item_type = tech_by_product[name].type or "item"
+            if item.force_tech then
+                table.insert(techs, item.tech)
+            end
         else
             techs = {item.tech}
         end
@@ -127,18 +130,19 @@ local function main()
         end

         if data.raw[item_type] and data.raw[item_type][name] and data.raw.technology[techs[1]] then
-            -- if data.raw.item["deadlock-stack-" .. name] then
-            --     deadlock.destroy_stack(name)
-            -- end
+            if item.restack then
+                deadlock.destroy_stack(name)
+            end

             if data.raw.item["deadlock-stack-" .. name] then
                 add_item_to_tech(name, techs[1])
             else
                 deadlock.add_stack(name, icon, techs[1], icon_size, item_type)
-                if #techs > 1 then
-                    for i = 2, #techs do
-                        add_item_to_tech(name, techs[i])
-                    end
+            end
+
+            if #techs > 1 then
+                for i = 2, #techs do
+                    add_item_to_tech(name, techs[i])
                 end
             end
         else
diff --git a/dist/migrations/items.lua b/dist/migrations/items.lua
index 852cd39..5e70fcc 100644
--- a/dist/migrations/items.lua
+++ b/dist/migrations/items.lua
@@ -30,13 +30,13 @@ Items.items = {
     ["phenolic-board"] = {tech = "advanced-electronics", type = "item"},
     ["wooden-board"] = {tech = "DEFAULT", type = "item"},
     --bob-electronic-boards
-    ["advanced-circuit"] = {tech = "advanced-electronics", type = "item"},
+    ["advanced-circuit"] = {tech = "advanced-electronics", type = "item", restack = true},
     ["advanced-processing-unit"] = {tech = "advanced-electronics-3", type = "item"},
     ["basic-circuit-board"] = {tech = "DEFAULT", type = "item"},
     ["circuit-board"] = {tech = "advanced-electronics", type = "item"},
-    ["electronic-circuit"] = {tech = "electronics", type = "item"},
+    ["electronic-circuit"] = {tech = "electronics", type = "item", restack = true},
     ["multi-layer-circuit-board"] = {tech = "advanced-electronics-3", type = "item"},
-    ["processing-unit"] = {tech = "advanced-electronics-2", type = "item"},
+    ["processing-unit"] = {tech = "advanced-electronics-2", type = "item", restack = true},
     ["superior-circuit-board"] = {tech = "advanced-electronics-2", type = "item"},
     --bob-electronic-components
     ["basic-electronic-components"] = {tech = "electronics", type = "item"},
@@ -130,7 +130,7 @@ Items.items = {
     ["aluminium-plate"] = {tech = "aluminium-processing", type = "item"},
     ["cobalt-plate"] = {tech = "cobalt-processing", type = "item"},
     ["gold-plate"] = {tech = "gold-processing", type = "item"},
-    ["lead-plate"] = {tech = "lead-processing", type = "item"},
+    ["lead-plate"] = {tech = "DEFAULT", type = "item", force_tech = true},
     ["lithium"] = {tech = "lithium-processing", type = "item"},
     ["nickel-plate"] = {tech = "nickel-processing", type = "item"},
     ["plutonium-239"] = {tech = "bobingabout-enrichment-process", type = "item"},
@@ -295,8 +295,8 @@ Items.items = {
     ["alien-artifact-purple"] = {tech = "DEFAULT", type = "item"},
     ["alien-artifact-red"] = {tech = "DEFAULT", type = "item"},
     ["alien-artifact-yellow"] = {tech = "DEFAULT", type = "item"},
-    ["battery"] = {tech = "battery", type = "item"},
-    ["copper-plate"] = {tech = "DEFAULT", type = "item"},
+    ["battery"] = {tech = "battery", type = "item", restack = true},
+    ["copper-plate"] = {tech = "DEFAULT", type = "item", force_tech = true},
     ["explosives"] = {tech = "explosives", type = "item"},
     ["iron-plate"] = {tech = "DEFAULT", type = "item"},
     ["plastic-bar"] = {tech = "plastics", type = "item"},
3 years ago
(updated 3 years ago)

stone-brick is also missing. It is missing from item.lua all together.

Adding:

    ["stone-brick"] = {tech = "DEFAULT", type = "item"},

to the raw-materials section about line ~300 solves this problem.

That should do it for my mucking about for a bit. :)