Page 1 of 1

Help! Mod conflict - Tech tree unlocking not working as intended

Posted: Thu Aug 25, 2022 1:41 pm
by QubixRubix
Mod community,

Hello, been playing a while and now having a go at modding Factorio. I am hoping that someone will be able and kind enough to help me with an issue that I have. I have made my own custom mod that adds 4 new technologies to the game. I can post more code as necessary. The issue is it runs alongside Space Exploration.

The issue is when I run the code as a standalone it works and the ingredients required to unlock the tech are correct red and green science as an example. However, with SE installed SE is doing something in the background and casing my mod to require every science in the mod to unlock my tech.

Could you have a look and steer me in the right direction? thank you ;)

I can post the zip files somewhere if that is easier.

Q



code in technology.lua

Code: Select all

data:extend(
{
	{
    type = "technology",
    name = "techliquifraction101",
    icon_size = 256, icon_mipmaps = 4,
    icon = "__base__/graphics/technology/oil-processing.png",
	  effects =
    {
      {
        type = "unlock-recipe",
        recipe = "liquifraction101"
      },
	  },
	  prerequisites = {"oil-processing"},
	  unit =
    {
      count = 1,
      ingredients =
      {
        {"automation-science-pack", 1}
      },
      time = 15
    },
    order = "e-p-b-c"
  },
	{
    type = "technology",
    name = "techelectroysis101",
    icon_size = 256, icon_mipmaps = 4,
    icon = "__base__/graphics/technology/oil-processing.png",
	  effects =
    {
      {
        type = "unlock-recipe",
        recipe = "electroysis101"
      },
	  },
	  prerequisites = {"logistic-science-pack"},
	  unit =
    {
      
      ingredients =
      {
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1}
      },
      time = 15,
      count = 50

    },
    order = "e-p-b-c"
  },
	{
    type = "technology",
    name = "techpyrolysis101",
    icon_size = 256, icon_mipmaps = 4,
    icon = "__base__/graphics/technology/oil-processing.png",
	  effects =
    {
      {
        type = "unlock-recipe",
        recipe = "pyrolysis101"
      },
	  },
	  prerequisites = {"logistic-science-pack"},
	  unit =
    {
      count = 50,
      ingredients =
      {
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1}
      },
      time = 15   
    },
    order = "e-p-b-c"
  },
  {
    type = "technology",
    name = "techfractionation101",
    icon_size = 256, icon_mipmaps = 4,
    icon = "__base__/graphics/technology/oil-processing.png",
    effects =
    {
      {
        type = "unlock-recipe",
        recipe = "fractionation101"
      },
    },
    prerequisites = {"oil-processing"},
    unit =
    {
      count = 5,
      ingredients =
      {
        {"automation-science-pack", 1},
        {"logistic-science-pack", 1}
      },
      time = 5
    },
    order = "e-p-b-c"
  }
}
)
code in Recipes.lua

Code: Select all

data:extend(
{
  {
    type = "recipe",
    name = "pyrolysis101",
    category = "smelting",
  icon = "__base__/graphics/icons/coal.png",
    icon_size = 64, icon_mipmaps = 4,
    enabled = false,
    energy_required = 3,
    ingredients =
    {
      {type="item", name="wood", amount=1}
    },
    results=
    {
      { name="coal", amount=2}
    },
  },

  {
    type = "recipe",
    name = "liquifraction101",
    category = "chemistry",
    enabled = false,
    energy_required = 10,
    ingredients =
    {
      {type="item", name="coal", amount=10},
      {type="fluid", name="steam", amount=100}
    },    
    results=
    {
      {type="fluid", name="crude-oil", amount=50},
      {type="fluid", name="petroleum-gas", amount=10},
      {type="item", name="stone", amount=10}
    },
  icon = "__base__/graphics/icons/fluid/coal-liquefaction.png",
    icon_size = 64, icon_mipmaps = 4,
    order = "a[oil-processing]-a[basic-oil-processing]", 
    subgroup = "fluid-recipes",   
    crafting_machine_tint =
    {
      primary = {r = 0.768, g = 0.631, b = 0.768, a = 1.000}, -- #c3a0c3ff
      secondary = {r = 0.659, g = 0.592, b = 0.678, a = 1.000}, -- #a896acff
      tertiary = {r = 0.774, g = 0.631, b = 0.766, a = 1.000}, -- #c5a0c3ff
      quaternary = {r = 0.564, g = 0.364, b = 0.564, a = 1.000}, -- #8f5c8fff
    }   
  },

  {
    type = "recipe",
    name = "electroysis101",
    category = "chemistry",
    enabled = false,
    energy_required = 1,
    ingredients =
    {
      {type="fluid", name="hydrogen101", amount=200},
      {type="fluid", name="oxygen101", amount=100}
    },    
    results=
    {
      {type="fluid", name="water", amount=100}
    },
  icon = "__base__/graphics/icons/fluid/water.png",
    icon_size = 64, icon_mipmaps = 4,
    order = "a[oil-processing]-a[basic-oil-processing]", 
    subgroup = "fluid-recipes",   
    crafting_machine_tint =
    {
      primary = {r = 0.768, g = 0.631, b = 0.768, a = 1.000}, -- #c3a0c3ff
      secondary = {r = 0.659, g = 0.592, b = 0.678, a = 1.000}, -- #a896acff
      tertiary = {r = 0.774, g = 0.631, b = 0.766, a = 1.000}, -- #c5a0c3ff
      quaternary = {r = 0.564, g = 0.364, b = 0.564, a = 1.000}, -- #8f5c8fff
    }   
  },

  {
    type = "recipe",
    name = "fractionation101",
    category = "chemistry",
    enabled = false,
    energy_required = 1,
    ingredients =
    {
      {type="fluid", name="petroleum-gas", amount=100},
    },    
    results=
    {
      {type="fluid", name="hydrogen101", amount=50},
      {type="fluid", name="oxygen101", amount=50},
      {type="item", name="petcoke101", amount=20}
    },
  icon = "__base__/graphics/icons/fluid/advanced-oil-processing.png",
    icon_size = 64, icon_mipmaps = 4,
    order = "a[oil-processing]-a[basic-oil-processing]", 
    subgroup = "fluid-recipes",   
    crafting_machine_tint =
    {
      primary = {r = 0.768, g = 0.631, b = 0.768, a = 1.000}, -- #c3a0c3ff
      secondary = {r = 0.659, g = 0.592, b = 0.678, a = 1.000}, -- #a896acff
      tertiary = {r = 0.774, g = 0.631, b = 0.766, a = 1.000}, -- #c5a0c3ff
      quaternary = {r = 0.564, g = 0.364, b = 0.564, a = 1.000}, -- #8f5c8fff
    }   
  }
})

Re: Help! Mod conflict - Tech tree unlocking not working as intended

Posted: Thu Aug 25, 2022 5:26 pm
by FuryoftheStars
You’ll need to identify at what stage SE is making these changes (data vs data-updates vs final-data-updates (or whatever it’s called)) and either move your code to after that, put in correction code after it, or (if there is no later stage) make your mod (optionally) dependent on SE, causing Factorio to force the load order to be SE first then your mod.

Re: Help! Mod conflict - Tech tree unlocking not working as intended

Posted: Fri Aug 26, 2022 2:24 am
by Silari
Never used it, but there's a way to tell SE not to mess with your techs, see the section on their wiki: https://spaceexploration.miraheze.org/w ... ical_stuff

Not sure why it's happening, but its possible your tech requires a tech that needs the SE sciences, thus it's getting modified to need them too.