Allow putting chest on carpeted llama by owner, enable swapping carpets
parent
8c855f5b09
commit
41bfaae370
|
@ -165,6 +165,25 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
end
|
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
|
-- Place carpet
|
||||||
--TODO: Re-enable this code when carpet textures arrived.
|
--TODO: Re-enable this code when carpet textures arrived.
|
||||||
if minetest.get_item_group(item:get_name(), "carpet") == 1 then
|
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
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
clicker:set_wielded_item(item)
|
clicker:set_wielded_item(item)
|
||||||
|
|
||||||
|
--shoot off old carpet
|
||||||
|
if self.carpet then
|
||||||
|
minetest.add_item(self.object:get_pos(), self.carpet)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local substr = carpetdata[2]
|
local substr = carpetdata[2]
|
||||||
|
|
||||||
--shoot off old carpet
|
|
||||||
if self.carpet then
|
|
||||||
print(substr)
|
|
||||||
end
|
|
||||||
|
|
||||||
local tex_carpet = "mobs_mc_llama_decor_"..substr..".png"
|
local tex_carpet = "mobs_mc_llama_decor_"..substr..".png"
|
||||||
|
|
||||||
self.base_texture = table.copy(self.base_texture)
|
self.base_texture = table.copy(self.base_texture)
|
||||||
self.base_texture[2] = tex_carpet
|
self.base_texture[2] = tex_carpet
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
|
@ -204,16 +224,18 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- detatch player already riding llama
|
if self.carpet then
|
||||||
if self.driver and clicker == self.driver then
|
-- detatch player already riding llama
|
||||||
|
if self.driver and clicker == self.driver then
|
||||||
|
|
||||||
mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
||||||
|
|
||||||
-- attach player to llama
|
-- attach player to llama
|
||||||
elseif not self.driver then
|
elseif not self.driver then
|
||||||
|
|
||||||
self.object:set_properties({stepheight = 1.1})
|
self.object:set_properties({stepheight = 1.1})
|
||||||
mobs.attach(self, clicker)
|
mobs.attach(self, clicker)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue