forked from Sokomine/yl_speak_up
determine npc_owner ealier so that talking to muted owned npc works
This commit is contained in:
parent
9b98d3fd21
commit
c14fd79c48
@ -3104,6 +3104,12 @@ function yl_speak_up.talk(self, clicker)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local npc_id = self.yl_speak_up.id
|
||||||
|
local n_id = "n_" .. npc_id
|
||||||
|
|
||||||
|
-- remember whom the npc belongs to (as long as we still have self.owner available for easy access)
|
||||||
|
yl_speak_up.npc_owner[ n_id ] = self.owner
|
||||||
|
|
||||||
local pname = clicker:get_player_name()
|
local pname = clicker:get_player_name()
|
||||||
if not self.yl_speak_up or not self.yl_speak_up.talk or self.yl_speak_up.talk~=true then
|
if not self.yl_speak_up or not self.yl_speak_up.talk or self.yl_speak_up.talk~=true then
|
||||||
|
|
||||||
@ -3123,9 +3129,6 @@ function yl_speak_up.talk(self, clicker)
|
|||||||
minetest.chat_send_player(pname, "This NPC is muted. It will only talk to you.")
|
minetest.chat_send_player(pname, "This NPC is muted. It will only talk to you.")
|
||||||
end
|
end
|
||||||
|
|
||||||
local npc_id = self.yl_speak_up.id
|
|
||||||
local n_id = "n_" .. npc_id
|
|
||||||
|
|
||||||
yl_speak_up.speak_to[pname] = {}
|
yl_speak_up.speak_to[pname] = {}
|
||||||
yl_speak_up.speak_to[pname].n_id = n_id -- Memorize which player talks to which NPC
|
yl_speak_up.speak_to[pname].n_id = n_id -- Memorize which player talks to which NPC
|
||||||
yl_speak_up.speak_to[pname].dialog = load_dialog(n_id) -- Load the dialog and see what we can do with it
|
yl_speak_up.speak_to[pname].dialog = load_dialog(n_id) -- Load the dialog and see what we can do with it
|
||||||
@ -3133,8 +3136,6 @@ function yl_speak_up.talk(self, clicker)
|
|||||||
yl_speak_up.speak_to[pname].option_index = 1
|
yl_speak_up.speak_to[pname].option_index = 1
|
||||||
yl_speak_up.speak_to[pname].obj = self.object
|
yl_speak_up.speak_to[pname].obj = self.object
|
||||||
|
|
||||||
-- remember whom the npc belongs to (as long as we still have self.owner available for easy access)
|
|
||||||
yl_speak_up.npc_owner[ n_id ] = self.owner
|
|
||||||
|
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk", get_fs_talkdialog(clicker, n_id))
|
minetest.show_formspec(pname, "yl_speak_up:talk", get_fs_talkdialog(clicker, n_id))
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user