Fix crash in mcl_bows/rocket.lua:41

This commit is contained in:
kay27 2022-03-13 17:42:58 +04:00
parent a637e4bdaf
commit 89cbc1deed
1 changed files with 8 additions and 5 deletions

View File

@ -38,11 +38,14 @@ local function damage_explosion(self, damagemulitplier)
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"})
elseif obj:get_luaentity()._cmi_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())},
}, self.object:get_velocity())
else
local entity = obj:get_luaentity()
if entity and entity._cmi_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())},
}, self.object:get_velocity())
end
end
end
end