From 68b25c9d0853b6483fbb1dd58c8ca771898fe084 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 11 Apr 2025 10:12:30 +0100 Subject: [PATCH] use tnt or mcl_explosions for mobs:boom --- api.lua | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/api.lua b/api.lua index bf87ade..825d3dc 100644 --- a/api.lua +++ b/api.lua @@ -3934,22 +3934,28 @@ function mobs:safe_boom(self, pos, radius, texture) effect(pos, 32, texture, radius * 3, radius * 5, radius, 1, 0) end --- explosion with protection and tnt mod check +-- explosion with tnt mod checks function mobs:boom(self, pos, node_damage_radius, entity_radius, texture) texture = texture or "mobs_tnt_smoke.png" - if mobs_griefing and minetest.get_modpath("tnt") and tnt and tnt.boom - and not minetest.is_protected(pos, "") then + if mobs_griefing then - tnt.boom(pos, { - radius = node_damage_radius, - damage_radius = entity_radius, - sound = self and self.sounds and self.sounds.explode or "tnt_explode", - explode_center = true, - tiles = texture - }) + if minetest.get_modpath("mcl_explosions") then + + mcl_explosions.explode(pos, node_damage_radius) + + elseif minetest.get_modpath("tnt") and tnt and tnt.boom then + + tnt.boom(pos, { + radius = node_damage_radius, + damage_radius = entity_radius, + sound = self and self.sounds and self.sounds.explode or "tnt_explode", + explode_center = true, + tiles = texture + }) + end else mobs:safe_boom(self, pos, node_damage_radius, texture) end