Merge pull request 'Fix crash on rapidly fired rocket-arrows' (#2273) from fix_rocket_crash into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2273
This commit is contained in:
commit
dd9a93ca19
|
@ -134,6 +134,7 @@ function mcl_burning.set_on_fire(obj, burn_time)
|
|||
end
|
||||
|
||||
function mcl_burning.extinguish(obj)
|
||||
if not obj:get_pos() then return end
|
||||
if mcl_burning.is_burning(obj) then
|
||||
local storage = mcl_burning.get_storage(obj)
|
||||
if obj:is_player() then
|
||||
|
|
|
@ -19,15 +19,16 @@ local function dir_to_pitch(dir)
|
|||
end
|
||||
|
||||
local function damage_explosion(self, damagemulitplier)
|
||||
mcl_explosions.explode(self.object:get_pos(), 3, {})
|
||||
local objects = minetest.get_objects_inside_radius(self.object:get_pos(), 8)
|
||||
local p = self.object:get_pos()
|
||||
mcl_explosions.explode(p, 3, {})
|
||||
local objects = minetest.get_objects_inside_radius(p, 8)
|
||||
for _,obj in pairs(objects) do
|
||||
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
|
||||
obj:punch(self.object, 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())
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user