From ce2add8d5bce191bee3b498001ab15b36949e0c1 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Tue, 9 Apr 2024 23:11:57 -0400 Subject: [PATCH] fix crash on balrog dead if not enabled tnt explosion * closes https://codeberg.org/minenux/minetest-mod-mobs_balrog/issues/4 * backported upstream commit https://codeberg.org/minenux/minetest-mod-mobs_balrog/commit/bf4b9521cd672e689f5b417427cf37ee81e66408 --- minetest.conf | 1 + mods/mobs_jam/balrog.lua | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/minetest.conf b/minetest.conf index 8a50603..0cbe5f3 100644 --- a/minetest.conf +++ b/minetest.conf @@ -4,6 +4,7 @@ [subnasa-player-server] enable_pvp = true +enable_tnt = true creative_mode = false enable_damage = true default_privs = interact, shout diff --git a/mods/mobs_jam/balrog.lua b/mods/mobs_jam/balrog.lua index 34d5cc2..0299e47 100644 --- a/mods/mobs_jam/balrog.lua +++ b/mods/mobs_jam/balrog.lua @@ -117,6 +117,7 @@ if (PATH_FINDER == nil) then PATH_FINDER = 1 end +local enable_tnt = minetest.settings:get_bool("enable_tnt") local spawn_nodes = {"group:stone"} if minetest.get_modpath("nether") then @@ -206,15 +207,18 @@ mobs:register_mob("mobs_jam:balrog", { texture = "fire_basic_flame.png", collisiondetection = true, }) - tnt.boom(pos, { - name = "Balrog's Blast", - radius = 14, - damage_radius = 50, - disable_drops = true, - ignore_protection = false, - ignore_on_blast = false, - tiles = {""}, - }) + -- Default to enabled when in singleplayer + if enable_tnt then + tnt.boom(pos, { + name = "Balrog's Blast", + radius = 14, + damage_radius = 50, + disable_drops = true, + ignore_protection = false, + ignore_on_blast = false, + tiles = {""}, + }) + end end) end, })