From 83b50783c6f5dbd3559c9888a6ec36d07e2da876 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Mon, 13 Apr 2015 21:25:04 +0200 Subject: [PATCH] Added NPC's counter adapted to the API - It seems in fact that sometimes, when you give the fourth diamond to a NPC, it does not follow because you're too close to it. (engine's entity issue, or algorythm issue, but not really one since you just have to move in 99% of the cases to make the NPC follow you) --- mods/mobs/npc.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mods/mobs/npc.lua b/mods/mobs/npc.lua index a4647133..48f85403 100755 --- a/mods/mobs/npc.lua +++ b/mods/mobs/npc.lua @@ -87,15 +87,14 @@ mobs:register_mob("mobs:npc", { local pos = self.object:getpos() pos.y = pos.y + 0.5 minetest.add_item(pos, {name = mobs.npc_drops[math.random(1,#mobs.npc_drops)]}) ---[[ elseif item:get_name() == "default:diamond" then + elseif item:get_name() == "default:diamond" then 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 -]]-- - else + if self.owner == "" then self.owner = clicker:get_player_name() else