Make TNT and TNT Minecart use the explosions API

The old api from mcl_tnt is still left in the code, and used by the
mobs.
This commit is contained in:
Elias Åström 2020-04-17 20:36:39 +02:00
parent ca7c8c23c7
commit fd05259202
4 changed files with 5 additions and 4 deletions

@ -1,3 +1,4 @@
mcl_explosions
mcl_core mcl_core
mcl_sounds mcl_sounds
mcl_player mcl_player

@ -206,7 +206,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
-- Explode if already ignited -- Explode if already ignited
if self._boomtimer then if self._boomtimer then
self.object:remove() self.object:remove()
tnt.boom(pos) mcl_explosions.explode(pos, 4, { drop_chance = 1.0 })
return return
end end
@ -249,7 +249,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
local pos = self.object:get_pos() local pos = self.object:get_pos()
if self._boomtimer <= 0 then if self._boomtimer <= 0 then
self.object:remove() self.object:remove()
tnt.boom(pos) mcl_explosions.explode(pos, 4, { drop_chance = 1.0 })
return return
else else
tnt.smoke_step(pos) tnt.smoke_step(pos)

@ -1,3 +1,4 @@
mcl_explosions
mcl_sounds? mcl_sounds?
mcl_mobitems? mcl_mobitems?
mcl_death_messages? mcl_death_messages?

@ -104,7 +104,6 @@ minetest.register_node("mcl_tnt:tnt", {
groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 }, groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 },
mesecons = tnt_mesecons, mesecons = tnt_mesecons,
on_blast = function(pos) on_blast = function(pos)
minetest.chat_send_all("on_blast " .. minetest.pos_to_string(pos))
spawn_tnt(pos, "mcl_tnt:tnt") spawn_tnt(pos, "mcl_tnt:tnt")
return true return true
end, end,
@ -209,7 +208,7 @@ function TNT:on_step(dtime)
self.blinkstatus = not self.blinkstatus self.blinkstatus = not self.blinkstatus
end end
if self.timer > tnt.BOOMTIMER then if self.timer > tnt.BOOMTIMER then
tnt.boom(self.object:get_pos(), nil, self.object) mcl_explosions.explode(self.object:get_pos(), 4, { drop_chance = 1.0 })
self.object:remove() self.object:remove()
end end
end end