mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 16:39:33 +01:00
Slime splitting: nil check child to prevent crash (that happened on oysterity-mcl2)
This commit is contained in:
parent
0e9a56fa35
commit
b945975427
1 changed files with 7 additions and 5 deletions
|
@ -31,6 +31,7 @@ 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 mob then
|
||||||
if (not mother_stuck) then
|
if (not mother_stuck) then
|
||||||
mob:set_velocity(vector.multiply(dir, eject_speed * speed_penalty))
|
mob:set_velocity(vector.multiply(dir, eject_speed * speed_penalty))
|
||||||
end
|
end
|
||||||
|
@ -38,6 +39,7 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance
|
||||||
table.insert(children, mob)
|
table.insert(children, mob)
|
||||||
angle = angle + (math.pi*2)/children_count
|
angle = angle + (math.pi*2)/children_count
|
||||||
end
|
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
|
||||||
minetest.after(1.0, function(children, enemy)
|
minetest.after(1.0, function(children, enemy)
|
||||||
|
|
Loading…
Reference in a new issue