1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-05 18:10:26 +01: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() local item = clicker:get_wielded_item()
if item:get_name() == "mobs:meat" or item:get_name() == "farming:bread" then if item:get_name() == "mobs:meat" or item:get_name() == "farming:bread" then
local hp = self.object:get_hp() 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 if not minetest.setting_getbool("creative_mode") then
item:take_item() item:take_item()
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
end 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 -- right clicking with gold lump drops random item from mobs.npc_drops
elseif item:get_name() == "default:gold_lump" then elseif item:get_name() == "default:gold_lump" then
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then