Merge pull request 'A couple llama fixes' (#2688) from fix_llama_player_inv into master

Reviewed-on: MineClone2/MineClone2#2688
This commit is contained in:
cora 2022-10-01 01:21:51 +00:00
commit 3b873a89eb
2 changed files with 32 additions and 34 deletions

View File

@ -74,6 +74,7 @@ function mcl_entity_invs.show_inv_form(ent,player,show_name)
end end
local function drop_inv(ent) local function drop_inv(ent)
if not ent._items then return end
local pos = ent.object:get_pos() local pos = ent.object:get_pos()
for i,it in pairs(ent._items) do for i,it in pairs(ent._items) do
local p = vector.add(pos,vector.new(math.random() - 0.5, math.random()-0.5, math.random()-0.5)) local p = vector.add(pos,vector.new(math.random() - 0.5, math.random()-0.5, math.random()-0.5))

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)