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

View File

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

View File

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

View File

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

View File

@ -104,7 +104,6 @@ minetest.register_node("mcl_tnt:tnt", {
groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 },
mesecons = tnt_mesecons,
on_blast = function(pos)
minetest.chat_send_all("on_blast " .. minetest.pos_to_string(pos))
spawn_tnt(pos, "mcl_tnt:tnt")
return true
end,
@ -209,7 +208,7 @@ function TNT:on_step(dtime)
self.blinkstatus = not self.blinkstatus
end
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()
end
end