Fix llama inv only being accessible by owner

This commit is contained in:
cora 2022-09-30 14:12:20 +02:00
parent d666493e59
commit 0e364fc22c

View File

@ -143,9 +143,12 @@ mcl_mobs:register_mob("mobs_mc:llama", {
end end
if mcl_mobs:protect(self, clicker) then return end if mcl_mobs:protect(self, clicker) then return end
if self._has_chest and clicker:get_player_control().sneak then
mcl_entity_invs.show_inv_form(self,clicker,"Llama - Strength "..math.floor(self._inv_size / 3))
return
end
-- Make sure tamed llama is mature and being clicked by owner only -- Make sure tamed llama is mature and being clicked by owner only
if self.tamed and not self.child and self.owner == clicker:get_player_name() then if self.tamed and not self.child and self.owner == clicker:get_player_name() then
-- Place carpet -- Place carpet
if minetest.get_item_group(item:get_name(), "carpet") == 1 and not self.carpet then if minetest.get_item_group(item:get_name(), "carpet") == 1 and not self.carpet then
for group, carpetdata in pairs(carpets) do for group, carpetdata in pairs(carpets) do
@ -177,11 +180,6 @@ mcl_mobs:register_mob("mobs_mc:llama", {
end end
end end
if clicker:get_player_control().sneak then
if self._has_chest then
mcl_entity_invs.show_inv_form(self,clicker,"Llama - Strength "..math.floor(self._inv_size / 3))
end
else
-- detatch player already riding llama -- detatch player already riding llama
if self.driver and clicker == self.driver then if self.driver and clicker == self.driver then
mcl_mobs.detach(clicker, {x = 1, y = 0, z = 1}) mcl_mobs.detach(clicker, {x = 1, y = 0, z = 1})
@ -191,7 +189,6 @@ mcl_mobs:register_mob("mobs_mc:llama", {
mcl_mobs.attach(self, clicker) mcl_mobs.attach(self, clicker)
end end
end end
end
end, end,
on_breed = function(parent1, parent2) on_breed = function(parent1, parent2)