horse: drops: remove 2nd saddle, add armor

This commit is contained in:
bakawun 2023-12-04 20:17:39 +01:00
parent 4b63ff1c2a
commit 2ba73f832c

View File

@ -44,18 +44,6 @@ local function get_drops(self)
max = 2, max = 2,
looting = "common", looting = "common",
}) })
if self._saddle then
table.insert(self.drops,{name = "mcl_mobitems:saddle",
chance = 1,
min = 1,
max = 1,})
end
if self._chest then
table.insert(self.drops,{name = "mcl_chests:chest",
chance = 1,
min = 1,
max = 1,})
end
end end
-- Helper functions to determine equipment rules -- Helper functions to determine equipment rules
@ -245,10 +233,18 @@ local horse = {
on_die = function(self, pos) on_die = function(self, pos)
-- drop saddle when horse is killed while riding -- drop saddle when horse is killed
if self._saddle then if self._saddle then
minetest.add_item(pos, "mcl_mobitems:saddle") minetest.add_item(pos, "mcl_mobitems:saddle")
end end
-- drop chest when mule/donkey is killed
if self._chest then
minetest.add_item(pos, "mcl_chests:chest")
end
-- drop armor when horse is killed
if self._wearing_armor then
minetest.add_item(pos, self._horse_armor)
end
-- also detach from horse properly -- also detach from horse properly
if self.driver then if self.driver then
mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1}) mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1})
@ -401,6 +397,7 @@ local horse = {
-- Put on armor and take armor from player's inventory -- Put on armor and take armor from player's inventory
local armor = minetest.get_item_group(iname, "horse_armor") local armor = minetest.get_item_group(iname, "horse_armor")
self._horse_armor = iname self._horse_armor = iname
self._wearing_armor = true
local w = clicker:get_wielded_item() local w = clicker:get_wielded_item()
if not minetest.is_creative_enabled(clicker:get_player_name()) then if not minetest.is_creative_enabled(clicker:get_player_name()) then
w:take_item() w:take_item()