Be more careful with possibly expired objects
This commit is contained in:
parent
f1778d839d
commit
ef093d0c00
|
@ -134,6 +134,7 @@ function mcl_burning.set_on_fire(obj, burn_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_burning.extinguish(obj)
|
function mcl_burning.extinguish(obj)
|
||||||
|
if not obj:get_pos() then return end
|
||||||
if mcl_burning.is_burning(obj) then
|
if mcl_burning.is_burning(obj) then
|
||||||
local storage = mcl_burning.get_storage(obj)
|
local storage = mcl_burning.get_storage(obj)
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
|
|
|
@ -19,15 +19,16 @@ local function dir_to_pitch(dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function damage_explosion(self, damagemulitplier)
|
local function damage_explosion(self, damagemulitplier)
|
||||||
mcl_explosions.explode(self.object:get_pos(), 3, {})
|
local p = self.object:get_pos()
|
||||||
local objects = minetest.get_objects_inside_radius(self.object:get_pos(), 8)
|
mcl_explosions.explode(p, 3, {})
|
||||||
|
local objects = minetest.get_objects_inside_radius(p, 8)
|
||||||
for _,obj in pairs(objects) do
|
for _,obj in pairs(objects) do
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
mcl_util.deal_damage(obj, damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos()), {type = "explosion"})
|
mcl_util.deal_damage(obj, damagemulitplier - vector.distance(p, obj:get_pos()), {type = "explosion"})
|
||||||
elseif obj:get_luaentity().is_mob then
|
elseif obj:get_luaentity().is_mob then
|
||||||
obj:punch(self.object, 1.0, {
|
obj:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos())},
|
damage_groups={fleshy=damagemulitplier - vector.distance(p, obj:get_pos())},
|
||||||
}, self.object:get_velocity())
|
}, self.object:get_velocity())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue