Add mobs:spawn_child
This commit is contained in:
parent
940b3748fb
commit
b2d9c119ac
4 changed files with 72 additions and 100 deletions
|
@ -253,37 +253,9 @@ local horse = {
|
|||
|
||||
on_breed = function(parent1, parent2)
|
||||
local pos = parent1.object:get_pos()
|
||||
local mob = minetest.add_entity(pos, parent1.name)
|
||||
|
||||
-- resize to half height
|
||||
mob:set_properties({
|
||||
visual_size = {
|
||||
x = parent1.base_size.x * .5,
|
||||
y = parent1.base_size.y * .5,
|
||||
},
|
||||
collisionbox = {
|
||||
parent1.base_colbox[1] * .5,
|
||||
parent1.base_colbox[2] * .5,
|
||||
parent1.base_colbox[3] * .5,
|
||||
parent1.base_colbox[4] * .5,
|
||||
parent1.base_colbox[5] * .5,
|
||||
parent1.base_colbox[6] * .5,
|
||||
},
|
||||
selectionbox = {
|
||||
parent1.base_selbox[1] * .5,
|
||||
parent1.base_selbox[2] * .5,
|
||||
parent1.base_selbox[3] * .5,
|
||||
parent1.base_selbox[4] * .5,
|
||||
parent1.base_selbox[5] * .5,
|
||||
parent1.base_selbox[6] * .5,
|
||||
},
|
||||
})
|
||||
local ent = mob:get_luaentity()
|
||||
-- tamed and owned by parents' owner
|
||||
ent.child = true
|
||||
ent.tamed = true
|
||||
ent.owner = parent1.owner
|
||||
return false
|
||||
if mobs:spawn_child(pos, parent1.name) then
|
||||
return false
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
|
@ -171,38 +171,9 @@ mobs:register_mob("mobs_mc:pig", {
|
|||
|
||||
on_breed = function(parent1, parent2)
|
||||
local pos = parent1.object:get_pos()
|
||||
local mob = minetest.add_entity(pos, parent1.name)
|
||||
|
||||
-- resize to half height
|
||||
mob:set_properties({
|
||||
visual_size = {
|
||||
x = parent1.base_size.x * .5,
|
||||
y = parent1.base_size.y * .5,
|
||||
},
|
||||
collisionbox = {
|
||||
parent1.base_colbox[1] * .5,
|
||||
parent1.base_colbox[2] * .5,
|
||||
parent1.base_colbox[3] * .5,
|
||||
parent1.base_colbox[4] * .5,
|
||||
parent1.base_colbox[5] * .5,
|
||||
parent1.base_colbox[6] * .5,
|
||||
},
|
||||
selectionbox = {
|
||||
parent1.base_selbox[1] * .5,
|
||||
parent1.base_selbox[2] * .5,
|
||||
parent1.base_selbox[3] * .5,
|
||||
parent1.base_selbox[4] * .5,
|
||||
parent1.base_selbox[5] * .5,
|
||||
parent1.base_selbox[6] * .5,
|
||||
},
|
||||
})
|
||||
local ent = mob:get_luaentity()
|
||||
|
||||
-- tamed and owned by parents' owner
|
||||
ent.child = true
|
||||
ent.tamed = true
|
||||
ent.owner = parent1.owner
|
||||
return false
|
||||
if mobs:spawn_child(pos, parent1.name) then
|
||||
return false
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue