mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-24 00:49:34 +01:00
Make mobs only drop XP orbs when they're killed by hit, attempt to fix https://git.minetest.land/Wuzzy/MineClone2/issues/978
This commit is contained in:
parent
0c23406531
commit
7210dfcc1c
1 changed files with 4 additions and 6 deletions
|
@ -789,18 +789,16 @@ local check_for_death = function(self, cause, cmi_cause)
|
||||||
local puncher = cmi_cause.puncher
|
local puncher = cmi_cause.puncher
|
||||||
if puncher then
|
if puncher then
|
||||||
wielditem = puncher:get_wielded_item()
|
wielditem = puncher:get_wielded_item()
|
||||||
|
|
||||||
|
if mod_experience and ((not self.child) or self.type ~= "animal") then
|
||||||
|
mcl_experience.throw_experience(self.object:get_pos(), math.random(self.xp_min, self.xp_max))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local cooked = mcl_burning.is_burning(self.object) or mcl_enchanting.has_enchantment(wielditem, "fire_aspect")
|
local cooked = mcl_burning.is_burning(self.object) or mcl_enchanting.has_enchantment(wielditem, "fire_aspect")
|
||||||
local looting = mcl_enchanting.get_enchantment(wielditem, "looting")
|
local looting = mcl_enchanting.get_enchantment(wielditem, "looting")
|
||||||
item_drop(self, cooked, looting)
|
item_drop(self, cooked, looting)
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
|
||||||
|
|
||||||
if mod_experience and ((not self.child) or self.type ~= "animal") then
|
|
||||||
mcl_experience.throw_experience(pos, math.random(self.xp_min, self.xp_max))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- execute custom death function
|
-- execute custom death function
|
||||||
|
|
Loading…
Reference in a new issue