Deadlock Stacking For Bobs


Add stacked items for Bob's

4 months ago
0.18 - 1.1
11.6K

b Incorrect stack graphics for circuit board stacks

3 years ago

With Bob's Electronics the Basic Electronic Board, Electronic Circuit Board, and Electronic Logic board use the default graphics for the stacks from the 3 tiers of vanilla circuit boards. If also using something like Artisanal Reskins things get really confusing...

Only Bob's Electronics:
https://pasteboard.co/JGqtPJI.png

With Artisanal Reskins:
https://pasteboard.co/JGquhfI.png

3 years ago
(updated 3 years ago)

Billbo, could you add the following diff to this mod. It'll fix the incorrect graphics used on stacks created by deadlock-stacking before the graphic for the vanilla items are changed by bobelectronics. It may not be the best path to a fix, but I didn't fully digest the changes you made to this chunk of code that created the regression.

diff --git a/dist/data-final-fixes.lua b/dist/data-final-fixes.lua
index 9ccd97f..b9b62fa 100644
--- a/dist/data-final-fixes.lua
+++ b/dist/data-final-fixes.lua
@@ -132,6 +132,11 @@ local function main()
             -- end

             if data.raw.item["deadlock-stack-" .. name] then
+                -- deadlock stackng has already created stack recipes for vanilla items with vanilla icons.
+                -- bobelectronics, reskins (perhaps others) have changed the icons used for the non-stacked items
+                -- need to delete and recreate the stacked recipes so the graphics match
+                deadlock.destroy_stack(name)
+                deadlock.add_stack(name, icon, techs[1], icon_size, item_type)
                 add_item_to_tech(name, techs[1])
             else
                 deadlock.add_stack(name, icon, techs[1], icon_size, item_type)
3 years ago

On second thought.. This kills all the previous stacks that have custom stack icons already created. I'll create a new patch that only deals with the 3 circuit boards in question.

3 years ago
(updated 3 years ago)

Here ya go. I think this is a better solution to the issue.

diff --git a/dist/data-final-fixes.lua b/dist/data-final-fixes.lua
index 9ccd97f..1dca2a0 100644
--- a/dist/data-final-fixes.lua
+++ b/dist/data-final-fixes.lua
@@ -127,9 +127,9 @@ 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])
diff --git a/dist/migrations/items.lua b/dist/migrations/items.lua
index 852cd39..f2ef937 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"},
@@ -295,7 +295,7 @@ 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"},
+    ["battery"] = {tech = "battery", type = "item", restack = true},
     ["copper-plate"] = {tech = "DEFAULT", type = "item"},
     ["explosives"] = {tech = "explosives", type = "item"},
     ["iron-plate"] = {tech = "DEFAULT", type = "item"},