tidied capture/protect

This commit is contained in:
TenPlus1 2017-04-27 14:40:35 +01:00
parent 92b2e54a36
commit b141d0350f
2 changed files with 10 additions and 15 deletions

View File

@ -67,9 +67,9 @@ mobs:register_mob("mobs_npc:igor", {
on_rightclick = function(self, clicker)
-- feed to heal npc
if mobs:feed_tame(self, clicker, 8, false, true) then
return
end
if mobs:feed_tame(self, clicker, 8, false, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 0, 5, 80, false, nil) then return end
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
@ -105,9 +105,6 @@ mobs:register_mob("mobs_npc:igor", {
minetest.chat_send_player(name, S("NPC will follow you."))
end
end
mobs:protect(self, clicker)
mobs:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
})
-- register spawn egg

16
npc.lua
View File

@ -62,9 +62,13 @@ mobs:register_mob("mobs_npc:npc", {
on_rightclick = function(self, clicker)
-- feed to heal npc
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
if mobs:feed_tame(self, clicker, 8, true, true) then return end
-- capture npc with net or lasso
if mobs:capture_mob(self, clicker, 0, 5, 80, false, nil) then return end
-- protect npc with mobs:protector
if mobs:protect(self, clicker) then return end
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
@ -90,12 +94,6 @@ mobs:register_mob("mobs_npc:npc", {
return
end
-- capture npc with net or lasso
mobs:capture_mob(self, clicker, 0, 5, 80, false, nil)
-- protect npc with mobs:protector
mobs:protect(self, clicker)
-- by right-clicking owner can switch npc between follow and stand
if self.owner and self.owner == name then