Check first post for details. In short - 'startup' if you need make changes in data.raw; runtime-global - if you want that only admin can could make changes when game is active game (change game speed for example); runtime-per-user - independed for any player in multiplayer mode (change player color).swni wrote:What is the difference between startup, runtime-global, and runtime-per-user? E.g., which ones are accessible where (such as control.lua and data.lua). If a user changes a setting from the main menu (i.e., there is no game running), and then loads a game, does the loaded game see the old values for the settings or the new values? (I assume "startup" means it only changes new games, whereas runtime means it also changes existing games.) If a user changes a setting from within a game, and then loads a different game, what happens?
Yep. Also you can make your onw pressets for map generation:swni wrote:Specifically I'm interested in settings for a mod that affects map generation, so I'm assuming "startup" is most suitable for that use case.
Code: Select all
data.raw['map-gen-presets'].default["rich-resources"] =
{
order = "b",
basic_settings =
{
autoplace_controls =
{
["iron-ore"] = { richness = "very-good"},
["copper-ore"] = { richness = "very-good"},
["stone"] = { richness = "very-good"},
["coal"] = { richness = "very-good"},
["uranium-ore"] = { richness = "very-good"},
["crude-oil"] = { richness = "very-good"}
}
}
}
for startap settings:swni wrote:What is the lua interface for reading the settings? I am aware of settings.get_player_settings(<LuaPlayer>)[<SettingName>].value but when I tried to dump the "settings" table to see what other interface options there might be I didn't see any. (I guess it's all hidden behind a metatable.)
Code: Select all
local var = settings.startup.['settings-name']
Code: Select all
local var = settings.get_player_settings(game.players[event.player_index])['settings-name']
Even base/core mod data is not protected from overriding. So this needs to change it everywhere or keep it as is, or continue to use unique prefixes, imo.swni wrote:I noticed that setting names are global across all mods. That's a bit inconvenient, because it forces the use of really long setting names to avoid accidentally clobbering someone else's mod. It would be nice if settings where namespaced by mod, and perhaps by default you only see your own mod's settings, but there was a way to examine settings belonging to another namespace if for whatever obscure reason you needed to look up the settings for another mod. (I don't plan on it myself.)
I'm assume what mod-config system was developed more likely as global trigger system, not making it as 'one place' for every mod settings. So keep make your own in-game gui configs for detailed calibration and 'mod-settings' for user's global dessisions how your calibration will work in game or what it could include.swni wrote:Finally, not really a question about the new interface, but my mod takes arbitrary lua code as part of its configuration... any suggestions from anyone on how to make that less painful on the user? I was thinking of providing several preset configurations in a drop-down box with an option for falling back to config.lua in case the user wanted the full customizability.