Prevent punching with invalid userdata (#64)

Fixes for https://github.com/pandorabox-io/pandorabox.io/issues/445
This commit is contained in:
SX 2020-02-25 21:42:57 +02:00 committed by GitHub
parent a691afb6d8
commit f3d526eda7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -325,6 +325,9 @@ local damage_def = {
damage_groups = {},
}
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)
if objects ~= nil then
damage_def.damage_groups.fleshy = amount