Skip to content

Commit df4bd15

Browse files
authored
Fix confusing defaults for enable_fire and enable_tnt (#3221)
1 parent d0c823c commit df4bd15

File tree

5 files changed

+29
-24
lines changed

5 files changed

+29
-24
lines changed

minetest.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# empty, Minetest Game does not need any defaults.

minetest.conf.example

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
# Inform player of condition and location of new bones.
2727
#bones_position_message = false
2828

29-
# Whether fire should be enabled. If disabled, 'basic_flame' nodes will
30-
# disappear.
31-
# 'permanent_flame' nodes will remain with either setting.
32-
#enable_fire = true
29+
# Flammable nodes will be ignited by nearby igniters. Spreading fire may
30+
# cause severe destruction.
31+
# Spreading fire nodes will disappear when fire is disabled, but
32+
# 'permanent_flame' nodes are unaffected.
33+
# If set to "auto", it will be enabled only in singleplayer.
34+
#enable_fire = auto
3335

3436
# Enable flame sound.
3537
#flame_sound = true
@@ -42,8 +44,10 @@
4244
#initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel,
4345
default:torch 99,default:cobble 99
4446

45-
# Whether the TNT mod should be enabled.
46-
#enable_tnt = <true in singleplayer, false in multiplayer>
47+
# When TNT explodes, it destroys nearby nodes and damages nearby players.
48+
# This setting is disabled by default on servers.
49+
# If set to "auto", it will be enabled only in singleplayer.
50+
#enable_tnt = auto
4751

4852
# The radius of a TNT explosion.
4953
#tnt_radius = 3

mods/fire/init.lua

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@
33
-- Global namespace for functions
44
fire = {}
55

6-
-- Load support for MT game translation.
76
local S = minetest.get_translator("fire")
87

9-
-- 'Enable fire' setting
10-
local fire_enabled = minetest.settings:get_bool("enable_fire")
11-
if fire_enabled == nil then
12-
-- enable_fire setting not specified, check for disable_fire
13-
local fire_disabled = minetest.settings:get_bool("disable_fire")
14-
if fire_disabled == nil then
15-
-- Neither setting specified, check whether singleplayer
16-
fire_enabled = minetest.is_singleplayer()
17-
else
18-
fire_enabled = not fire_disabled
8+
-- Default to enabled in singleplayer
9+
local fire_enabled = minetest.settings:get("enable_fire") or "auto"
10+
if fire_enabled == "auto" then
11+
fire_enabled = minetest.is_singleplayer()
12+
if minetest.settings:get_bool("disable_fire") then -- this is undocumented...?
13+
fire_enabled = false
1914
end
15+
else
16+
fire_enabled = minetest.is_yes(fire_enabled)
2017
end
2118

2219
--

mods/tnt/init.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
tnt = {}
44

5-
-- Load support for MT game translation.
65
local S = minetest.get_translator("tnt")
76

87

9-
-- Default to enabled when in singleplayer
10-
local enable_tnt = minetest.settings:get_bool("enable_tnt")
11-
if enable_tnt == nil then
8+
-- Default to enabled in singleplayer
9+
local enable_tnt = minetest.settings:get("enable_tnt") or "auto"
10+
if enable_tnt == "auto" then
1211
enable_tnt = minetest.is_singleplayer()
12+
else
13+
enable_tnt = minetest.is_yes(enable_tnt)
1314
end
1415

1516
local tnt_radius = tonumber(minetest.settings:get("tnt_radius") or 3)
1617

17-
-- Fill a list with data for content IDs, after all nodes are registered
18+
-- Fill a table with data for all content IDs, after all nodes are registered
1819
local cid_data = {}
1920
minetest.register_on_mods_loaded(function()
2021
for name, def in pairs(minetest.registered_nodes) do

settingtypes.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ creative_mode (Creative mode) bool false
1111
# cause severe destruction.
1212
# Spreading fire nodes will disappear when fire is disabled, but
1313
# 'permanent_flame' nodes are unaffected.
14-
enable_fire (Fire) bool true
14+
# If set to "auto", it will be enabled only in singleplayer.
15+
enable_fire (Fire) enum auto auto,true,false
1516

1617
# Enable flame sound.
1718
flame_sound (Flame sound) bool true
@@ -37,7 +38,8 @@ enable_fence_tall (Tall fences and walls) bool false
3738

3839
# When TNT explodes, it destroys nearby nodes and damages nearby players.
3940
# This setting is disabled by default on servers.
40-
enable_tnt (TNT) bool true
41+
# If set to "auto", it will be enabled only in singleplayer.
42+
enable_tnt (TNT) enum auto auto,true,false
4143

4244
# The radius in which nodes will be destroyed by a TNT explosion.
4345
tnt_radius (TNT radius) int 3 0

0 commit comments

Comments
 (0)