From 855fd6b279bd14870e69e294038c048b6caefd6f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 5 Dec 2020 01:49:15 +0100 Subject: [PATCH] Drop XP when breeding --- mods/ENTITIES/mcl_mobs/api.lua | 9 +++++++-- mods/ENTITIES/mcl_mobs/mod.conf | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 13a2aec42b..a9afcf0f2d 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -102,7 +102,7 @@ local mod_mobspawners = minetest.get_modpath("mcl_mobspawners") ~= nil local mod_hunger = minetest.get_modpath("mcl_hunger") ~= nil local mod_worlds = minetest.get_modpath("mcl_worlds") ~= nil local mod_armor = minetest.get_modpath("mcl_armor") ~= nil - +local mod_experience = minetest.get_modpath("mcl_experience") ~= nil ----For Water Flowing: local enable_physics = function(object, luaentity, ignore_check) @@ -722,7 +722,7 @@ local check_for_death = function(self, cause, cmi_cause) local pos = self.object:get_pos() - if mcl_experience.throw_experience and self.hp_min and self.hp_max then + if mod_experience and self.hp_min and self.hp_max then mcl_experience.throw_experience(pos, math.ceil( math.random(self.hp_min,self.hp_max+5) / 5) ) end @@ -1410,6 +1410,11 @@ local breed = function(self) return end + -- Give XP + if mod_experience then + mcl_experience.throw_experience(pos, math.random(1, 7)) + end + -- custom breed function if parent1.on_breed then -- when false, skip going any further diff --git a/mods/ENTITIES/mcl_mobs/mod.conf b/mods/ENTITIES/mcl_mobs/mod.conf index 986fef084b..c3d9713744 100644 --- a/mods/ENTITIES/mcl_mobs/mod.conf +++ b/mods/ENTITIES/mcl_mobs/mod.conf @@ -1,3 +1,3 @@ name = mcl_mobs depends = mcl_particles -optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor, mcl_portals +optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience