diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index ae89a15e05..7c66a5f52c 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -384,8 +384,10 @@ local item_drop = function(self, cooked) -- no drops if disabled by setting if not mobs_drop_items then return end - -- no drops for child mobs - if self.child then return end + -- no drops for child mobs (except monster) + if (self.child and self.type ~= "monster") then + return + end local obj, item, num local pos = self.object:get_pos() @@ -740,7 +742,7 @@ local do_jump = function(self) if not self.jump or self.jump_height == 0 or self.fly - or self.child + or (self.child and self.type ~= "monster") or self.order == "stand" then return false end @@ -2546,7 +2548,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) -- attack puncher and call other mobs for help if self.passive == false and self.state ~= "flop" - and self.child == false + and (self.child == false or self.type == "monster") and hitter:get_player_name() ~= self.owner and not mobs.invis[ name ] then @@ -3064,7 +3066,6 @@ minetest.register_entity(name, { pause_timer = 0, horny = false, hornytimer = 0, - child = false, gotten = false, health = 0, reach = def.reach or 3, @@ -3101,6 +3102,8 @@ minetest.register_entity(name, { rain_damage = def.rain_damage or 0, glow = def.glow, can_despawn = can_despawn, + child = def.child or false, + -- End of MCL2 extensions on_spawn = def.on_spawn, diff --git a/mods/ENTITIES/mcl_mobs/api.txt b/mods/ENTITIES/mcl_mobs/api.txt index 5baab263e1..10b2141275 100644 --- a/mods/ENTITIES/mcl_mobs/api.txt +++ b/mods/ENTITIES/mcl_mobs/api.txt @@ -216,6 +216,7 @@ functions needed for the mob to work properly which contains the following: 'spawn_small_alternative': name of a smaller mob to use as replacement if spawning fails due to space requirements 'glow' same as in entity definition + 'child' if true, spawn mob as child Node Replacement ---------------- diff --git a/mods/ENTITIES/mobs_mc/zombie.lua b/mods/ENTITIES/mobs_mc/zombie.lua index 0b329c55d4..8f27ed3cab 100644 --- a/mods/ENTITIES/mobs_mc/zombie.lua +++ b/mods/ENTITIES/mobs_mc/zombie.lua @@ -92,6 +92,7 @@ baby_zombie.visual_size = {x=zombie.visual_size.x/2, y=zombie.visual_size.y/2} baby_zombie.walk_velocity = 1.2 baby_zombie.run_velocity = 2.4 baby_zombie.sunlight_damage = 0 +baby_zombie.child = 1 mobs:register_mob("mobs_mc:baby_zombie", baby_zombie) @@ -113,6 +114,7 @@ baby_husk.collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.94, 0.25} baby_husk.visual_size = {x=zombie.visual_size.x/2, y=zombie.visual_size.y/2} baby_husk.walk_velocity = 1.2 baby_husk.run_velocity = 2.4 +baby_husk.child = 1 mobs:register_mob("mobs_mc:baby_husk", baby_husk) diff --git a/mods/ENTITIES/mobs_mc/zombiepig.lua b/mods/ENTITIES/mobs_mc/zombiepig.lua index a4b1db60d8..b61d507f90 100644 --- a/mods/ENTITIES/mobs_mc/zombiepig.lua +++ b/mods/ENTITIES/mobs_mc/zombiepig.lua @@ -96,6 +96,7 @@ baby_pigman.textures = { { baby_pigman.walk_velocity = 1.2 baby_pigman.run_velocity = 2.4 baby_pigman.light_damage = 0 +baby_pigman.child = 1 mobs:register_mob("mobs_mc:baby_pigman", baby_pigman)