1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 23:10:17 +01:00

TNT: Fix multiple explosions erasing drops

Any second explosion near a first TNT explosion will punch all
entities found nearby, including item drops. This causes the
item pickup code to think the item was picked up, but by
a `nil` player, thus removing the item.

We query for the immortal entity group, and if the item is in
the immortal group, do not punch the item.
This commit is contained in:
Auke Kok 2016-04-26 23:08:00 -07:00 committed by paramat
parent 1a6298958e
commit f14b411157

View File

@ -160,6 +160,7 @@ local function entity_physics(pos, radius)
local obj_vel = obj:getvelocity() local obj_vel = obj:getvelocity()
obj:setvelocity(calc_velocity(pos, obj_pos, obj:setvelocity(calc_velocity(pos, obj_pos,
obj_vel, radius * 10)) obj_vel, radius * 10))
if not obj:get_armor_groups().immortal then
obj:punch(obj, 1.0, { obj:punch(obj, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
damage_groups = {fleshy = damage}, damage_groups = {fleshy = damage},
@ -167,6 +168,7 @@ local function entity_physics(pos, radius)
end end
end end
end end
end
local function add_effects(pos, radius, drops) local function add_effects(pos, radius, drops)
minetest.add_particlespawner({ minetest.add_particlespawner({