1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-04-16 19:00:21 +02:00

use tnt or mcl_explosions for mobs:boom

This commit is contained in:
tenplus1 2025-04-11 10:12:30 +01:00
parent 24adcae920
commit 68b25c9d08

26
api.lua
View File

@ -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