-
Notifications
You must be signed in to change notification settings - Fork 156
Start using settingtypes.txt #665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,30 @@ | |
# | ||
# Disabling this feature will sacrifice safety for convenience. | ||
technic_safe_chainsaw (Chainsaw safety feature) bool true | ||
|
||
# Enables the mining drills. | ||
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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea. Will do. |
||
|
||
# Enables the Flashlight. | ||
enable_flashlight (Enable Flashlight) bool false | ||
|
||
# Enables Frames. | ||
enable_frames (Enable Frames) bool false | ||
|
||
# Enables Corium Griefing. | ||
enable_corium_griefing (Enable corium_griefing) bool true | ||
|
||
# Enables Radiation Protection. | ||
enable_radiation_protection (Enable Radiation Protection) bool true | ||
|
||
# Enables Entity Radiation Damage. | ||
enable_entity_radiation_damage (Enable Entity Radiation Damage) bool true | ||
|
||
# Enables Long Term Radiation Damage. | ||
enable_longterm_radiation_damage (Enable Long Term Radiation Damage) bool true | ||
|
||
# Enables Nuclear Reactor Digiline Selfdestruct. | ||
enable_nuclear_reactor_digiline_selfdestruct (Enable Nuclear Reactor Digiline Selfdestruct) bool false |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,13 @@ technic.config = technic.config or Settings(minetest.get_worldpath().."/technic. | |
|
||
local conf_table = technic.config:to_table() | ||
|
||
local function bool_to_string(bool) | ||
if bool then | ||
return "true" | ||
end | ||
return "false" | ||
end | ||
|
||
local defaults = { | ||
enable_mining_drill = "true", | ||
enable_mining_laser = "true", | ||
|
@@ -13,10 +20,16 @@ local defaults = { | |
enable_entity_radiation_damage = "true", | ||
enable_longterm_radiation_damage = "true", | ||
enable_nuclear_reactor_digiline_selfdestruct = "false", | ||
technic_safe_chainsaw = "true", | ||
} | ||
|
||
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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, without the 2nd argument it would indeed return |
||
if minetest_val == nil then | ||
technic.config:set(k, v) | ||
else | ||
technic.config:set(k, bool_to_string(minetest_val)) | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.-->
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.