mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-24 00:49:34 +01:00
Check if spawndef exists when spawning
This commit is contained in:
parent
7bd0b5a9b1
commit
ebf214c043
2 changed files with 89 additions and 86 deletions
|
@ -282,6 +282,8 @@ end
|
||||||
function mob_class:check_head_swivel(dtime)
|
function mob_class:check_head_swivel(dtime)
|
||||||
if not self.head_swivel or type(self.head_swivel) ~= "string" then return end
|
if not self.head_swivel or type(self.head_swivel) ~= "string" then return end
|
||||||
local final_rotation = vector.new(0,0,0)
|
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()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 10)) do
|
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)
|
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
|
||||||
end
|
|
||||||
|
|
||||||
function mob_class:set_animation_speed()
|
function mob_class:set_animation_speed()
|
||||||
local v = self.object:get_velocity()
|
local v = self.object:get_velocity()
|
||||||
|
|
|
@ -664,6 +664,7 @@ if mobs_spawn then
|
||||||
end
|
end
|
||||||
local mob_def = mob_library_worker_table[mob_index]
|
local mob_def = mob_library_worker_table[mob_index]
|
||||||
--minetest.log(mob_def.name.." "..step_chance.. " "..mob_chance)
|
--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 = 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 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
|
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)
|
object = mcl_mobs.spawn(spawning_position, mob_def.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
current_summary_chance = current_summary_chance - mob_chance
|
current_summary_chance = current_summary_chance - mob_chance
|
||||||
table_remove(mob_library_worker_table, mob_index)
|
table_remove(mob_library_worker_table, mob_index)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue