inheriting from and unlocking with technology

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Honktown
Smart Inserter
Smart Inserter
Posts: 1025
Joined: Thu Oct 03, 2019 7:10 am
Contact:

inheriting from and unlocking with technology

Post by Honktown »

A detail pertaining to same-tier things or technology that descends from another. Currently, technology is explicitly named as following another. This breaks with internal technology name changes or mods that change names, unlocks, etc. Instead, a technology or recipe could specify it unlocks alongside another entity/etc, or descends from the technology containing that specific thing. This would simplify a lot of mod migrations, and could be used by the dev team to ease their own programming.

A recent example is how nuclear was split into different researches. If someone made nuclear shotgun ammo, it may have previously been after reactor technology, since that unlocked centrifuges. If instead they could instead specify descends-from-entity-name = "centrifuge" then the mod wouldn't have to change anything as the version updated. Another example is some mods change weapons, and remove the vanilla firearms. A mod I was playing still included recipes which couldn't happen because obviously that item didn't exist anymore. The attributes could also be used to prune technology or recipes that requires items that don't exist, and it would likely be relevant to separate an option for completely removing the tech path, versus only removing the recipe.

An exception would have to be made for multiple recipes that contain the same item, such as the passive provider. To make it at least predictable, the mechanic could require that all technologies including it be prerequisites. Implementation-wise, while searching for technology, build a list of all researches that contain the required thing, and bake it into the master tech list. A little more complicated than the 1:1 that probably exists now, but only a very basic algorithm.
I have mods! I guess!
Link

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: inheriting from and unlocking with technology

Post by Deadlock989 »

You can already do all of this yourself, in data stage Lua. This mod does at least 75% of the things you describe.

There is nothing preventing you from adding your own custom properties to item, recipe, technology and entity prototypes and then doing some kind of processing based on those custom properties - any non-standard properties are simply discarded at the end of the data stage. Vanilla does exactly this with the auto-barrelling property for fluids.

Upside: you can change a recipe's ingredients and your dependencies-changing algorithm will get the technologies to rearrange themselves to fit the new hierarchy of unlocks, without you having to lift a finger beyond that initial bit of work to make the algorithm.

Downside (maybe, if you care): it plays merry hell with other mods which naively assume they are only ever going to be working with pristine vanilla data.raw. If they did add some kind of engine-level technology descendancy property to recipes and people started using it then we would immediately see a massive breakout of circular tech trees. It would be a veritable circocalypse.
Image

Post Reply

Return to “Modding interface requests”