Page 1 of 1

Mod Settings: Sectioning

Posted: Mon Nov 11, 2024 11:44 am
by BraveCaperCat
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:
Screenshot 2024-11-10 195211.png
Screenshot 2024-11-10 195211.png (95.28 KiB) Viewed 293 times
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
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.

Re: Mod Settings: Sectioning

Posted: Mon Nov 11, 2024 11:49 am
by curiosity

Re: Mod Settings: Sectioning

Posted: Mon Nov 11, 2024 12:07 pm
by BraveCaperCat
curiosity wrote: Mon Nov 11, 2024 11:49 am Related: viewtopic.php?f=28&t=105003
Thank you. Note that there is no specific idea about sectioning settings in that post. Also, I agree with any/all of the options described in that post for improving mod settings.

Re: Mod Settings: Sectioning

Posted: Mon Nov 11, 2024 5:06 pm
by curiosity
BraveCaperCat wrote: Mon Nov 11, 2024 12:07 pm Note that there is no idea about sectioning settings in that post.
Your particular suggestion falls firmly under "something else you may come up with". IMO, the exact way it looks like isn't particularly important.

Aside from that, what I think would actually be helpful in your case is hierarchical settings. AIUI, you have a master setting for each turret, so if that turret's enhancement is disabled, other settings don't matter. Disabling those subordinate settings would be even more evocative than grouping them, though of course the two are not exclusive.