Start using settingtypes.txt#665
Conversation
| # Disabling this feature will sacrifice safety for convenience. | ||
| technic_safe_chainsaw (Chainsaw safety feature) bool true | ||
|
|
||
| # Enables the mining drills. |
There was a problem hiding this comment.
Enable Mining Drill is already shown in the settings. Players expect more information if a help icon is shown. If there is no additional information to show, then please remove these description lines.
-->
enable_mining_drill (Enable Mining Drill) bool true
enable_wind_mill (Enable Wind Mill) bool false
There was a problem hiding this comment.
I know. I just wasn't sure what i should put there. The descriptions should be written by someone who understands technic more. I suppose I could remove them.
| enable_mining_drill (Enable Mining Drill) bool true | ||
|
|
||
| # Enables Wind Mills. | ||
| enable_wind_mill (Enable Wind Mill) bool false |
There was a problem hiding this comment.
Please use the technic_ prefix on all settings such that that their origin is clear. The minetest.conf file is already somewhat chaotic, thus let's not make it much worse.
There was a problem hiding this comment.
Good idea. Will do.
| for k, v in pairs(defaults) do | ||
| if conf_table[k] == nil then | ||
| technic.config:set(k, v) | ||
| local minetest_val = minetest.settings:get(k) |
There was a problem hiding this comment.
You could use technic.config:set(k, core.settings:get_bool(k, v)) where v is the fallback. Requires Minetest 5.0.0 or newer. This is already a requirement, thus usable without further adjustments.
There was a problem hiding this comment.
I didn't put the nil check for compatibility. If we call one of the core.settings functions and the setting is at it's default value then the function will return nil anyway.
There was a problem hiding this comment.
Which part would return nil?
Correction of my previous example:
technic.config:set(k_but_without_technic_prefix, tostring(core.settings:get_bool(k, v)))
-- can be either "true" or "false"There was a problem hiding this comment.
I seem to recall that core.settings:get and core.settings:get_bool return nil when the setting hasn't been changed at least once?
There was a problem hiding this comment.
Yes, without the 2nd argument it would indeed return nil. However, providing the fallback argument will act as a default value.
This currently isn't finished but should be soon. I need help figuring out how to correctly generate the technic.config.