Fix crash when blowing up TNT

This commit is contained in:
Wuzzy 2017-07-31 02:06:00 +02:00
parent f27902df03
commit 096744dc6c
1 changed files with 4 additions and 3 deletions

View File

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