Skip to content

Commit

Permalink
TNT: Fix multiple explosions erasing drops
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sofar authored and paramat committed Apr 30, 2016
1 parent 1a62989 commit f14b411
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions mods/tnt/init.lua
Expand Up @@ -160,10 +160,12 @@ local function entity_physics(pos, radius)
local obj_vel = obj:getvelocity()
obj:setvelocity(calc_velocity(pos, obj_pos,
obj_vel, radius * 10))
obj:punch(obj, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = damage},
}, nil)
if not obj:get_armor_groups().immortal then
obj:punch(obj, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = damage},
}, nil)
end
end
end
end
Expand Down

0 comments on commit f14b411

Please sign in to comment.