Mod Settings: Sectioning
Posted: Mon Nov 11, 2024 11:44 am
Hi! I've noticed that mod settings haven't really changed much in 2.0. You can mostly load a 1.1 mod with the data stage and control stage removed in 2.0, with only a few changes (replacing double dots with underscores) to setting names. So I'm suggesting a few additions to the current mod settings API, starting with "Sections". The point of this is encapsulated in this screenshot:
Ok, pointless discussion out of the way, why have I posted a screenshot of average mod settings?
Because, the settings are all mixed up and it's hard to tell which one is which. Sections would allow me to have a "Section" for gun turret settings, flamethrower turret settings, laser turret settings, railgun turret settings, rocket turret settings and tesla turret settings. The text would be smaller than the Powerful Lasers heading, but larger than the Mod setting names themselves. In fact, the text wouldn't have to be optional, but could still be used to make name-less divisions, such as this:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you put something similar into the localised_name (or locale for the name) of your section, you could still create textless divisions.
An example of a section prototype is this:
Which would create something that looks like this:
Powerful Lasers
Gun Turret Settings:
Improve Gun Turrets [] (<-- Insert real checkbox here)
Enable Gun Turret Improvement Technology [] (<-- Insert real checkbox here)
Gun Turret Damage Multiplier [5000] (<-- Insert real numerical input here)
Gun Turret Speed Multiplier [5000] (<-- Insert real numerical input here)
Without the brackets, though.
Of course, my real code loops through each weapon type, then creates 4 settings each. Preferably, I'd want to create a section with each run of the loop, so that when my mod creates the settings for a weapon type, I'd also create a section for that weapon type.
I think this is a plausible feature to add to the modding API.
Yes, secret mod I've been working on which no one knows about! Well, I only make mods based on what I need, I made QA because I felt that having to "unlock" qualities isn't that realistic and also because quality is very hard. I made FFR as my first mod because I felt that furnaces were too slow. Then I made FL because "belts" were too slow for the fast furnaces.Ok, pointless discussion out of the way, why have I posted a screenshot of average mod settings?
Because, the settings are all mixed up and it's hard to tell which one is which. Sections would allow me to have a "Section" for gun turret settings, flamethrower turret settings, laser turret settings, railgun turret settings, rocket turret settings and tesla turret settings. The text would be smaller than the Powerful Lasers heading, but larger than the Mod setting names themselves. In fact, the text wouldn't have to be optional, but could still be used to make name-less divisions, such as this:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you put something similar into the localised_name (or locale for the name) of your section, you could still create textless divisions.
An example of a section prototype is this:
Code: Select all
-- settings.lua
data:extend{
{ name = "pl_bullet-divider",
type = "section",
section_type = "startup",
order = "bullet",
localised_name = {"pl-setting.pl_section-name", {"turret.pl_bullet"}}
}
}
Code: Select all
-- locale/en/mod.cfg
[pl-setting]
pl_section-name=__1__ Settings:
[turret]
pl_bullet=Gun Turret
Powerful Lasers
Gun Turret Settings:
Improve Gun Turrets [] (<-- Insert real checkbox here)
Enable Gun Turret Improvement Technology [] (<-- Insert real checkbox here)
Gun Turret Damage Multiplier [5000] (<-- Insert real numerical input here)
Gun Turret Speed Multiplier [5000] (<-- Insert real numerical input here)
Without the brackets, though.
Of course, my real code loops through each weapon type, then creates 4 settings each. Preferably, I'd want to create a section with each run of the loop, so that when my mod creates the settings for a weapon type, I'd also create a section for that weapon type.
I think this is a plausible feature to add to the modding API.