From 940b3748fbd663c9c5e4bb0aff62f6b35993cbf6 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 30 May 2018 12:34:16 +0200 Subject: [PATCH] Fix horse child keeping horse armor of parent --- mods/ENTITIES/mobs_mc/horse.lua | 37 ++++++++++++++++++++++++++++++++- mods/ENTITIES/mobs_mc/pig.lua | 1 + 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index 7672eb66e..60f8738d4 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -249,7 +249,42 @@ local horse = { mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) end end - end + end, + + 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 + end, } mobs:register_mob("mobs_mc:horse", horse) diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index 4ec550970..d8b80ed0c 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -197,6 +197,7 @@ mobs:register_mob("mobs_mc:pig", { }, }) local ent = mob:get_luaentity() + -- tamed and owned by parents' owner ent.child = true ent.tamed = true