Drop XP when breeding

This commit is contained in:
Wuzzy 2020-12-05 01:49:15 +01:00
parent a56df1e533
commit 855fd6b279
2 changed files with 8 additions and 3 deletions

View file

@ -102,7 +102,7 @@ local mod_mobspawners = minetest.get_modpath("mcl_mobspawners") ~= nil
local mod_hunger = minetest.get_modpath("mcl_hunger") ~= nil local mod_hunger = minetest.get_modpath("mcl_hunger") ~= nil
local mod_worlds = minetest.get_modpath("mcl_worlds") ~= nil local mod_worlds = minetest.get_modpath("mcl_worlds") ~= nil
local mod_armor = minetest.get_modpath("mcl_armor") ~= nil local mod_armor = minetest.get_modpath("mcl_armor") ~= nil
local mod_experience = minetest.get_modpath("mcl_experience") ~= nil
----For Water Flowing: ----For Water Flowing:
local enable_physics = function(object, luaentity, ignore_check) 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() 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) ) mcl_experience.throw_experience(pos, math.ceil( math.random(self.hp_min,self.hp_max+5) / 5) )
end end
@ -1410,6 +1410,11 @@ local breed = function(self)
return return
end end
-- Give XP
if mod_experience then
mcl_experience.throw_experience(pos, math.random(1, 7))
end
-- custom breed function -- custom breed function
if parent1.on_breed then if parent1.on_breed then
-- when false, skip going any further -- when false, skip going any further

View file

@ -1,3 +1,3 @@
name = mcl_mobs name = mcl_mobs
depends = mcl_particles 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