Page 1 of 1

Values being changed to technology when adding another science requirement

Posted: Thu Apr 15, 2021 8:17 pm
by bigmond
I'm trying to add a variant of the life suppot item from space exploration.

I've come up with a weird issue and I noticed several things were not what I had set them to.
1. The technology required material science despite not being set.
2. Material science was a prerequesit despite not being set.
3. The quantity of science required was 60 despite being set to 100.

Oddly after some trial and error I noticed that adding the biological science pack to the the science ingredients triggereed all these issues. Removing it fixed the issue. ~Removing line 19 "{ data_util.se_prefix .. "biological-science-pack-1", 1 }," From the science packs required fixes all 3 of the above irregularities.

For now all I've changed is the grid size and power while I try to work out whats up.

Code: Select all

local data_util = require("data_util")

local lifesupport_equipment_prototypes = {
  ["lifesupport-equipment-mini-1"] = {
    tier = 1, grid_width = 1, grid_height = 1, power = "30kW",
    ingredients = {
      {data_util.se_prefix .. "bioscrubber", 2},
      {data_util.se_prefix .. "space-pipe", 2},
      {data_util.se_prefix .. "lifesupport-equipment-1", 1},
      {data_util.se_prefix .. "beryllium-plate", 2},
      {data_util.se_prefix .. "biochemical-data", 1}
    },
    science_packs = {
      { "automation-science-pack", 1 },
      { "logistic-science-pack", 1 },
      { "chemical-science-pack", 1 },
	  { "production-science-pack", 1 },
      { data_util.se_prefix .. "rocket-science-pack", 1 },
      { data_util.se_prefix .. "biological-science-pack-1", 1 },
    },
    prerequisites = {
      data_util.se_prefix .. "lifesupport-equipment-1",
      data_util.se_prefix .. "bioscrubber"
    }
  }, -- +25% efficiency 
}

for name, lep in pairs(lifesupport_equipment_prototypes) do

  local lifesupport_equipment = table.deepcopy(data.raw["movement-bonus-equipment"]["exoskeleton-equipment"])
  lifesupport_equipment.name = data_util.mod_prefix ..name
  lifesupport_equipment.movement_bonus = 0
  lifesupport_equipment.energy_consumption = lep.power
  lifesupport_equipment.sprite = { filename = "__space-exploration-extra-items__/graphics/equipment/"..name..".png", width = 128, height = 128, priority = "medium" }
  --lifesupport_equipment.background_color = { r = 0.2, g = 0.3, b = 0.6, a = 1 }
  lifesupport_equipment.shape = { width = lep.grid_width, height = lep.grid_width, type = "full" }
  lifesupport_equipment.categories = {"armor-jetpack"} -- we only want to put lifesupports in armors, same as jetpacks. Let's jump on an existing restriction. Should be safe as long as jetpacks is a hard req.

  local lifesupport_item = table.deepcopy(data.raw["item"]["exoskeleton-equipment"])
  lifesupport_item.name = data_util.mod_prefix ..name
  lifesupport_item.icon = "__space-exploration-extra-items__/graphics/icons/"..name..".png"
  lifesupport_item.icon_mipmaps = 1
  lifesupport_item.icon_size = 64
  lifesupport_item.placed_as_equipment_result = data_util.mod_prefix ..name

  local lifesupport_recipe = table.deepcopy(data.raw["recipe"]["exoskeleton-equipment"])
  lifesupport_recipe.name = data_util.mod_prefix ..name
  lifesupport_recipe.icon = icon_path
  lifesupport_recipe.icon_size = 64
  lifesupport_recipe.icon_mipmaps = 1
  lifesupport_recipe.enabled = false
  lifesupport_recipe.result = data_util.mod_prefix .. name
  lifesupport_recipe.ingredients = lep.ingredients
  lifesupport_recipe.energy_required = lep.tier * 10
  lifesupport_recipe.category = "lifesupport"

  local lifesupport_tech = {
    type = "technology",
    name = data_util.mod_prefix .. name,
    effects = { { type = "unlock-recipe", recipe = data_util.mod_prefix ..name } },
    icon = "__space-exploration-extra-items__/graphics/technology/"..name..".png",
    icon_size = 128,
    order = "e-g",
    prerequisites = lep.prerequisites,
    unit = {
     count = lep.tier * 100,
     time = 30,
     ingredients = lep.science_packs
    },
  }

  data:extend({
    lifesupport_equipment,
    lifesupport_item,
    lifesupport_recipe,
    lifesupport_tech
  })

end

Re: Values being changed to technology when adding another science requirement

Posted: Fri Apr 16, 2021 8:27 am
by Silari
Make sure you have the "Show mod owners in tooltips" option enabled in the Interface settings, then hover over the tech in the techtree. I'd say there's a good chance some other mod else is modifying your tech. SE has a LOT of data changes occurring and it, or another mod, might be applying changes to your tech when it has the bio science pack as part of it's stuff.