Merge pull request 'Fix a crash with rocket explosion' (#4178) from fix_rocket_crash into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4178
Reviewed-by: 𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 <mrrar@noreply.git.minetest.land>
This commit is contained in:
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 2024-03-21 00:15:50 +00:00
commit e50ad7d6de

View file

@ -27,11 +27,11 @@ local function damage_explosion(self, damagemulitplier)
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(p, 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() and 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(p, obj:get_pos())}, damage_groups={fleshy=damagemulitplier - vector.distance(p, obj:get_pos())},
}, self.object:get_velocity()) }, self.object:get_velocity()) -- TODO possibly change the punch dir to be outwards instead of rocket velocity
end end
end end
end end