ordering npc to stay stops attack and them walking

This commit is contained in:
tenplus1 2020-07-28 09:12:39 +01:00
parent 3442baa31f
commit 3b2a3f22c7
3 changed files with 18 additions and 1 deletions

View File

@ -102,7 +102,13 @@ mobs:register_mob("mobs_npc:igor", {
if self.owner and self.owner == name then
if self.order == "follow" then
self.attack = nil
self.order = "stand"
self.state = "stand"
self:set_animation("stand")
self:set_velocity(0)
minetest.chat_send_player(name, S("NPC stands still."))
else
self.order = "follow"

View File

@ -61,6 +61,7 @@ mobs:register_mob("mobs_npc:npc", {
punch_start = 200,
punch_end = 219,
},
on_rightclick = function(self, clicker)
-- feed to heal npc
@ -102,7 +103,12 @@ mobs:register_mob("mobs_npc:npc", {
if self.owner and self.owner == name then
if self.order == "follow" then
self.attack = nil
self.order = "stand"
self.state = "stand"
self:set_animation("stand")
self:set_velocity(0)
minetest.chat_send_player(name, S("NPC stands still."))
else
@ -111,7 +117,6 @@ mobs:register_mob("mobs_npc:npc", {
minetest.chat_send_player(name, S("NPC will follow you."))
end
end
end,
})

View File

@ -82,15 +82,21 @@ mobs:register_mob("mobs_npc:trader", {
punch_start = 200,
punch_end = 219,
},
on_rightclick = function(self, clicker)
self.attack = nil
mobs_trader(self, clicker, entity, mobs.human)
end,
on_spawn = function(self)
self.nametag = S("Trader")
self.object:set_properties({
nametag = self.nametag,
nametag_color = "#FFFFFF"
})
return true -- return true so on_spawn is run once only
end,
})