Page 10 of 11
Re: [0.15] Mod setting/config interface - give your input
Posted: Tue Dec 05, 2017 9:25 am
by bobingabout
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.
Re: [0.15] Mod setting/config interface - give your input
Posted: Tue Dec 05, 2017 11:06 am
by darkfrei
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.
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.
All players have same data.raw table. So, I can't understand, why it can make desyncs?
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
Posted: Tue Dec 05, 2017 11:56 am
by Rseding91
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.
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.
All players have same data.raw table. So, I can't understand, why it can make desyncs?
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
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.
Re: [0.15] Mod setting/config interface - give your input
Posted: Thu Dec 07, 2017 8:25 pm
by darkfrei
Rseding91 wrote:- Mod setting 1 value = #inserters
- In data.raw create # of special inserters using Mod setting 1 value
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.
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?
Re: [0.15] Mod setting/config interface - give your input
Posted: Wed Dec 27, 2017 9:34 pm
by mickael9
I see localised drop down strings were added, thanks!
The syntax is:
Code: Select all
[string-mod-setting]
<mod-name>-<setting-name>-<dropdown-item-name>=<translated item>
Let's say you have an
hello mod, with the following setting declared in settings.lua:
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",
},
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:
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
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)!
Re: [0.15] Mod setting/config interface - give your input
Posted: Wed Dec 27, 2017 9:54 pm
by Rseding91
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).
Re: [0.15] Mod setting/config interface - give your input
Posted: Wed Dec 27, 2017 10:17 pm
by darkfrei
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).
Is it possible don't write mod name by file path?
So, instead of
Code: Select all
icon = "__HydraulicPumpjacks__/graphics/icon-deep-crude-oil.png"
can be written just
Code: Select all
icon = "__/graphics/icon-deep-crude-oil.png"
or something same. So, copying code and graphics from one mod to another don't need any code replacing.
Re: [0.15] Mod setting/config interface - give your input
Posted: Sat Dec 30, 2017 12:05 am
by dewiniaid
darkfrei wrote:Rseding91 wrote:- Mod setting 1 value = #inserters
- In data.raw create # of special inserters using Mod setting 1 value
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.
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?
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.
Re: [0.15] Mod setting/config interface - give your input
Posted: Wed Apr 04, 2018 11:06 pm
by sparr
Rseding91 wrote:Supercheese wrote:Oh, so there is an "order" property that can be set? It's impossible to know such things without documentation...
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 Factorio
![Razz :P](./images/smilies/icon_razz.gif)
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.
Re: [0.15] Mod setting/config interface - give your input
Posted: Wed Apr 04, 2018 11:32 pm
by Rseding91
sparr wrote:Rseding91 wrote:Supercheese wrote:Oh, so there is an "order" property that can be set? It's impossible to know such things without documentation...
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 Factorio
![Razz :P](./images/smilies/icon_razz.gif)
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.
https://wiki.factorio.com/Types/Order
Re: [0.15] Mod setting/config interface - give your input
Posted: Wed Apr 04, 2018 11:51 pm
by sparr
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???
Re: [0.15] Mod setting/config interface - give your input
Posted: Wed Apr 04, 2018 11:58 pm
by Rseding91
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???
B and C: yes.
Re: [0.15] Mod setting/config interface - give your input
Posted: Thu Apr 05, 2018 12:04 am
by sparr
is the lexical ordering ASCII? so 0 < A < Z < _ < a < z < ~
Re: [0.15] Mod setting/config interface - give your input
Posted: Thu Apr 05, 2018 12:06 am
by Rseding91
sparr wrote:is the lexical ordering ASCII? so 0 < A < Z < _ < a < z < ~
yes
Re: [0.15] Mod setting/config interface - give your input
Posted: Thu Apr 05, 2018 12:22 am
by sparr
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
Posted: Thu Apr 05, 2018 10:19 am
by eradicator
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.
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.
Re: [0.15] Mod setting/config interface - give your input
Posted: Thu Apr 05, 2018 11:05 am
by mickael9
eradicator 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.
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]
Re: [0.15] Mod setting/config interface - give your input
Posted: Thu Apr 05, 2018 6:58 pm
by sparr
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]
Within the base mod, this is [almost?] entirely true. But other mods can use the same letter with a different bracketed string.
Re: [0.15] Mod setting/config interface - give your input
Posted: Thu Apr 05, 2018 7:36 pm
by eradicator
sparr wrote: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]
Within the base mod, this is [almost?] entirely true. But other mods can use the same letter with a different bracketed string.
That's not "being ignored" though, that's "happens to have no visible effect". The problem is i always assumed something like this:
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.
Re: [0.15] Mod setting/config interface - give your input
Posted: Mon Apr 09, 2018 9:20 am
by bobingabout
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.