mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 00:19:32 +01:00
Support mob explosions again
This commit is contained in:
parent
b25254e516
commit
388b324fb1
3 changed files with 46 additions and 34 deletions
|
@ -1694,7 +1694,7 @@ local do_states = function(self, dtime)
|
|||
|
||||
self.object:remove()
|
||||
|
||||
if minetest.get_modpath("tnt") and tnt and tnt.boom
|
||||
if minetest.get_modpath("mcl_tnt") and tnt and tnt.boom
|
||||
and not minetest.is_protected(pos, "") then
|
||||
|
||||
tnt.boom(pos, {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
mcl_core
|
||||
mcl_tnt?
|
||||
invisibility?
|
||||
intllib?
|
||||
lucky_block?
|
||||
|
|
|
@ -158,22 +158,35 @@ function TNT:on_step(dtime)
|
|||
self.blinkstatus = not self.blinkstatus
|
||||
end
|
||||
if self.timer > 4 then
|
||||
local pos = self.object:getpos()
|
||||
tnt.boom(self.object:getpos(), TNT_RANGE)
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
|
||||
tnt.boom = function(pos, info)
|
||||
local range = info.radius
|
||||
local damage_range = info.damage_radius
|
||||
|
||||
pos.x = math.floor(pos.x+0.5)
|
||||
pos.y = math.floor(pos.y+0.5)
|
||||
pos.z = math.floor(pos.z+0.5)
|
||||
do_tnt_physics(pos, TNT_RANGE)
|
||||
do_tnt_physics(pos, range)
|
||||
local meta = minetest.get_meta(pos)
|
||||
minetest.sound_play("tnt_explode", {pos = pos,gain = 1.0,max_hear_distance = 16,})
|
||||
local sound
|
||||
if not info.sound then
|
||||
sound = "tnt_explode"
|
||||
else
|
||||
sound = info.sound
|
||||
end
|
||||
minetest.sound_play(sound, {pos = pos,gain = 1.0,max_hear_distance = 16,})
|
||||
if minetest.get_node(pos).name == "mcl_core:water_source" or minetest.get_node(pos).name == "mcl_core:water_flowing" or minetest.get_node(pos).name == "mcl_core:bedrock" or minetest.get_node(pos).name == "protector:display" or minetest.is_protected(pos, "tnt") then
|
||||
-- Cancel the Explosion
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
for x=-TNT_RANGE,TNT_RANGE do
|
||||
for y=-TNT_RANGE,TNT_RANGE do
|
||||
for z=-TNT_RANGE,TNT_RANGE do
|
||||
if x*x+y*y+z*z <= TNT_RANGE * TNT_RANGE + TNT_RANGE then
|
||||
for x=-range,range do
|
||||
for y=-range,range do
|
||||
for z=-range,range do
|
||||
if x*x+y*y+z*z <= range * range + range then
|
||||
local np={x=pos.x+x,y=pos.y+y,z=pos.z+z}
|
||||
local n = minetest.get_node(np)
|
||||
local def = minetest.registered_nodes[n.name]
|
||||
|
@ -197,9 +210,7 @@ function TNT:on_step(dtime)
|
|||
end
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
add_effects(pos, TNT_RANGE, {})
|
||||
end
|
||||
add_effects(pos, range, {})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue