Is there any way for the data stage to effect the settings stage?

Place to get help with not working mods / modding interface.
Post Reply
Mernom
Fast Inserter
Fast Inserter
Posts: 122
Joined: Sun Jul 15, 2018 10:05 pm
Contact:

Is there any way for the data stage to effect the settings stage?

Post by Mernom »

I want to modify my setting's localised description, to show certain values that will be useful for the player to define their settings (since the effect depends on the length of the longest technology dependency chain).
But the data.raw table is not accessible, and the setting itself only provides the value during the data stage, and no global variables are shared between them. Is there nothing I can do for this?

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

Re: Is there any way for the data stage to effect the settings stage?

Post by Rseding91 »

No. The reason is: Data stage is defined based off the values of the settings stage. If the settings stage could be defined based off the values of the data stage it would be an infinite loop.
If you want to get ahold of me I'm almost always on Discord.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Is there any way for the data stage to effect the settings stage?

Post by darkfrei »

Rseding91 wrote:
Thu Mar 24, 2022 3:27 pm
No. The reason is: Data stage is defined based off the values of the settings stage. If the settings stage could be defined based off the values of the data stage it would be an infinite loop.
Must be something like (but never will be implemented)
data-pre-settings
settings
data
data-updates
data-final-fixes?

User avatar
KiwiHawk
Filter Inserter
Filter Inserter
Posts: 254
Joined: Thu Jul 05, 2018 9:48 am
Contact:

Re: Is there any way for the data stage to effect the settings stage?

Post by KiwiHawk »

Rseding91 wrote:
Thu Mar 24, 2022 3:27 pm
No. The reason is: Data stage is defined based off the values of the settings stage. If the settings stage could be defined based off the values of the data stage it would be an infinite loop.
This makes sense for startup settings. Not so much for map and player settings. Ideal would be if map and player settings could be modified in data stage. No need for new stages!
Dev for Bob's mods, Angel's mods, Helmod, Sea Block, Circuit Processing, Science Cost Tweaker.

Buy me a coffee

User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 768
Joined: Sun May 07, 2017 10:16 am
Contact:

Re: Is there any way for the data stage to effect the settings stage?

Post by ickputzdirwech »

On a related note: I would really like to be able to conditionally create runtime settings based on the value of a startup setting.

My use case is a startup setting that enables a feature and multiple runtime settings to “fine tune” it. It really makes no sense having the runtime settings available if the startup setting is disabled but afaik there is now way around it at the moment.

And just wanted to add that there is already settings-updates and settings-final-fixes. Incase you want to modify the settings of another mod.
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

User avatar
KiwiHawk
Filter Inserter
Filter Inserter
Posts: 254
Joined: Thu Jul 05, 2018 9:48 am
Contact:

Re: Is there any way for the data stage to effect the settings stage?

Post by KiwiHawk »

ickputzdirwech wrote:
Tue Mar 29, 2022 9:36 pm
On a related note: I would really like to be able to conditionally create runtime settings based on the value of a startup setting.
Map and player settings being modifiable in data stage would allow this.
Dev for Bob's mods, Angel's mods, Helmod, Sea Block, Circuit Processing, Science Cost Tweaker.

Buy me a coffee

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Is there any way for the data stage to effect the settings stage?

Post by darkfrei »

My question was: Why we have data.raw? I mean, why not just data? And why not settings.raw or data.settings?

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

Re: Is there any way for the data stage to effect the settings stage?

Post by Pi-C »

darkfrei wrote:
Wed Mar 30, 2022 7:19 am
My question was: Why we have data.raw? I mean, why not just data? And why not settings.raw or data.settings?

Code: Select all

for k, v in pairs(data) do
        log("k: "..k.."\tv: "..tostring(v))
end
will show:

Code: Select all

k: raw	v: table
k: is_demo	v: false
k: extend	v: function
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

robot256
Filter Inserter
Filter Inserter
Posts: 596
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Is there any way for the data stage to effect the settings stage?

Post by robot256 »

ickputzdirwech wrote:
Tue Mar 29, 2022 9:36 pm
On a related note: I would really like to be able to conditionally create runtime settings based on the value of a startup setting.
Not saying it won't work, just a thought. Procedurally generated setting names means having to detect what settings exist at runtime. It also means that if you change mods and load the game when that setting isn't created, it will be deleted from the settings file. When you change back and it is created again, you will have to set it again (unless you are loading a save file). For this reason, I try to set hidden=true rather than not create a setting at all, when the names are constant. It also avoids crashing code (often in other mods) that expects a particular setting to exist.

Mernom
Fast Inserter
Fast Inserter
Posts: 122
Joined: Sun Jul 15, 2018 10:05 pm
Contact:

Re: Is there any way for the data stage to effect the settings stage?

Post by Mernom »

For my purposes, I only need the setting's `localised_name` and/or `localised_description` to be accessible during data.

Post Reply

Return to “Modding help”