Merge pull request 'Remove need to sneak click for breeding certain animals, enable llama carpets, enable llama chests (no op)' (#1637) from jordan4ibanez/MineClone2:mineclone5 into mineclone5
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1637
|
@ -160,7 +160,7 @@ mobs.make_baby_grow_faster = function(self,clicker)
|
||||||
local stack = clicker:get_wielded_item()
|
local stack = clicker:get_wielded_item()
|
||||||
--safety check
|
--safety check
|
||||||
if not stack then
|
if not stack then
|
||||||
return
|
return(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
local item_name = stack:get_name()
|
local item_name = stack:get_name()
|
||||||
|
@ -172,6 +172,10 @@ mobs.make_baby_grow_faster = function(self,clicker)
|
||||||
stack:take_item()
|
stack:take_item()
|
||||||
clicker:set_wielded_item(stack)
|
clicker:set_wielded_item(stack)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return(false)
|
||||||
end
|
end
|
|
@ -219,18 +219,17 @@ local horse = {
|
||||||
local heal = 0
|
local heal = 0
|
||||||
|
|
||||||
--sneak click to breed the horse/feed it
|
--sneak click to breed the horse/feed it
|
||||||
if self.owner and self.owner == clicker:get_player_name() and clicker:get_player_control().sneak then
|
if self.owner and self.owner == clicker:get_player_name() then
|
||||||
--attempt to enter breed state
|
--attempt to enter breed state
|
||||||
if mobs.enter_breed_state(self,clicker) then
|
if mobs.enter_breed_state(self,clicker) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--make baby grow faster
|
--don't do any other logic with the baby
|
||||||
if self.baby then
|
--make baby grow faster
|
||||||
mobs.make_baby_grow_faster(self,clicker)
|
if self.baby then
|
||||||
return
|
mobs.make_baby_grow_faster(self,clicker)
|
||||||
end
|
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -138,34 +138,71 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if clicker:get_player_control().sneak then
|
--owner is broken for this
|
||||||
--attempt to enter breed state
|
--we'll make the owner this guy
|
||||||
if mobs.enter_breed_state(self,clicker) then
|
--attempt to enter breed state
|
||||||
return
|
if mobs.enter_breed_state(self,clicker) then
|
||||||
end
|
self.tamed = true
|
||||||
|
self.owner = clicker:get_player_name()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
--make baby grow faster
|
--ignore other logic
|
||||||
if self.baby then
|
--make baby grow faster
|
||||||
mobs.make_baby_grow_faster(self,clicker)
|
if self.baby then
|
||||||
return
|
mobs.make_baby_grow_faster(self,clicker)
|
||||||
end
|
return
|
||||||
end
|
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
|
||||||
|
|
||||||
|
local item = clicker:get_wielded_item()
|
||||||
|
--safety catch
|
||||||
|
if not item then
|
||||||
|
return
|
||||||
|
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 and not self.carpet then
|
if minetest.get_item_group(item:get_name(), "carpet") == 1 then
|
||||||
|
|
||||||
for group, carpetdata in pairs(carpets) do
|
for group, carpetdata in pairs(carpets) do
|
||||||
if minetest.get_item_group(item:get_name(), group) == 1 then
|
if minetest.get_item_group(item:get_name(), group) == 1 then
|
||||||
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]
|
||||||
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({
|
||||||
|
@ -186,18 +223,19 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
end
|
end
|
||||||
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
|
||||||
|
|
|
@ -94,17 +94,16 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if clicker:get_player_control().sneak then
|
--attempt to enter breed state
|
||||||
--attempt to enter breed state
|
if mobs.enter_breed_state(self,clicker) then
|
||||||
if mobs.enter_breed_state(self,clicker) then
|
return
|
||||||
return
|
end
|
||||||
end
|
|
||||||
|
|
||||||
--make baby grow faster
|
--ignore other logic
|
||||||
if self.baby then
|
--make baby grow faster
|
||||||
mobs.make_baby_grow_faster(self,clicker)
|
if self.baby then
|
||||||
return
|
mobs.make_baby_grow_faster(self,clicker)
|
||||||
end
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.child then
|
if self.child then
|
||||||
|
@ -113,6 +112,8 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
|
|
||||||
-- Put saddle on pig
|
-- Put saddle on pig
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
|
local wielditem = item
|
||||||
|
|
||||||
if item:get_name() == mobs_mc.items.saddle and self.saddle ~= "yes" then
|
if item:get_name() == mobs_mc.items.saddle and self.saddle ~= "yes" then
|
||||||
self.base_texture = {
|
self.base_texture = {
|
||||||
"blank.png", -- baby
|
"blank.png", -- baby
|
||||||
|
|
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_chest.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_black.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_blue.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_brown.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_cyan.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_gray.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_green.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 6.2 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_lime.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_magenta.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_orange.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_pink.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_purple.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_red.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_white.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_decor_yellow.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
|
@ -154,17 +154,16 @@ dog.follow = "mcl_mobitems:beef"
|
||||||
dog.on_rightclick = function(self, clicker)
|
dog.on_rightclick = function(self, clicker)
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
|
|
||||||
if self.owner and self.owner == clicker:get_player_name() and clicker:get_player_control().sneak then
|
--owner is broken for this
|
||||||
--attempt to enter breed state
|
--attempt to enter breed state
|
||||||
if mobs.enter_breed_state(self,clicker) then
|
if mobs.enter_breed_state(self,clicker) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
--make baby grow faster
|
--make baby grow faster
|
||||||
if self.baby then
|
if self.baby then
|
||||||
mobs.make_baby_grow_faster(self,clicker)
|
mobs.make_baby_grow_faster(self,clicker)
|
||||||
return
|
return
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_food(item:get_name()) then
|
if is_food(item:get_name()) then
|
||||||
|
|