forked from VoxeLibre/VoxeLibre
Merge pull request 'More villager and mob fixes' (#2405) from villager_breeding into master
Reviewed-on: MineClone2/MineClone2#2405 Reviewed-by: MysticTempest <mystictempest@noreply.git.minetest.land>
This commit is contained in:
commit
5c61c96d4f
|
@ -298,9 +298,13 @@ local function update_roll(self)
|
||||||
|
|
||||||
if is_Fleckenstein then
|
if is_Fleckenstein then
|
||||||
cbox[2], cbox[5] = -cbox[5], -cbox[2]
|
cbox[2], cbox[5] = -cbox[5], -cbox[2]
|
||||||
|
self.object:set_properties({collisionbox = cbox})
|
||||||
|
-- This leads to child mobs having the wrong collisionbox
|
||||||
|
-- and seeing as it seems to be nothing but an easter egg
|
||||||
|
-- i've put it inside the if. Which just makes it be upside
|
||||||
|
-- down lol.
|
||||||
end
|
end
|
||||||
|
|
||||||
self.object:set_properties({collisionbox = cbox})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set and return valid yaw
|
-- set and return valid yaw
|
||||||
|
@ -4357,7 +4361,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- feeding, taming and breeding (thanks blert2112)
|
-- feeding, taming and breeding (thanks blert2112)
|
||||||
function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake)
|
||||||
if not self.follow then
|
if not self.follow then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -4370,7 +4374,7 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
||||||
|
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
|
|
||||||
item:take_item()
|
if not notake then item:take_item() end
|
||||||
|
|
||||||
clicker:set_wielded_item(item)
|
clicker:set_wielded_item(item)
|
||||||
end
|
end
|
||||||
|
|
|
@ -629,6 +629,7 @@ local function look_for_job(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_a_job(self)
|
local function get_a_job(self)
|
||||||
|
if self.child then return end
|
||||||
local p = self.object:get_pos()
|
local p = self.object:get_pos()
|
||||||
local n = minetest.find_node_near(p,1,jobsites)
|
local n = minetest.find_node_near(p,1,jobsites)
|
||||||
if n and employ(self,n) then return true end
|
if n and employ(self,n) then return true end
|
||||||
|
@ -641,6 +642,7 @@ local function check_jobsite(self)
|
||||||
local m = minetest.get_meta(self._jobsite)
|
local m = minetest.get_meta(self._jobsite)
|
||||||
if m:get_string("villager") ~= self._id then
|
if m:get_string("villager") ~= self._id then
|
||||||
self._profession = "unemployed"
|
self._profession = "unemployed"
|
||||||
|
self._trades = nil
|
||||||
set_textures(self)
|
set_textures(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -663,7 +665,6 @@ end
|
||||||
local function init_trades(self, inv)
|
local function init_trades(self, inv)
|
||||||
local profession = professions[self._profession]
|
local profession = professions[self._profession]
|
||||||
local trade_tiers = profession.trades
|
local trade_tiers = profession.trades
|
||||||
self._traded = true
|
|
||||||
if trade_tiers == nil then
|
if trade_tiers == nil then
|
||||||
-- Empty trades
|
-- Empty trades
|
||||||
self._trades = false
|
self._trades = false
|
||||||
|
@ -1112,6 +1113,7 @@ local trade_inventory = {
|
||||||
local trader = player_trading_with[name]
|
local trader = player_trading_with[name]
|
||||||
local tradenum = player_tradenum[name]
|
local tradenum = player_tradenum[name]
|
||||||
local trades
|
local trades
|
||||||
|
trader._traded = true
|
||||||
if trader and trader._trades then
|
if trader and trader._trades then
|
||||||
trades = minetest.deserialize(trader._trades)
|
trades = minetest.deserialize(trader._trades)
|
||||||
end
|
end
|
||||||
|
@ -1282,13 +1284,12 @@ mcl_mobs:register_mob("mobs_mc:villager", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if clicker then
|
if clicker then
|
||||||
mcl_mobs:feed_tame(self, clicker, 1, true, false)
|
mcl_mobs:feed_tame(self, clicker, 1, true, false, true)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return true --do not pick up
|
return true --do not pick up
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
local trg=vector.new(0,9,0)
|
|
||||||
if self._jobsite then
|
if self._jobsite then
|
||||||
mcl_mobs:gopath(self,self._jobsite,function()
|
mcl_mobs:gopath(self,self._jobsite,function()
|
||||||
--minetest.log("arrived at jobsite")
|
--minetest.log("arrived at jobsite")
|
||||||
|
|
Loading…
Reference in New Issue