Fix crash when blowing up TNT

This commit is contained in:
Wuzzy 2017-07-31 02:06:00 +02:00
parent f27902df03
commit 096744dc6c

View file

@ -158,14 +158,15 @@ function TNT:on_step(dtime)
self.blinkstatus = not self.blinkstatus self.blinkstatus = not self.blinkstatus
end end
if self.timer > 4 then if self.timer > 4 then
tnt.boom(self.object:getpos(), TNT_RANGE) tnt.boom(self.object:getpos())
self.object:remove() self.object:remove()
end end
end end
tnt.boom = function(pos, info) tnt.boom = function(pos, info)
local range = info.radius if not info then info = {} end
local damage_range = info.damage_radius local range = info.radius or TNT_RANGE
local damage_range = info.damage_radius or TNT_RANGE
pos.x = math.floor(pos.x+0.5) pos.x = math.floor(pos.x+0.5)
pos.y = math.floor(pos.y+0.5) pos.y = math.floor(pos.y+0.5)