1
0
Fork 0

Fix breeding giving weird childs

This commit is contained in:
Wuzzy 2018-05-31 04:38:37 +02:00
parent 97e550bb9f
commit e246b5d0bb
3 changed files with 35 additions and 4 deletions

View File

@ -988,10 +988,16 @@ local breed = function(self)
local ent_c = child:get_luaentity()
-- Use parent's texture
local textures = self.base_texture
-- Use texture of one of the parents
local p = math.random(1, 2)
if p == 1 then
ent_c.base_texture = self.base_texture
else
ent_c.base_texture = ent.base_texture
end
child:set_properties({
textures = textures,
textures = ent_c.base_texture
})
-- tamed and owned by parents' owner

View File

@ -261,7 +261,16 @@ local horse = {
on_breed = function(parent1, parent2)
local pos = parent1.object:get_pos()
if mobs:spawn_child(pos, parent1.name) then
local child = mobs:spawn_child(pos, parent1.name)
if child then
local ent_c = child:get_luaentity()
local p = math.random(1, 2)
if p == 1 then
ent_c.base_texture = parent1.base_texture
else
ent_c.base_texture = parent2.base_texture
end
child:set_properties({textures = ent_c.base_texture})
return false
end
end,

View File

@ -206,6 +206,22 @@ mobs:register_mob("mobs_mc:sheep", {
end
if mobs:capture_mob(self, clicker, 0, 5, 70, false, nil) then return end
end,
on_breed = function(parent1, parent2)
local pos = parent1.object:get_pos()
local child = mobs:spawn_child(pos, parent1.name)
if child then
local ent_c = child:get_luaentity()
local p = math.random(1, 2)
if p == 1 then
ent_c.base_texture = sheep_texture(parent1.color)
else
ent_c.base_texture = sheep_texture(parent2.color)
end
child:set_properties({textures = ent_c.base_texture})
ent_c.initial_color_set = true
return false
end
end,
})
mobs:spawn_specific("mobs_mc:sheep", mobs_mc.spawn.grassland, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max)