From 822e54fa0cb4c060b0a55a7f1176b24b0b0d04e5 Mon Sep 17 00:00:00 2001 From: crabman77 Date: Sun, 21 Jun 2015 23:02:17 +0200 Subject: [PATCH] fixed tamed dog crash and add test for NPC --- mods/mobs/dog.lua | 2 ++ mods/mobs/npc.lua | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/mobs/dog.lua b/mods/mobs/dog.lua index 4f9e2eaa..68a9e7f3 100755 --- a/mods/mobs/dog.lua +++ b/mods/mobs/dog.lua @@ -37,6 +37,8 @@ mobs:register_mob("mobs:dog", { light_damage = 0, on_rightclick = function(self, clicker) local item = clicker:get_wielded_item() + local name = clicker:get_player_name() + if not name then return end if item:get_name() == "mobs:meat_raw" then local hp = self.object:get_hp() -- return if full health diff --git a/mods/mobs/npc.lua b/mods/mobs/npc.lua index 8a623fc8..e6e21db0 100755 --- a/mods/mobs/npc.lua +++ b/mods/mobs/npc.lua @@ -67,7 +67,7 @@ mobs:register_mob("mobs:npc", { on_rightclick = function(self, clicker) local item = clicker:get_wielded_item() local name = clicker:get_player_name() - + if not name then return end -- heal npc if item:get_name() == "mobs:meat" or item:get_name() == "farming:bread" then