1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-10-01 00:40:33 +02:00

fixed NPC feed

This commit is contained in:
crabman77 2015-03-31 04:41:38 +02:00
parent 23a64e9ffb
commit fee70f8fc3

View File

@ -65,12 +65,14 @@ mobs:register_mob("mobs:npc", {
local item = clicker:get_wielded_item()
if item:get_name() == "mobs:meat" or item:get_name() == "farming:bread" then
local hp = self.object:get_hp()
if hp + 4 > self.hp_max then return end
if hp >= self.hp_max then return end
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_hp(hp+4)
local n = hp + 4
if n > self.hp_max then n = self.hp_max end
self.object:set_hp(n)
-- right clicking with gold lump drops random item from mobs.npc_drops
elseif item:get_name() == "default:gold_lump" then
if not minetest.setting_getbool("creative_mode") then