Merge pull request 'More villager and mob fixes' (#2405) from villager_breeding into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2405
Reviewed-by: MysticTempest <mystictempest@noreply.git.minetest.land>
This commit is contained in:
cora 2022-07-08 22:02:36 +00:00
commit 5c61c96d4f
2 changed files with 11 additions and 6 deletions

View File

@ -298,9 +298,13 @@ local function update_roll(self)
if is_Fleckenstein then
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
self.object:set_properties({collisionbox = cbox})
end
-- set and return valid yaw
@ -4357,7 +4361,7 @@ end
-- 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
return false
end
@ -4370,7 +4374,7 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame)
local item = clicker:get_wielded_item()
item:take_item()
if not notake then item:take_item() end
clicker:set_wielded_item(item)
end

View File

@ -629,6 +629,7 @@ local function look_for_job(self)
end
local function get_a_job(self)
if self.child then return end
local p = self.object:get_pos()
local n = minetest.find_node_near(p,1,jobsites)
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)
if m:get_string("villager") ~= self._id then
self._profession = "unemployed"
self._trades = nil
set_textures(self)
end
end
@ -663,7 +665,6 @@ end
local function init_trades(self, inv)
local profession = professions[self._profession]
local trade_tiers = profession.trades
self._traded = true
if trade_tiers == nil then
-- Empty trades
self._trades = false
@ -1112,6 +1113,7 @@ local trade_inventory = {
local trader = player_trading_with[name]
local tradenum = player_tradenum[name]
local trades
trader._traded = true
if trader and trader._trades then
trades = minetest.deserialize(trader._trades)
end
@ -1282,13 +1284,12 @@ mcl_mobs:register_mob("mobs_mc:villager", {
end
end
if clicker then
mcl_mobs:feed_tame(self, clicker, 1, true, false)
mcl_mobs:feed_tame(self, clicker, 1, true, false, true)
return
end
return true --do not pick up
end,
on_rightclick = function(self, clicker)
local trg=vector.new(0,9,0)
if self._jobsite then
mcl_mobs:gopath(self,self._jobsite,function()
--minetest.log("arrived at jobsite")