Skip to main content

foundry_recip

local is_advanced_foundry_recipe = function(v)
  -- return v.category == "advanced-foundry" and v.energy_required == 3
  return v.category == "advanced-foundry" and string.find(v.name, "advanced%-foundry%-")
end

local is_py_void_fluid_recipe = function(v)
  return v.category == "py-runoff" and string.find(v.name, "%-pyvoid%-fluid")
end

local is_py_void_gas_recipe = function(v)
  return v.category == "py-venting" and string.find(v.name, "%-pyvoid%-gas")
end

do
  if settings.startup["bobmods-logistics-disableroboports"].value == true then
    -- use robochests because roboports are not craftable with this modpack settings
    bobmods.lib.recipe.replace_ingredient ("drydock-assembly", "roboport", "bob-robochest-4")
    bobmods.lib.recipe.replace_ingredient ("roboport-interface", "roboport", "bob-robochest")
  end

  -- for some reason not all recipes get this replacement (done by py high tech)
  bobmods.lib.recipe.replace_ingredient("heat-shield-tile", "silicon-nitride", "cermet")
  bobmods.lib.recipe.replace_ingredient("ceramic-bearing-ball", "silicon-nitride", "cermet")
  bobmods.lib.recipe.replace_ingredient("ceramic-bearing", "silicon-nitride", "cermet")

  -- remove advanced foundry recipes
  for name, recipe in pairs(table.filter(data.raw.recipe, is_advanced_foundry_recipe)) do
    data.raw.recipe[name].enabled = false
  end

  -- make py voids not shit
  for name, recipe in pairs(table.filter(data.raw.recipe, is_py_void_fluid_recipe)) do
    data.raw.recipe[name].ingredients[1].amount = 100
  end

  for name, recipe in pairs(table.filter(data.raw.recipe, is_py_void_gas_recipe)) do
    data.raw.recipe[name].ingredients[1].amount = 100
  end

  -- make niobium pipe be as titanium one for now
  bobmods.logistics.set_pipe_distance("niobium-pipe-to-ground", 4)

  -- nerf beacons
  data.raw.beacon["beacon-2"].supply_area_distance = 3
  data.raw.beacon["beacon-2"].module_specification.module_slots = 3
  data.raw.beacon["beacon-2"].energy_usage = "720kW"
  data.raw.beacon["beacon-3"].supply_area_distance = 3
  data.raw.beacon["beacon-3"].module_specification.module_slots = 4
  data.raw.beacon["beacon-3"].energy_usage = "960kW"

  -- remove a recipe for fibreboard because it's much easier than the alternative from py
  data.raw.recipe["angels-glass-fiber-board"].hidden = true

  -- make rubber not available the easy way
  data.raw.recipe["bob-rubber"].enabled = false

  if settings.startup["momo-enable-bob-extend"].value and settings.startup["momo-enable-bob-extend-frame"].value then
    -- tune down those last structure components because the orignal recipe is retarded
    data.raw.recipe["anotherworld-structure-components"].ingredients =
    {
      {"advanced-structure-components", 2},
      {"plastic-bar", 80},
      {"tungsten-carbide", 30},
      {"titanium-bearing", 20},
      {"ceramic-bearing", 30},
      {"brass-alloy", 10},
      {"nitinol-gear-wheel", 10},
      {"silver-zinc-battery", 30}
    }
  end

  if settings.startup["smelting-solder"].value == true then
    -- change solder plate to solder for some recipes when solder plates are not enabled
    bobmods.lib.recipe.remove_ingredient("more-science-pack-6", "solder-alloy")
    bobmods.lib.recipe.add_ingredient("more-science-pack-6", {"solder", 8})
  end

  -- disable some smelting recipes from py that don't align well with angel
  data.raw.recipe["crushed-iron"].hidden = true
  data.raw.recipe["crushed-copper"].hidden = true
  data.raw.recipe["tungsten-powder"].hidden = true
  data.raw.recipe["crushed-tin"].hidden = true
  data.raw.recipe["crushed-lead"].hidden = true
  data.raw.recipe["crushed-silver"].hidden = true
  data.raw.recipe["crushed-gold"].hidden = true
  data.raw.recipe["crushed-zinc"].hidden = true
  data.raw.recipe["crushed-nickel"].hidden = true

  -- pycoaltbaa added some recipes that make the following ones imbalanced too
  data.raw.recipe["crushing-iron"].hidden = true
  data.raw.recipe["crushing-copper"].hidden = true
  data.raw.recipe["crushing-bauxite"].hidden = true
  data.raw.recipe["crushing-rutile"].hidden = true
  data.raw.recipe["crushing-tin"].hidden = true
  data.raw.recipe["crushing-lead"].hidden = true
  data.raw.recipe["crushing-silver"].hidden = true
  data.raw.recipe["crushing-gold"].hidden = true
  data.raw.recipe["crushing-tungsten"].hidden = true
  data.raw.recipe["crushing-zinc"].hidden = true
  data.raw.recipe["crushing-nickel"].hidden = true

  -- make some tweaks to sniper turrets and military science
  bobmods.lib.recipe.add_ingredient("bob-gun-turret-2", {"gunmetal-alloy", 10})
  bobmods.lib.recipe.add_ingredient("bob-sniper-turret-1", {"bob-gun-turret-2", 1})
  bobmods.lib.recipe.replace_ingredient("military-science-pack", "gun-turret", "bob-gun-turret-2")
  data.raw.recipe["military-science-pack"].result_count = 3

  -- add info about productivity limitations
  local function has_value(tab, val)
    for index, value in ipairs(tab) do
        if value == val then
            return true
        end
    end

    return false
  end

  for _, module in pairs(data.raw.module) do
    if module.limitation and module.effect.productivity then
      for _, recipe in pairs(data.raw.recipe) do
        if has_value(module.limitation, recipe.name) then
            if recipe.localised_description == nil then
                recipe.localised_description = {""}
            end
            table.insert(recipe.localised_description, "\nBenefits from productivity.")
        end
      end
      break
    end
  end

  -- add a recommended map preset
    data.raw["map-gen-presets"]["default"]["recommended"] =
    {
        order = "b",
        basic_settings =
        {
            autoplace_controls =
            {
                ["enemy-base"] =
                {
                    frequency = "low",
                    size = "normal"
                },
                ["angels-ore1"] =
                {
                    frequency = "very-low",
                    size = "high",
                    richness = "good"
                },
                ["angels-ore2"] =
                {
                    frequency = "very-low",
                    size = "high",
                    richness = "good"
                },
                ["angels-ore3"] =
                {
                    frequency = "very-low",
                    size = "high",
                    richness = "good"
                },
                ["angels-ore4"] =
                {
                    frequency = "very-low",
                    size = "high",
                    richness = "good"
                },
                ["angels-ore5"] =
                {
                    frequency = "very-low",
                    size = "high",
                    richness = "good"
                },
                ["angels-ore6"] =
                {
                    frequency = "very-low",
                    size = "high",
                    richness = "good"
                },
                ["coal"] = {
                    frequency = "very-low",
                    size = "high",
                    richness = "good"
                },
                ["crude-oil"] =
                {
                    frequency = "low",
                    size = "high"
                },
                ["angels-natural-gas"] =
                {
                    frequency = "low",
                    size = "high"
                },
                ["angels-fissure"] =
                {
                    frequency = "low",
                    size = "high"
                },
                ["borax"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["niobium"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["molybdenum-ore"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["phosphate-rock"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["rare-earth-bolide"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["volcanic-pipe"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["regolites"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["clowns-ore1"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["clowns-ore2"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["clowns-ore3"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["clowns-ore4"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["clowns-ore5"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["clowns-ore6"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["clowns-ore7"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["clowns-resource1"] =
                {
                    frequency = "very-low",
                    size = "high"
                },
                ["clowns-resource2"] =
                {
                    frequency = "very-low",
                    size = "high"
                }
            },
            terrain_segmentation = "very-low",
            water = "high",
            starting_area = "very-big",
            cliff_settings =
            {
                name = "cliff",
                cliff_elevation_interval = 40,
                cliff_elevation_0 = 1024
            }
        },
        advanced_settings =
        {
            enemy_evolution =
            {
                time_factor = 0.000001,
                pollution_factor = 0.000005
            },
            enemy_expansion =
            {
                enabled = false
            }
        }
    }
end