diff --git a/mobf/mgen_follow/main_follow.lua b/mobf/mgen_follow/main_follow.lua index 09f24f1..e251dfe 100644 --- a/mobf/mgen_follow/main_follow.lua +++ b/mobf/mgen_follow/main_follow.lua @@ -198,6 +198,14 @@ function mgen_follow.callback(entity,now) targetpos = entity.dynamic_data.movement.target:getpos() end + if targetpos == nil then + mobf_bug_warning(LOGLEVEL_ERROR,"MOBF: " .. entity.data.name + .. " don't have targetpos " + .. "SP: " .. dump(entity.dynamic_data.spawning.spawnpoint) + .. " TGT: " .. dump(entity.dynamic_data.movement.target)) + return + end + local distance = mobf_calc_distance_2d(basepos,targetpos) local yaccel = environment.get_default_gravity(basepos, @@ -395,4 +403,4 @@ end --register this movement generator -registerMovementGen(mgen_follow.name,mgen_follow) \ No newline at end of file +registerMovementGen(mgen_follow.name,mgen_follow)