Science Spread


Helper library to safely and consistently spread science packs around the tech tree.

Internal
23 hours ago
2.0 - 2.1
3.92K
Owner:
Frontrider
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
3 months ago
Latest Version:
0.8.0 (23 hours ago)
Factorio version:
2.0 - 2.1
Downloaded by:
3.92K users

This library helps with spreading science packs out through the tech tree, while also trying to ensure that the tree can be researched. This means:
- the mod won't add your packs to other sciences in a way that causes it to have no labs that can research it
- ensures that every prerequisite is there.

To use it, register this prototype (only register it if this mod is there else the game will crash):

{
 type= "science-spread-rule"
 name = "<unique name>"
-- this pack won't be added unless these are also included on the technology already.
 required_packs = {
        "automation-science-pack",
        "logistic-science-pack"
    },
-- These technologies will use the starter tech as a dependency, and have your pack as an ingredient.
-- If some of them are not found (eg you have a krastorio technology in here and it is not installed) then it will be skipped safely.
-- You can just add all the technologies you want as a starter and it will be sorted out.
 starter_techs = { <list of technology names that should start the spread of this pack. Any technologies using this tech as a parent will have your pack> },
 pack_to_spread = "<name of the pack that should be spread across the tech tree>"
-- optional, every starter tech that was in the game will use this as a prerequisite.
 pack_tech_name= "<name of the tech that spreads this technology, uses the pack's name if not present>"
}

For every technology you can also set the tech_spread_exclude field to true to make this mod not touch that technology.
Excluding a single pack is experimental, and not thoroughly tested.

You can also use a cost rule to alter how the cost should be changed over a part of the tech tree.
It will skip over all trigger technologies.

 {
        type = "science-cost-rule",
        name = "<name>",
        starter_techs = {
          <every technology here will get the starter cost set as their unit.count, every technology descending from this will be altered.>
        },
        finalizer_techs = {
          <when encountering any of these technologies, the cost updates will stop>
        },
        -- the first technologies will use this as their cost
        starter_cost = 5000,
        -- every consequent technology will get this multiplier applied to the cost of the parent technology.
        increment = 1.05
    },

You can use workshop science above version 1.1 as a reference implementation.
https://mods.factorio.com/mod/workshop-science

The mod tries to have a policy for not crashing, if something is missing check the logs. Should tell you which packs or technologies were missing.