Allow one mod to "provide" another

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Allow one mod to "provide" another

Post by sparr »

I would like to be able to put an entry in foomod/info.json that says foomod satisfies dependencies on barmod.

Primary use case is to release two versions of the same mod, one with and one without high resolution graphics, either of which would satisfy dependencies on the mod.

emptyrivers
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue Feb 20, 2018 2:42 am

Re: Allow one mod to "provide" another

Post by emptyrivers »

If I understand this request right, then I think that the opposite solution would make more sense. So, you could write in one mod's info.json (for example):

Code: Select all

{
	"name":"dependentmod",
	//...
	"dependencies" : [ "foo|bar"], // foo or bar could satisfy this dependency
	//...
}
and then, if at least one of foo or bar were enabled, then dependentmod would be loaded.

sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Allow one mod to "provide" another

Post by sparr »

That would require every dependent mod to know about both foo and bar, which seems like an unnecessary burden if the author of the two mods knows their mods are interchangeable.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Allow one mod to "provide" another

Post by Pi-C »

emptyrivers wrote:
Thu Apr 25, 2019 2:44 am
If I understand this request right, then I think that the opposite solution would make more sense.
I'm using Debian, so I'm familiar with dependencies and packages that "provide" some functionality. Consider this example:

You want to install an MTA (mail transport agent -- a service running in the background that receives mail and passes it on to remote servers or local users). Let's say you settle on postfix as MTA. Postfix "depends" (hard dependency) on several packages and "suggests" (kind of a soft dependency -- you don't have to install any of those, but it would make sense to do it), among others, "mail-reader". This is a purely virtual package -- there is no real package of this name, but there are many that provide this functionality: balsa, evolution, kmail, mutt, thunderbird etc.

Tomorrow, somebody could release another program that can be used to read e-mails. The maintainers of the existing MTAs wouldn't even know it's there, so they couldn't add a dependency on it to their package. However, the author of the new package can call out to them "Hey, this new package does what you require, too!" by adding "Provides: mail-reader" to their package. So, adding "Provides" allows other mods to depend on functionality instead of specific packages -- functionality that can be found in well-known and in anonymous packages.

How could that be relevant to Factorio? Well, suppose you want to spice up combat a bit, so you make a mod package pulling in new enemies and new weapons, specifically sniper stuff . A short search on the mod portal brings up, among others, Rampant, Natural Evolution Enemies, Necromant, 5Dim's mod - Battlefield, Bob's Enemies, and Swarmageddon - Enhanced Biter Swarms for "enemies" and Schall Ammo Turrets, Combat by Samuel, Combat by lamp181, and Sniper rifle for "sniper". It doesn't matter to you which mod is pulled in, so if your users have one of the above mods already installed, they don't need to install another one with similar features. If Rampant et al. could have something like "Provides: new-enemies" and the others something like "Provides: weapon-sniper", you could just include "Dependencies: new-enemies, weapon-sniper" to pull in everything that is required. Requests like "Could you add a dependency on [insert name of new mod here]?" would be a thing of the past, as the relevant mods would announce on their own that they have what your mod package requires.

I therefore believe that Factorio supporting a "Provides:" tag in addition to "Dependencies:" would be a useful feature, indeed. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7351
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Allow one mod to "provide" another

Post by bobingabout »

My solution...
put both as an optional dependency
then in the mod itself, check to see if the entity exists.
however, optional dependencies don't force a mod to exist, so there's still the possibility that neither will be there.

A this or that would be good here. Other areas of the game could use similar things... like Technology prerequisites. need a roboport? it's unlocked by Logistic Robots and Construction Robots. currently you have to either have both, or neither as a prerequisite. I'm thinking of other areas in my own mods personally, like... you need Oxygen? you can get that either from Nitrogen processing or Electrolysis. Sulphur Dioxide? you can get that from Oil processing or Lead processing as a byproduct from smelting Lead the chemical way.

Recipes too... Like, Charcoal or Coal... Synthetic wood or Wood... currently you basically need a different recipe for each variation.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Ideas and Suggestions”