mirror of
https://github.com/LoneWolfHT/grenades_basic.git
synced 2025-03-29 02:42:29 +01:00
Fix potential crash
This commit is contained in:
7
init.lua
7
init.lua
@ -68,11 +68,12 @@ grenades.register_grenade("grenades_basic:frag", {
|
|||||||
|
|
||||||
blast(pos, radius/2)
|
blast(pos, radius/2)
|
||||||
|
|
||||||
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, radius)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, radius)) do
|
||||||
local hit = minetest.line_of_sight(pos, obj:get_pos())
|
local objpos = obj:get_pos()
|
||||||
|
local hit = minetest.line_of_sight(pos, objpos)
|
||||||
|
|
||||||
if hit ~= false and obj:get_hp() > 0 and not obj:get_luaentity().name:find("builtin") then
|
if hit ~= false and obj:get_hp() > 0 and not obj:get_luaentity().name:find("builtin") then
|
||||||
obj:punch(player, 2, {damage_groups = {grenade = 1, fleshy = 90 * 0.71 ^ vector.distance(pos, obj:get_pos())}}, nil)
|
obj:punch(player, 2, {damage_groups = {grenade = 1, fleshy = 90 * 0.71 ^ vector.distance(pos, objpos)}}, vector.direction(pos, objpos))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
Reference in New Issue
Block a user