modlist/config setting override for modpack creation

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
usafphoenix
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Sun Aug 06, 2017 9:42 am
Contact:

modlist/config setting override for modpack creation

Post by usafphoenix »

is there a function we can call within a mod to forcefully-set another mod's config setting (startup,map,player), and prevent any desired selection of mods from loading with a user-selected third-party mod that isn't designed (tested) against the intended list of mods?
I ask this cause i'd like to create a modpack but ensuring modpack is unedited, and not-added-to by a user experiencing a potential bug would be kinda important to me. i've been forming a collection of mods and building a framework for a mod to integrate them all, but it all breaks if any (of about 30 that i know of) mods are added to it, or if the user changes any of about 50 config settings.

optimally, a solution would include either the ability within a mod, to grey-out or lock certain configs and make them uneditable while the modpack-mod is enabled, and if any "extracurricular" mods are enabled, they'd be set to "red" and wouldn't load along with the modpack's core mod.

edit: in reviewing endgame combat's code, i found there could be a way to detect what mods are present and then force the game to close with an error message by doing, basically if [modname here] == true then [create error message and put the game loading screen into an error state and quit the game]

so if anyone can help me figure out how to have one mod SET the config settings of another mod, that'd be much appreciated.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: modlist/config setting override for modpack creation

Post by eradicator »

There is no write access to mod settings after the data phase. You could set the allowed values for all settings to the default value, i.e. so that the default value is the only allowed value and thus the user can't change it. It won't be grayed out or hidden though. And i don't think there's a .hidden option for mod settings.

As for whitelisting mods your description of checking the list of mods against your desired list in control.lua is probably your best option, don't forget to list all detected incompatible mods in the error message. If you wanted only some mods to be excluded you could've used the incompatiblity feature of info.json, but you said you wanted to block all other mods.

Blocking all other mods is a shitty idea btw. Mod packs are meant to be appended to. Most people will want to add their personal favourite flavor of long-reach or some other QoL mod. And if the pack is made half-decent it should not break just because of that. All the more for a small modpack like yours (big ones are 100+).

If you only care about bug-reports you could simply log() the list of mods and require logs to be appaneded to bug reports.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: modlist/config setting override for modpack creation

Post by Rseding91 »

usafphoenix wrote:so if anyone can help me figure out how to have one mod SET the config settings of another mod, that'd be much appreciated.
You can't and probably will never be able to.
If you want to get ahold of me I'm almost always on Discord.

usafphoenix
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Sun Aug 06, 2017 9:42 am
Contact:

Re: modlist/config setting override for modpack creation

Post by usafphoenix »

Rseding91 wrote:
usafphoenix wrote:so if anyone can help me figure out how to have one mod SET the config settings of another mod, that'd be much appreciated.
You can't and probably will never be able to.
that's unfortunate, as it pretty much ensures either a) modpack creation / distribution of ideas on how to combine certain things with a few tweaks---it'd basically make that impossible. orb) it'd be too difficult to make it a desired endeavor. it's fairly easy to download a bunch of mods, create a simple mod with only a data-updates or data-final-fixes.lua that resolves some recipe issues or integrates a couple mods together in the crafting tree... but without the combined ability to both whitelist mods and forcefully set a list of mod-settings (or to include a mod-settings.dat (not a mod-settings.lua) file within a mod file and have factorio print a dialogue stating something along the lines of "this mod would like to overwrite your mod settings. Allow/Deny? If you click deny, the mod _____ will be disabled and factorio will restart."

usafphoenix
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Sun Aug 06, 2017 9:42 am
Contact:

Re: modlist/config setting override for modpack creation

Post by usafphoenix »

eradicator wrote:Blocking all other mods is a shitty idea btw. Mod packs are meant to be appended to. Most people will want to add their personal favourite flavor of long-reach or some other QoL mod. And if the pack is made half-decent it should not break just because of that. All the more for a small modpack like yours (big ones are 100+).
the modpack i'm working on has a 185 mods lol. And the reason it'd break if someone added their own "qol" mods is things that aren't configured by the modpack to give a player specific starting items (----ie: if the player were to add and configure Alternative Start Mods to give them ALL THE ITEMS and also unlock the technology, and then add something like efficient smelting to make all the ores they smelt to produce 50 items----that would definitely "break" the modpack.
The best way i can describe it is it has a similar integration level/complexity as "FTB Infinity Skyblock Evolved", which, i admit many have not played or heard of.

Then with one or two mods, adding a specific version of far reach breaks the "explore and conquer" type mechanic. Ruins mod + factorio reach = too easy. but a mod that enables users to extend their reach with research is properly balanced and is a version i intend to include in the pack. Specific map generation settings can also interrupt with the way the pack is being designed. "very high frequency" settings put on most ore patches reduce the reliance on rails, so setting map generation is also a factor. I could turn the pack into a scenario and have the map settings and seed a part of the modpack itself, but i don't necessarily want everyone to have to play the exact same map every time, so general config settings are better---enabling more variety and replay-ability.

A mod i'm working on to include is essentially a method of using the rocket silo to craft higher tier items. it generates a list of packages that can be sent into space, and those packages have a certain value in a variety of token-types, which are partially used in crafting recipes. (Ex: refinery tier-2 recipe ingredient adds 500 copper-tinned coins and returns 450 coins, essentially meaning, the player has to EARN a certain amount before they are able to craft,but the actual item doesn't cost all the coins it takes BEFORE they are able to craft it.). The idea is to duplicate this mechanic across many mods. One of which being bob's modules. Raw productivity modules are crafted by rocket launches, a package of modules must be sent off into space and that's essentially how you'd get raw-productivity modules. beacons can transmit this productivity effect, but the technology (and cost of science) + cost of building is drastically increased. Bots require space science, but you also need the rockets in the silo to launch OTHER package types into space for crafting normal game items. The biggest issue i can see so far, is adding some mods can totally break or undo the complexity of the pack, and specific settings are also important. The author of Alternative Starts mod was kind enough to add a "starting items do not unlock the technology" option to his mod, but if a user can simply re-enable that setting, it also kinda defeats some of the purpose and mindset behind the whole pack. the player STARTS with a bunch of stuff anyone playing vanilla would scoff at it being O-P, but they still have to research the technology to get MORE of that item, and the cost of science is logarithmic. the cost of bots and logistic chests require space science (but you start with some of each of those), and the cost of pretty much everything is harder---but you're also given 100 steel furnaces from the get go, electric miners, etc.)


EDIT: I COULD** put the mod-settings.dat file IN the core mod's folder with instructions on the info page that the user must extract it, and overwrite their settings, but that doesn't prevent alteration, just ensures that when the pack loads, everything is "correct". I can set the allowed value to the default value, but i don't know if its possible to SET the default value. (effectively forcing a specific value in each setting)....doubt it from what i've seen so far. The "!" can be used to explicitly blacklist mods, but a cleaner approach would be an "ONLY" modifier/or modISmodpackTAG within info.json----which doesn't exist, and i'd have to bribe factorio's dev team to put it in probably lol.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: modlist/config setting override for modpack creation

Post by eradicator »

usafphoenix wrote: the modpack i'm working on has a 185 mods lol. And the reason it'd break if someone added [...]
I thought you meant it has 30. With 185 i can see the incompatibilities. Also i thought with "break" you meant "crash". So. General misunderstanding. Also i only know FTP TPPI1+2 :P.

For the remaining issues my first post answers all your questions. Additionally default values are of course trivial to change, the settings stage is just a big table. So you only need to make sure the mod forcing the settings loads last (dependencies or naming or settings-final-fixes) and write your desired values to the table.

Contraty to mod settings all map settings can be easily changed runtime via the API, so there's no need to include a fixed map. Though a scenario might still be preferrable to prevent the map settings screen from showing up if you want that. It'd basically be a scenario that creates a random map with fixed settings.

Post Reply

Return to “Modding interface requests”