ordering npc to stay stops attack and them walking
This commit is contained in:
parent
3442baa31f
commit
3b2a3f22c7
6
igor.lua
6
igor.lua
@ -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"
|
||||
|
7
npc.lua
7
npc.lua
@ -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,
|
||||
})
|
||||
|
||||
|
@ -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,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user