Add fire explosions

This commit is contained in:
Wuzzy 2020-05-02 19:05:56 +02:00
parent 00acbf8a2a
commit bc740efafe
5 changed files with 19 additions and 13 deletions

View file

@ -3824,7 +3824,7 @@ end
-- no damage to nodes explosion
function mobs:safe_boom(self, pos, radius)
function mobs:safe_boom(self, pos, strength)
minetest.sound_play(self.sounds and self.sounds.explode or "tnt_explode", {
pos = pos,
gain = 1.0,
@ -3837,13 +3837,13 @@ end
-- make explosion with protection and tnt mod check
function mobs:boom(self, pos, radius)
function mobs:boom(self, pos, strength, fire)
if mod_explosions then
if mobs_griefing and not minetest.is_protected(pos, "") then
mcl_explosions.explode(pos, self.explosion_strength, { drop_chance = 1.0 }, self.object)
mcl_explosions.explode(pos, strength, { drop_chance = 1.0, fire = fire }, self.object)
else
mobs:safe_boom(self, pos, radius)
mobs:safe_boom(self, pos, strength)
end
else
mobs:safe_boom(self, pos, radius)

View file

@ -79,13 +79,12 @@ mobs:register_arrow("mobs_mc:fireball", {
textures = {"mcl_fire_fire_charge.png"},
velocity = 15,
-- direct hit, no fire... just plenty of pain
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 6},
}, nil)
mobs:boom(self, self.object:get_pos(), 3)
mobs:boom(self, self.object:get_pos(), 1, true)
end,
hit_mob = function(self, mob)
@ -93,12 +92,11 @@ mobs:register_arrow("mobs_mc:fireball", {
full_punch_interval = 1.0,
damage_groups = {fleshy = 6},
}, nil)
mobs:boom(self, self.object:get_pos(), 3)
mobs:boom(self, self.object:get_pos(), 1, true)
end,
-- node hit, explode
hit_node = function(self, pos, node)
mobs:boom(self, pos, 3)
mobs:boom(self, pos, 1, true)
end
})