Right now I've got these 4 setting types:
- String
- Int
- Double
- Bool
+1 for dropdown selection over string/int datatypes, or just an enum type for picking from a list.Supercheese wrote:Is there an option for a "drop-down"? Sometimes I'd like to restrict possible selections to a list of items -- e.g. choose one of 4 voice styles in Red Alerts.
Something like: enumerating a list of valid strings for a String option changes it from a free textbox input to a drop-down. (Or perhaps assign a list of names to Ints rather than Strings; that seems to be how OpenTTD does it.)
I think it would still be useful - the only time it would really go wrong is after mods change.Rseding91 wrote:I looked into adding support for a generic "select-prototype" option and I can do it with one caveat: I can't verify the settings in any way except when the end-user is selecting an option in the GUI. At startup or runtime all you'll get is a string.
My question is: is that still useful?
YesRseding91 wrote:My question is: is that still useful?
The only mod settings that require a restart are startup ones - ones that are used to alter prototypes.Mooncat wrote:I wrote this in the FFF #177 thread but don't know whether Rseding have read that, so I repeat here:
I hope those mod settings that don't require game restart can go to the "Map generator" popup, inside a "Mod settings" tab. It will have better UX because all the similar things (settings) are grouped closely.
Which is currently ALL of mine.Rseding91 wrote:The only mod settings that require a restart are startup ones - ones that are used to alter prototypes.Mooncat wrote:I wrote this in the FFF #177 thread but don't know whether Rseding have read that, so I repeat here:
I hope those mod settings that don't require game restart can go to the "Map generator" popup, inside a "Mod settings" tab. It will have better UX because all the similar things (settings) are grouped closely.
I was talking about the other type of settings which affect how the functions in control.lua are executed.Rseding91 wrote:The only mod settings that require a restart are startup ones - ones that are used to alter prototypes.Mooncat wrote:I wrote this in the FFF #177 thread but don't know whether Rseding have read that, so I repeat here:
I hope those mod settings that don't require game restart can go to the "Map generator" popup, inside a "Mod settings" tab. It will have better UX because all the similar things (settings) are grouped closely.
Adding options to the world gen menu is a good point btw, so you could a functions to change yield of infinites for example, or use different algorithms for shape, spread etc.Mooncat wrote:I was talking about the other type of settings which affect how the functions in control.lua are executed.Rseding91 wrote:The only mod settings that require a restart are startup ones - ones that are used to alter prototypes.Mooncat wrote:I wrote this in the FFF #177 thread but don't know whether Rseding have read that, so I repeat here:
I hope those mod settings that don't require game restart can go to the "Map generator" popup, inside a "Mod settings" tab. It will have better UX because all the similar things (settings) are grouped closely.
I think RSO is a good example. It uses control.lua to alter map gen. Its settings are well fit in the map gen menu.
I have also thought about making suggestion to let us provide mod settings in the "Options" menu, so players can change them anytime, even in map. But then I think it will cause headache if different players in a multiplayer game have different settings.
Code: Select all
folk@--:~/Programs/factorio/bin/x64$ strings factorio | grep settings
Code: Select all
bool-setting
double-setting
int-setting
string-setting
...
settings.lua
settings-updates.lua
settings-final-fixes.lua
Code: Select all
0.132 Create display on adapter 0. Size 1548x870 at position [176, 147].
0.472 Initialised OpenGL:[0] GeForce GTX 680/PCIe/SSE2; driver: 4.5.0 NVIDIA 378.13
0.473 Video memory size (dedicated/total available/current available): 2048/2048/1703 MB
0.493 Graphics options: [Graphics quality: normal] [Video memory usage: high] [Light scale: 25%] [DXT: auto]
0.618 Loading mod settings folk-fill 0.1.2 (settings.lua)
0.620 Loading mod core 0.0.0 (data.lua)
0.627 Loading mod base 0.15.1 (data.lua)
Code: Select all
data:extend({
{
type = "int-setting",
name = "folk-fill-std-stack-size",
setting_type = "runtime-per-user",
default_value = 25,
maximum_value = 100,
minimum_value = -20,
per_user = true,
},
{
type = "bool-setting",
name = "folk-fill-std-stack-test",
setting_type = "runtime-per-user",
default_value = true,
per_user = true,
},
{
type = "double-setting",
name = "folk-fill-std-stack-test2",
setting_type = "runtime-per-user",
default_value = -23,
per_user = true,
},
{
type = "string-setting",
name = "folk-fill-std-stack-test3",
setting_type = "runtime-per-user",
default_value = "Hello",
allowed_values = {"Hello", "foo", "bar"},
per_user = true,
},
})
Code: Select all
settings.get_player_settings(game.players[event.player_index])
Code: Select all
{
nil,
nil,
nil,
nil,
["folk-fill-std-stack-size"] = {
value = 13
} --[[table: 0x00007fd020003b50]],
["folk-fill-std-stack-test"] = {
value = true
} --[[table: 0x00007fd023dfbda0]],
["folk-fill-std-stack-test2"] = {
value = -23
} --[[table: 0x00007fd02000fa40]],
["folk-fill-std-stack-test3"] = {
value = "what does the fox say"
} --[[table: 0x00007fd02000def0]]
} --[[table: 0x00007fd0352b4a90]]
Code: Select all
print(serpent.block(settings.player))
Code: Select all
{
nil,
nil,
nil,
nil,
["folk-fill-std-stack-size"] = {
value = 25
} --[[table: 0x00007fd023df1700]],
["folk-fill-std-stack-test"] = {
value = true
} --[[table: 0x00007fd023def3e0]],
["folk-fill-std-stack-test2"] = {
value = -23
} --[[table: 0x00007fd0352908c0]],
["folk-fill-std-stack-test3"] = {
value = "Hello"
} --[[table: 0x00007fd023dba5a0]]
}
Code: Select all
[mod-setting-name]
folk-fill-std-stack-size= Stack size
[mod-setting-description]
folk-fill-std-stack-size=Default stack size to insert into placed entities inventories.\n\nNote: This is in percentage of default stack size. Setting this to 100 will insert a full stack, setting it to 25 will insert 1/4th of a stack.\n\nMinimum: 5% / Maximum 100%