forked from VoxeLibre/VoxeLibre
Fix pig feeding and breeding
This commit is contained in:
parent
e4b412bbb8
commit
be6c9502a7
|
@ -51,13 +51,22 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
look_start = 78,
|
look_start = 78,
|
||||||
look_end = 108,
|
look_end = 108,
|
||||||
},
|
},
|
||||||
follow = {"mcl_core:apple", "mcl_farming:beetroot_item", "mcl_farming:carrot_item", "mcl_mobitems:carrot_on_a_stick"},
|
follow = {"mcl_farming:beetroot_item", "mcl_farming:carrot_item", "mcl_mobitems:carrot_on_a_stick", "mcl_farming:potato_item"},
|
||||||
view_range = 5,
|
view_range = 5,
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
if not clicker or not clicker:is_player() then
|
if not clicker or not clicker:is_player() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local wielditem = clicker:get_wielded_item()
|
||||||
|
-- Feed pig
|
||||||
|
if wielditem:get_name() ~= "mcl_mobitems:carrot_on_a_stick" then
|
||||||
|
if mobs:feed_tame(self, clicker, 8, true, true) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Put saddle on pig
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
if item:get_name() == "mcl_mobitems:saddle" and self.saddle ~= "yes" then
|
if item:get_name() == "mcl_mobitems:saddle" and self.saddle ~= "yes" then
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
|
@ -83,9 +92,10 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- from boats mod
|
|
||||||
local name = clicker:get_player_name()
|
|
||||||
|
|
||||||
|
-- from boats mod
|
||||||
|
-- Ride pig if it has a saddle and player uses a carrot on a stick
|
||||||
|
local name = clicker:get_player_name()
|
||||||
if self.driver and clicker == self.driver then
|
if self.driver and clicker == self.driver then
|
||||||
self.driver = nil
|
self.driver = nil
|
||||||
clicker:set_detach()
|
clicker:set_detach()
|
||||||
|
@ -98,11 +108,8 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
minetest.after(0.2, function()
|
minetest.after(0.2, function()
|
||||||
mcl_player.player_set_animation(clicker, "sit" , 30)
|
mcl_player.player_set_animation(clicker, "sit" , 30)
|
||||||
end)
|
end)
|
||||||
----[[
|
|
||||||
-- ridable pigs
|
|
||||||
if self.name == "mobs_mc:pig" and self.saddle == "yes" and self.driver then
|
if self.name == "mobs_mc:pig" and self.saddle == "yes" and self.driver then
|
||||||
local item = clicker:get_wielded_item()
|
if wielditem:get_name() == "mcl_mobitems:carrot_on_a_stick" then
|
||||||
if item:get_name() == "mcl_mobitems:carrot_on_a_stick" then
|
|
||||||
local yaw = self.driver:get_look_yaw() - math.pi / 2
|
local yaw = self.driver:get_look_yaw() - math.pi / 2
|
||||||
local velo = self.object:getvelocity()
|
local velo = self.object:getvelocity()
|
||||||
local v = 1.5
|
local v = 1.5
|
||||||
|
@ -113,29 +120,22 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
|
|
||||||
local inv = self.driver:get_inventory()
|
local inv = self.driver:get_inventory()
|
||||||
-- 26 uses
|
-- 26 uses
|
||||||
if item:get_wear() > 63000 then
|
if wielditem:get_wear() > 63000 then
|
||||||
item = {name = "mcl_fishing:fishing_rod", count = 1}
|
wielditem = {name = "mcl_fishing:fishing_rod", count = 1}
|
||||||
else
|
else
|
||||||
item:add_wear(2521)
|
wielditem:add_wear(2521)
|
||||||
end
|
end
|
||||||
inv:set_stack("main", self.driver:get_wield_index(), item)
|
inv:set_stack("main", self.driver:get_wield_index(), wielditem)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
|
||||||
--]]
|
|
||||||
--self.object:setyaw(clicker:get_look_yaw() - math.pi / 2)
|
|
||||||
end
|
|
||||||
--from mobs_animals
|
|
||||||
if mobs:feed_tame(self, clicker, 8, true, true) then
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:register_spawn("mobs_mc:pig", {"mcl_core:dirt_with_grass"}, 20, 9, 5000, 1, 31000)
|
mobs:register_spawn("mobs_mc:pig", {"mcl_core:dirt_with_grass"}, 20, 9, 5000, 1, 31000)
|
||||||
|
|
||||||
|
|
||||||
--api code to fix
|
|
||||||
--[[
|
--[[
|
||||||
|
|
||||||
on_step = function(self, dtime)
|
on_step = function(self, dtime)
|
||||||
|
|
Reference in New Issue