mirror of
https://github.com/minetest-mods/digtron.git
synced 2025-01-03 09:37:27 +01:00
Prevent punching with invalid userdata (#64)
Fixes for https://github.com/pandorabox-io/pandorabox.io/issues/445
This commit is contained in:
parent
a691afb6d8
commit
f3d526eda7
5
util.lua
5
util.lua
@ -325,6 +325,9 @@ local damage_def = {
|
|||||||
damage_groups = {},
|
damage_groups = {},
|
||||||
}
|
}
|
||||||
digtron.damage_creatures = function(player, source_pos, target_pos, amount, items_dropped)
|
digtron.damage_creatures = function(player, source_pos, target_pos, amount, items_dropped)
|
||||||
|
if type(player) ~= 'userdata' then
|
||||||
|
return
|
||||||
|
end
|
||||||
local objects = minetest.env:get_objects_inside_radius(target_pos, 1.0)
|
local objects = minetest.env:get_objects_inside_radius(target_pos, 1.0)
|
||||||
if objects ~= nil then
|
if objects ~= nil then
|
||||||
damage_def.damage_groups.fleshy = amount
|
damage_def.damage_groups.fleshy = amount
|
||||||
@ -433,4 +436,4 @@ digtron.show_offset_markers = function(pos, offset, period)
|
|||||||
local entity = safe_add_entity({x=buildpos.x, y=buildpos.y, z=z_pos + period}, "digtron:marker")
|
local entity = safe_add_entity({x=buildpos.x, y=buildpos.y, z=z_pos + period}, "digtron:marker")
|
||||||
if entity ~= nil then entity:setyaw(1.5708) end
|
if entity ~= nil then entity:setyaw(1.5708) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user