Fix crash when hostile mobs are disabled ()

Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4989
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: teknomunk <teknomunk@protonmail.com>
Co-committed-by: teknomunk <teknomunk@protonmail.com>
This commit is contained in:
teknomunk 2025-03-07 20:05:47 +01:00 committed by the-real-herowl
parent c89349251b
commit 6fab15e8df

View file

@ -620,11 +620,13 @@ function mcl_mobs.spawn(pos,id)
end
local start_time = core.get_us_time()
local obj = core.add_entity(pos, def.name)
if not obj then return end
--note = "spawned a mob"
exclude_time = exclude_time + core.get_us_time() - start_time
-- initialize head bone
if def.head_swivel and def.head_bone_position then
if obj and obj.get_bone_override then -- minetest >= 5.9
if obj.get_bone_override then -- minetest >= 5.9
obj:set_bone_override(def.head_swivel, {
position = { vec = def.head_bone_position, absolute = true },
rotation = { vec = vector.zero(), absolute = true }