From bad1be5c5aaa5de6200c800c27a7da72ed31e7e1 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Sat, 3 Sep 2022 16:13:41 +0100 Subject: [PATCH] check pos/def for nil value in add_mob function --- api.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api.lua b/api.lua index 8c863fa..c2d6238 100644 --- a/api.lua +++ b/api.lua @@ -28,7 +28,7 @@ local use_cmi = minetest.global_exists("cmi") mobs = { mod = "redo", - version = "20220804", + version = "20220903", intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {} } @@ -1364,7 +1364,7 @@ local entity_physics = function(pos, radius) -- punches work on entities AND players objs[n]:punch(objs[n], 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = damage}, + damage_groups = {fleshy = damage} }, pos) end end @@ -3796,6 +3796,12 @@ end function mobs:add_mob(pos, def) + -- nil check + if not pos or not def then +--print("--- no position or definition given") + return + end + -- is mob actually registered? if not mobs.spawning_mobs[def.name] or not minetest.registered_entities[def.name] then