From df4bd15ba4d3e2fac75951bf11361f3eb8e4f78b Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 5 Jan 2026 12:19:56 +0100 Subject: [PATCH] Fix confusing defaults for enable_fire and enable_tnt (#3221) --- minetest.conf | 1 + minetest.conf.example | 16 ++++++++++------ mods/fire/init.lua | 19 ++++++++----------- mods/tnt/init.lua | 11 ++++++----- settingtypes.txt | 6 ++++-- 5 files changed, 29 insertions(+), 24 deletions(-) diff --git a/minetest.conf b/minetest.conf index e69de29b..eeca41e9 100644 --- a/minetest.conf +++ b/minetest.conf @@ -0,0 +1 @@ +# empty, Minetest Game does not need any defaults. diff --git a/minetest.conf.example b/minetest.conf.example index 6b392e8a..3766d74a 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -26,10 +26,12 @@ # Inform player of condition and location of new bones. #bones_position_message = false -# Whether fire should be enabled. If disabled, 'basic_flame' nodes will -# disappear. -# 'permanent_flame' nodes will remain with either setting. -#enable_fire = true +# Flammable nodes will be ignited by nearby igniters. Spreading fire may +# cause severe destruction. +# Spreading fire nodes will disappear when fire is disabled, but +# 'permanent_flame' nodes are unaffected. +# If set to "auto", it will be enabled only in singleplayer. +#enable_fire = auto # Enable flame sound. #flame_sound = true @@ -42,8 +44,10 @@ #initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel, default:torch 99,default:cobble 99 -# Whether the TNT mod should be enabled. -#enable_tnt = +# When TNT explodes, it destroys nearby nodes and damages nearby players. +# This setting is disabled by default on servers. +# If set to "auto", it will be enabled only in singleplayer. +#enable_tnt = auto # The radius of a TNT explosion. #tnt_radius = 3 diff --git a/mods/fire/init.lua b/mods/fire/init.lua index 538cfa6f..c898092e 100644 --- a/mods/fire/init.lua +++ b/mods/fire/init.lua @@ -3,20 +3,17 @@ -- Global namespace for functions fire = {} --- Load support for MT game translation. local S = minetest.get_translator("fire") --- 'Enable fire' setting -local fire_enabled = minetest.settings:get_bool("enable_fire") -if fire_enabled == nil then - -- enable_fire setting not specified, check for disable_fire - local fire_disabled = minetest.settings:get_bool("disable_fire") - if fire_disabled == nil then - -- Neither setting specified, check whether singleplayer - fire_enabled = minetest.is_singleplayer() - else - fire_enabled = not fire_disabled +-- Default to enabled in singleplayer +local fire_enabled = minetest.settings:get("enable_fire") or "auto" +if fire_enabled == "auto" then + fire_enabled = minetest.is_singleplayer() + if minetest.settings:get_bool("disable_fire") then -- this is undocumented...? + fire_enabled = false end +else + fire_enabled = minetest.is_yes(fire_enabled) end -- diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua index 82306121..de281822 100644 --- a/mods/tnt/init.lua +++ b/mods/tnt/init.lua @@ -2,19 +2,20 @@ tnt = {} --- Load support for MT game translation. local S = minetest.get_translator("tnt") --- Default to enabled when in singleplayer -local enable_tnt = minetest.settings:get_bool("enable_tnt") -if enable_tnt == nil then +-- Default to enabled in singleplayer +local enable_tnt = minetest.settings:get("enable_tnt") or "auto" +if enable_tnt == "auto" then enable_tnt = minetest.is_singleplayer() +else + enable_tnt = minetest.is_yes(enable_tnt) end local tnt_radius = tonumber(minetest.settings:get("tnt_radius") or 3) --- Fill a list with data for content IDs, after all nodes are registered +-- Fill a table with data for all content IDs, after all nodes are registered local cid_data = {} minetest.register_on_mods_loaded(function() for name, def in pairs(minetest.registered_nodes) do diff --git a/settingtypes.txt b/settingtypes.txt index 7f72aff1..840f543b 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -11,7 +11,8 @@ creative_mode (Creative mode) bool false # cause severe destruction. # Spreading fire nodes will disappear when fire is disabled, but # 'permanent_flame' nodes are unaffected. -enable_fire (Fire) bool true +# If set to "auto", it will be enabled only in singleplayer. +enable_fire (Fire) enum auto auto,true,false # Enable flame sound. flame_sound (Flame sound) bool true @@ -37,7 +38,8 @@ enable_fence_tall (Tall fences and walls) bool false # When TNT explodes, it destroys nearby nodes and damages nearby players. # This setting is disabled by default on servers. -enable_tnt (TNT) bool true +# If set to "auto", it will be enabled only in singleplayer. +enable_tnt (TNT) enum auto auto,true,false # The radius in which nodes will be destroyed by a TNT explosion. tnt_radius (TNT radius) int 3 0