1
0
Fork 0

Allow putting chest on carpeted llama by owner, enable swapping carpets

This commit is contained in:
jordan4ibanez 2021-04-24 20:02:59 -04:00
parent 8c855f5b09
commit 41bfaae370
2 changed files with 35 additions and 13 deletions

View File

@ -165,6 +165,25 @@ mobs:register_mob("mobs_mc:llama", {
end
--put chest on carpeted llama
if self.carpet and not self.chest and item:get_name() == "mcl_chests:chest" then
if not minetest.is_creative_enabled(clicker:get_player_name()) then
item:take_item()
clicker:set_wielded_item(item)
end
self.base_texture = table.copy(self.base_texture)
self.base_texture[1] = "mobs_mc_llama_chest.png"
self.object:set_properties({
textures = self.base_texture,
})
self.chest = true
return --don't attempt to ride
end
-- Place carpet
--TODO: Re-enable this code when carpet textures arrived.
if minetest.get_item_group(item:get_name(), "carpet") == 1 then
@ -174,15 +193,16 @@ mobs:register_mob("mobs_mc:llama", {
if not minetest.is_creative_enabled(clicker:get_player_name()) then
item:take_item()
clicker:set_wielded_item(item)
end
local substr = carpetdata[2]
--shoot off old carpet
if self.carpet then
print(substr)
minetest.add_item(self.object:get_pos(), self.carpet)
end
end
local substr = carpetdata[2]
local tex_carpet = "mobs_mc_llama_decor_"..substr..".png"
self.base_texture = table.copy(self.base_texture)
self.base_texture[2] = tex_carpet
self.object:set_properties({
@ -204,6 +224,7 @@ mobs:register_mob("mobs_mc:llama", {
end
end
if self.carpet then
-- detatch player already riding llama
if self.driver and clicker == self.driver then
@ -215,6 +236,7 @@ mobs:register_mob("mobs_mc:llama", {
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
end
end
end
end,

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB