From 8b0d195906b37bdc7ca3980ac915c61dafee4fa5 Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Sun, 5 Mar 2023 12:58:17 +0000 Subject: [PATCH 1/5] Fix broken setting This commit adds some lines of code which make sure that nothing gets destroyed when TNT griefing is disabled. --- mods/CORE/mcl_explosions/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index b67c7c6a2..90a2d2cca 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -13,6 +13,7 @@ under the LGPLv2.1 license. mcl_explosions = {} local mod_fire = minetest.get_modpath("mcl_fire") +local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true) --local CONTENT_FIRE = minetest.get_content_id("mcl_fire:fire") local math = math @@ -359,7 +360,11 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc for hash, idx in pairs(destroy) do local do_drop = math.random() <= drop_chance local on_blast = node_on_blast[data[idx]] - local remove = true + if (not tnt_griefing) and info.is_tnt ~= false then + local remove = false + else + local remove = true + end if do_drop or on_blast then local npos = get_position_from_hash(hash) From af8c4ded930ec612a657854e365a2bc701cd6e1d Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Tue, 7 Mar 2023 09:15:59 +0000 Subject: [PATCH 2/5] Try different fix for broken setting --- mods/CORE/mcl_explosions/init.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 90a2d2cca..6f033ce9f 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -192,7 +192,7 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc local grief_protected = info.grief_protected -- Trace rays for environment destruction - if info.griefing then + if info.griefing and tnt_griefing then for i = 1, #raydirs do local rpos_x = pos.x local rpos_y = pos.y @@ -360,11 +360,7 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc for hash, idx in pairs(destroy) do local do_drop = math.random() <= drop_chance local on_blast = node_on_blast[data[idx]] - if (not tnt_griefing) and info.is_tnt ~= false then - local remove = false - else - local remove = true - end + local remove = true if do_drop or on_blast then local npos = get_position_from_hash(hash) From 1a1ea29f6eb47feaac8a4c7f279d2cc5df176fae Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Thu, 9 Mar 2023 11:25:23 +0000 Subject: [PATCH 3/5] Rename some things This commit renames `tnt_griefing` to `explosions_griefing` to better reflect what this setting now does. --- settingtypes.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settingtypes.txt b/settingtypes.txt index 74d3fc138..628641c54 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -36,8 +36,8 @@ mcl_weather_dust_particles (Nether dust particles) int 150 0 # Note that blocks never have drops when in Creative Mode. mcl_doTileDrops (Blocks have drops) bool true -# If enabled, TNT explosions destroy blocks. -mcl_tnt_griefing (TNT destroys blocks) bool true +# If enabled, explosions destroy blocks. +mcl_explosions_griefing (Explosions destroy blocks) bool true # Comma separated list of disabled structure names mcl_disabled_structures (Disabled structures) string From b1a52a324354cc36145b52b2f49601016eb47610 Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Thu, 9 Mar 2023 11:26:30 +0000 Subject: [PATCH 4/5] Rename some things This commit renames `tnt_griefing` to `explosions_griefing` to better reflect what this setting now does. --- mods/CORE/mcl_explosions/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 6f033ce9f..2b8b25b1e 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -13,7 +13,7 @@ under the LGPLv2.1 license. mcl_explosions = {} local mod_fire = minetest.get_modpath("mcl_fire") -local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true) +local explosions_griefing = minetest.settings:get_bool("mcl_explosions_griefing", true) --local CONTENT_FIRE = minetest.get_content_id("mcl_fire:fire") local math = math @@ -192,7 +192,7 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc local grief_protected = info.grief_protected -- Trace rays for environment destruction - if info.griefing and tnt_griefing then + if info.griefing and explosions_griefing then for i = 1, #raydirs do local rpos_x = pos.x local rpos_y = pos.y From 6304502173a239f4ccd1bb157f1579191928ba01 Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Thu, 9 Mar 2023 14:05:25 +0000 Subject: [PATCH 5/5] Rename some things This commit renames `tnt_griefing` to `explosions_griefing` to better reflect what this setting now does. --- mods/ITEMS/mcl_tnt/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 83c962092..4d7be3125 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -1,5 +1,5 @@ local S = minetest.get_translator(minetest.get_current_modname()) -local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true) +local explosions_griefing = minetest.settings:get_bool("mcl_explosions_griefing", true) tnt = {} @@ -61,7 +61,7 @@ if minetest.get_modpath("mesecons") then end local longdesc -if tnt_griefing then +if explosions_griefing then longdesc = S("An explosive device. When it explodes, it will hurt living beings and destroy blocks around it. TNT has an explosion radius of @1. With a small chance, blocks may drop as an item (as if being mined) rather than being destroyed. TNT can be ignited by tools, explosions, fire, lava and redstone signals." , TNT_RANGE) else