mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2025-02-16 12:52:27 +01:00
Slime splitting: nil check child to prevent crash (that happened on oysterity-mcl2)
This commit is contained in:
@ -31,12 +31,14 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance
|
|||||||
speed_penalty = 0.5
|
speed_penalty = 0.5
|
||||||
end
|
end
|
||||||
local mob = minetest.add_entity(newpos, child_mob)
|
local mob = minetest.add_entity(newpos, child_mob)
|
||||||
if (not mother_stuck) then
|
if mob then
|
||||||
mob:set_velocity(vector.multiply(dir, eject_speed * speed_penalty))
|
if (not mother_stuck) then
|
||||||
|
mob:set_velocity(vector.multiply(dir, eject_speed * speed_penalty))
|
||||||
|
end
|
||||||
|
mob:set_yaw(angle - math.pi/2)
|
||||||
|
table.insert(children, mob)
|
||||||
|
angle = angle + (math.pi*2)/children_count
|
||||||
end
|
end
|
||||||
mob:set_yaw(angle - math.pi/2)
|
|
||||||
table.insert(children, mob)
|
|
||||||
angle = angle + (math.pi*2)/children_count
|
|
||||||
end
|
end
|
||||||
-- If mother was murdered, children attack the killer after 1 second
|
-- If mother was murdered, children attack the killer after 1 second
|
||||||
if self.state == "attack" then
|
if self.state == "attack" then
|
||||||
|
Reference in New Issue
Block a user