Check if spawndef exists when spawning

This commit is contained in:
cora 2022-11-13 15:57:14 +01:00
parent 7bd0b5a9b1
commit ebf214c043
2 changed files with 89 additions and 86 deletions

View File

@ -282,6 +282,8 @@ end
function mob_class:check_head_swivel(dtime)
if not self.head_swivel or type(self.head_swivel) ~= "string" then return end
local final_rotation = vector.new(0,0,0)
local oldp,oldr = self.object:get_bone_position(self.head_swivel)
local pos = self.object:get_pos()
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 10)) do
@ -348,7 +350,6 @@ function mob_class:check_head_swivel(dtime)
mcl_util.set_bone_position(self.object,self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), final_rotation)
end
end
function mob_class:set_animation_speed()
local v = self.object:get_velocity()

View File

@ -664,6 +664,7 @@ if mobs_spawn then
end
local mob_def = mob_library_worker_table[mob_index]
--minetest.log(mob_def.name.." "..step_chance.. " "..mob_chance)
if mob_def and mob_def.name and minetest.registered_entities[mob_def.name] then
local spawn_in_group = minetest.registered_entities[mob_def.name].spawn_in_group or 4
local spawn_in_group_min = minetest.registered_entities[mob_def.name].spawn_in_group_min or 1
local mob_type = minetest.registered_entities[mob_def.name].type
@ -694,6 +695,7 @@ if mobs_spawn then
object = mcl_mobs.spawn(spawning_position, mob_def.name)
end
end
end
current_summary_chance = current_summary_chance - mob_chance
table_remove(mob_library_worker_table, mob_index)
end