[0.15] Mod setting/config interface - give your input
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.15] Mod setting/config interface - give your input
Settings load BEFORE the data stage... which makes sense when you consider that the data stage can make use of settings.
therefore, settings can't read from the data.
therefore, settings can't read from the data.
Re: [0.15] Mod setting/config interface - give your input
Rseding91 wrote:No, the nature of settings means they can't have access to the data stage otherwise they wouldn't be deterministic in multiplayer.
All players have same data.raw table. So, I can't understand, why it can make desyncs?bobingabout wrote:Settings load BEFORE the data stage... which makes sense when you consider that the data stage can make use of settings.
therefore, settings can't read from the data.
Working example, I read belts speed of all belts in data.raw, then make this parameters as default values for mod settings.
If I change some of them, the game will be restarted and new values have higher priority then defaults, that was added before.
All players, that join this game, get mod settings file, restart the game and the game has the same state as server. No desyncs possible.
Re: [0.15] Mod setting/config interface - give your input
darkfrei wrote:Rseding91 wrote:No, the nature of settings means they can't have access to the data stage otherwise they wouldn't be deterministic in multiplayer.All players have same data.raw table. So, I can't understand, why it can make desyncs?bobingabout wrote:Settings load BEFORE the data stage... which makes sense when you consider that the data stage can make use of settings.
therefore, settings can't read from the data.
Working example, I read belts speed of all belts in data.raw, then make this parameters as default values for mod settings.
If I change some of them, the game will be restarted and new values have higher priority then defaults, that was added before.
All players, that join this game, get mod settings file, restart the game and the game has the same state as server. No desyncs possible.
- Mod setting 1 value = #inserters
- In data.raw create # of special inserters using Mod setting 1 value
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15] Mod setting/config interface - give your input
You are right. But can I have a very big table of entities of all mods with (like it was in example) modded belts, but hide mod settings, when this mods are not installed?Rseding91 wrote:Every time you restart the game the number of inserters increases because it uses the value it had from the last restart to make the new value.
- Mod setting 1 value = #inserters
- In data.raw create # of special inserters using Mod setting 1 value
Re: [0.15] Mod setting/config interface - give your input
I see localised drop down strings were added, thanks!
The syntax is:
Let's say you have an hello mod, with the following setting declared in settings.lua:
Since all mod setting names share a single namespace, it's a common good practice to prefix every setting name with the mod name (hello-foobar).
But the dropdown localised string requires prefixing it again, which leads to double prefixes:
I'm all for proper namespacing, but it should be consistent (either remove it from string-mod-setting or add it to all other sections like mod-setting-name)!
The syntax is:
Code: Select all
[string-mod-setting]
<mod-name>-<setting-name>-<dropdown-item-name>=<translated item>
Code: Select all
{
type = "string-setting",
name = "hello-foobar",
setting_type = "runtime-per-user",
default_value = "first-choice",
allowed_values = {
"first-choice",
"second-choice",
},
order = "a",
},
But the dropdown localised string requires prefixing it again, which leads to double prefixes:
Code: Select all
; en.cfg
[mod-setting-name]
hello-foobar=Choose
[string-mod-setting]
hello-hello-foobar-first-choice=First choice
hello-hello-foobar-second-choice=Second choice
Factorio Mod Portal Notifier - https://fac-notify.ml/
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Re: [0.15] Mod setting/config interface - give your input
I'm going to change it so it doesn't use the mod-name as a prefix and just uses the setting name.
Since as you've said: it makes sense to already prefix your setting names (and they're all unique anyway).
Since as you've said: it makes sense to already prefix your setting names (and they're all unique anyway).
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15] Mod setting/config interface - give your input
Is it possible don't write mod name by file path?Rseding91 wrote:I'm going to change it so it doesn't use the mod-name as a prefix and just uses the setting name.
Since as you've said: it makes sense to already prefix your setting names (and they're all unique anyway).
So, instead of
Code: Select all
icon = "__HydraulicPumpjacks__/graphics/icon-deep-crude-oil.png"
Code: Select all
icon = "__/graphics/icon-deep-crude-oil.png"
Re: [0.15] Mod setting/config interface - give your input
Month-old post, but you can sort of accomplish this another way. The settings pass has access to a list of installed mods. QuickItemSwap uses this to show options for integrating with Creative Mode only if the latter is installed.darkfrei wrote:You are right. But can I have a very big table of entities of all mods with (like it was in example) modded belts, but hide mod settings, when this mods are not installed?Rseding91 wrote:Every time you restart the game the number of inserters increases because it uses the value it had from the last restart to make the new value.
- Mod setting 1 value = #inserters
- In data.raw create # of special inserters using Mod setting 1 value
Re: [0.15] Mod setting/config interface - give your input
Speaking as someone who has been modding factorio off and on for maybe three years... I still have no idea how the order property works or what the variosy syntax inside of it does. I just copy the order property of something similar to what I'm working on and tweak it and hope for the best.Rseding91 wrote:It's a core part of how the entire prototype system works in Factorio. If you don't know that it exists then you probably haven't been doing anything with modding in FactorioSupercheese wrote:Oh, so there is an "order" property that can be set? It's impossible to know such things without documentation...
Re: [0.15] Mod setting/config interface - give your input
https://wiki.factorio.com/Types/Ordersparr wrote:Speaking as someone who has been modding factorio off and on for maybe three years... I still have no idea how the order property works or what the variosy syntax inside of it does. I just copy the order property of something similar to what I'm working on and tweak it and hope for the best.Rseding91 wrote:It's a core part of how the entire prototype system works in Factorio. If you don't know that it exists then you probably haven't been doing anything with modding in FactorioSupercheese wrote:Oh, so there is an "order" property that can be set? It's impossible to know such things without documentation...
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15] Mod setting/config interface - give your input
A) Thanks, glad to see the wiki getting more informative!
B) So I've been wasting my time trying to understand what all the pieces of order strings like "b[decorative]-k[stone-rock]-c[crystal]" mean? It's really just a straight lex ordering, with no special meaning for [] or -?
C) Is it case sensitive???
B) So I've been wasting my time trying to understand what all the pieces of order strings like "b[decorative]-k[stone-rock]-c[crystal]" mean? It's really just a straight lex ordering, with no special meaning for [] or -?
C) Is it case sensitive???
Re: [0.15] Mod setting/config interface - give your input
B and C: yes.sparr wrote:A) Thanks, glad to see the wiki getting more informative!
B) So I've been wasting my time trying to understand what all the pieces of order strings like "b[decorative]-k[stone-rock]-c[crystal]" mean? It's really just a straight lex ordering, with no special meaning for [] or -?
C) Is it case sensitive???
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15] Mod setting/config interface - give your input
is the lexical ordering ASCII? so 0 < A < Z < _ < a < z < ~
Re: [0.15] Mod setting/config interface - give your input
yessparr wrote:is the lexical ordering ASCII? so 0 < A < Z < _ < a < z < ~
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15] Mod setting/config interface - give your input
ok, just so I make sure I and future readers understand...
"a[foo]-b" will sort AFTER "a[fooX]-c" because X<]
This seems to contradict what many mod authors expect, based on hundreds of examples I looked at across dozens of mods while trying to figure out how this field worked on my own. I'm glad it's on the wiki now, but there's a lot of cultural inertia here that needs fighting, as people learn by looking at other people's work.
and/or the order field needs more useful/intuitive sorting functionality.
"a[foo]-b" will sort AFTER "a[fooX]-c" because X<]
This seems to contradict what many mod authors expect, based on hundreds of examples I looked at across dozens of mods while trying to figure out how this field worked on my own. I'm glad it's on the wiki now, but there's a lot of cultural inertia here that needs fighting, as people learn by looking at other people's work.
and/or the order field needs more useful/intuitive sorting functionality.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: [0.15] Mod setting/config interface - give your input
Ugh. Could've sworn i read somewhere that the '[blah]-' bit is ignored for sorting purposes and was just used as a comment to make the string easier to understand >_>. Including the bracket content in the search order is... unintuitive at best, to use a nice word.sparr wrote:ok, just so I make sure I and future readers understand...
"a[foo]-b" will sort AFTER "a[fooX]-c" because X<]
This seems to contradict what many mod authors expect, based on hundreds of examples I looked at across dozens of mods while trying to figure out how this field worked on my own. I'm glad it's on the wiki now, but there's a lot of cultural inertia here that needs fighting, as people learn by looking at other people's work.
and/or the order field needs more useful/intuitive sorting functionality.
Re: [0.15] Mod setting/config interface - give your input
My understanding is that most (all?) of the time, the bracketed name is ignored because the letter that comes before is always different (in a given group). So the bracketed name acts as a description of the letter that comes before iteradicator wrote: Ugh. Could've sworn i read somewhere that the '[blah]-' bit is ignored for sorting purposes and was just used as a comment to make the string easier to understand >_>. Including the bracket content in the search order is... unintuitive at best, to use a nice word.
Example :
a[science-pack-1]
b[science-pack-2]
c[science-pack-3]
d[military-science-pack]
e[production-science-pack]
f[high-tech-science-pack]
g[space-science-pack]
Factorio Mod Portal Notifier - https://fac-notify.ml/
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Re: [0.15] Mod setting/config interface - give your input
Within the base mod, this is [almost?] entirely true. But other mods can use the same letter with a different bracketed string.mickael9 wrote:My understanding is that most (all?) of the time, the bracketed name is ignored because the letter that comes before is always different (in a given group). So the bracketed name acts as a description of the letter that comes before it
Example :
a[science-pack-1]
b[science-pack-2]
c[science-pack-3]
d[military-science-pack]
e[production-science-pack]
f[high-tech-science-pack]
g[space-science-pack]
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: [0.15] Mod setting/config interface - give your input
That's not "being ignored" though, that's "happens to have no visible effect". The problem is i always assumed something like this:sparr wrote:Within the base mod, this is [almost?] entirely true. But other mods can use the same letter with a different bracketed string.mickael9 wrote:My understanding is that most (all?) of the time, the bracketed name is ignored because the letter that comes before is always different (in a given group). So the bracketed name acts as a description of the letter that comes before it
Example :
a[science-pack-1]
b[science-pack-2]
c[science-pack-3]
d[military-science-pack]
e[production-science-pack]
f[high-tech-science-pack]
g[space-science-pack]
BaseItemOne.order = 'a[Superstuff]-c[Awesomeplate]'
ModItemSeven.order = 'a-b'
and thought that that would lead to the mod item being sorted before the base item. Which it does not according to what was explained here.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.15] Mod setting/config interface - give your input
I think this should be stickied again.
I wanted to add a new mod setting to one of my mods, using a type I'd not used before, and as a good programmer, I wanted to look it up rather than just guessing.
I couldn't find the information on the Wiki, or in the lua-api, and I knew this data was here. But that was before the recent replies, and had to dig through this subforum to find the topic.
I get why it was unstickied, the title is a question, and the question is over, but the first page was re-written to give you ALL the required information, which is useful.
I wanted to add a new mod setting to one of my mods, using a type I'd not used before, and as a good programmer, I wanted to look it up rather than just guessing.
I couldn't find the information on the Wiki, or in the lua-api, and I knew this data was here. But that was before the recent replies, and had to dig through this subforum to find the topic.
I get why it was unstickied, the title is a question, and the question is over, but the first page was re-written to give you ALL the required information, which is useful.