pyanodon / pybugreports

Central bug-report repository for pymods
The Unlicense
6 stars 1 forks source link

Softlock when starting new game #635

Closed qzescq closed 1 week ago

qzescq commented 3 weeks ago

Mod source

Factorio Mod Portal

Operating system

=Windows 10

What kind of issue is this?

What is the problem?

Cannot progress at all: Labs require electronic circuits to make, but electronic circuits are locked behind red science which takes labs to research

Loaded mods: pY Coal Processing (and graphics) pY Fusion Energy (and graphics) pY Industry pY Post Processing

Steps to reproduce

No response

Additional context

image

Log file

factorio-current.log

Divinnity commented 2 weeks ago

Hello, I debugged this a little bit more in order to make the auto_tech works.

Here is a diff file that helps a little bit, with some explanations.

{
  { "iron-plates", 5 },
  { type = "item", name = "iron-stick", amount = 2 }
}

diff --git a/prototypes/functions/data_parser.lua b/prototypes/functions/data_parser.lua
index 0cd0441..357c646 100644
--- a/prototypes/functions/data_parser.lua
+++ b/prototypes/functions/data_parser.lua
@@ -118,7 +118,7 @@ function data_parser:run()

     -- starting recipes
     for _, recipe in pairs(data.raw.recipe) do
-        if recipe.enabled ~= false then
+        if recipe.enabled ~= false and ((recipe.parameters and recipe.parameters ~= "true") or not recipe.parameters) then
             local node = self:parse_recipe(not recipe.ignore_for_dependencies and fz_graph.START_NODE_NAME or nil, recipe)

             if not recipe.ignore_for_dependencies then
@@ -276,6 +276,15 @@ function data_parser:add_recipe_result_item(item_name, recipe_name, recipe_node,
     end
 end

+function data_parser:get_ingredient(ing)
+    if ing[1] then
+        return ing[1]
+    elseif ing.name then
+        return ing.name
+    end
+    error("Error getting the ingredients...")
+end
+
 function data_parser:parse_tech(tech)
     tech:standardize()

@@ -306,12 +315,14 @@ function data_parser:parse_tech(tech)

     local packs = {}
     -- Science packs
+    if not tech.unit then return end
     for _, ing in pairs(tech.unit.ingredients) do
-        local item = ITEM(ing[1])
+        local ingredient = self:get_ingredient(ing)
+        local item = ITEM(ingredient)
         local n_item = self:parse_item(item)
-        self.fg:add_link(n_item, node, ing[1])
-        table.insert(packs, ing[1])
-        insert_double_lookup(self.science_packs, ing[1], tech[1])
+        self.fg:add_link(n_item, node, ingredient)
+        table.insert(packs, ingredient)
+        insert_double_lookup(self.science_packs, ingredient, tech)
     end

     node:add_label(LABEL_CRAFTING_MACHINE)
@@ -372,9 +383,7 @@ function data_parser:parse_tech(tech)
             self:add_bonus_dependencies(node, effect, "fluid-turret", function(e) return e.name == effect.turret_id end, false, effect.turret_id)
         elseif effect.type == "ammo-damage" or effect.type == "gun-speed" then
             self:add_bonus_dependencies(node, effect, "ammo", function(i)
-                return
-                    (i.ammo_type.category and i.ammo_type.category == effect.ammo_category)
-                    or not i.ammo_type.category and table.any(i.ammo_type, function(at) return at.category == effect.ammo_category end)
+                return i.category and i.category == effect.ammo_category
             end, true, effect.ammo_category)
             self:add_bonus_dependencies(node, effect, "capsule", function(i)
                 return

There is now bugs with the fuzzy_graph, but I don't have the time or the knowledge to fix that part :)

   1.455 Error ModManager.cpp:1733: Failed to load mod "pypostprocessing": __pypostprocessing__/luagraphs/data/graph.lua:195: recipe|discharge-defense-remote-pyvoid
stack traceback:
    [C]: in function 'error'
    __pypostprocessing__/luagraphs/data/graph.lua:195: in function 'removeEdge'
    __pypostprocessing__/luagraphs/data/graph.lua:140: in function 'removeVertex'
    __pypostprocessing__/prototypes/functions/fuzzy_graph.lua:148: in function 'remove_node'
    __pypostprocessing__/prototypes/functions/fuzzy_graph.lua:160: in function 'recursive_remove'
    __pypostprocessing__/prototypes/functions/auto_tech.lua:76: in function 'run'
    __pypostprocessing__/data-final-fixes.lua:265: in main chunk
   1.503 Loading mod core 0.0.0 (data.lua)
   1.542 Checksum for core: 1383572432
   1.558 Error ModManager.cpp:1733: Error in assignID: procession with name 'default-b' does not exist.
notnotmelon commented 1 week ago

Hello, I debugged this a little bit more in order to make the auto_tech works.

We are completely scrapping the autotech code and rewriting it in a new repository. See here: https://github.com/Septiple/autotech