From 64ff46066873e82e9d924a0a674aafb62a4fa50e Mon Sep 17 00:00:00 2001 From: crabman77 Date: Tue, 14 Jul 2015 16:38:50 +0200 Subject: [PATCH] fixed diamond not consumed when tamed npc fixed npc follow diamond --- mods/mobs/api.lua | 4 ++-- mods/mobs/npc.lua | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index 75e62cd6..2ef23a49 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -467,9 +467,9 @@ function mobs:register_mob(name, def) end end - if self.type == "npc" and self.order == "follow" and self.state ~= "attack" then + if self.type == "npc" and self.order == "follow" and self.owner and self.owner ~= "" and self.state ~= "attack" then -- npc stop following player if not owner - if self.following and self.type == "npc" and self.owner and self.owner ~= self.following:get_player_name() then + if self.following and self.owner and self.owner ~= self.following:get_player_name() then self.following = nil end else diff --git a/mods/mobs/npc.lua b/mods/mobs/npc.lua index 3033bcd0..6f6e98ab 100755 --- a/mods/mobs/npc.lua +++ b/mods/mobs/npc.lua @@ -101,6 +101,7 @@ mobs:register_mob("mobs:npc", { self.diamond_count = (self.diamond_count or 0) + 1 if not minetest.setting_getbool("creative_mode") then item:take_item() + clicker:set_wielded_item(item) end if self.diamond_count < 4 then return end -- if owner switch between follow and stand