set nametag etc.

This commit is contained in:
Sokomine 2021-05-04 19:20:44 +02:00
parent 50591119c7
commit d1ba5f1ce5

View File

@ -2369,6 +2369,21 @@ minetest.register_on_player_receive_fields(
local dialog = fields_to_dialog(pname, f)
save_dialog(n_id, dialog)
yl_speak_up.speak_to[pname].dialog = dialog
-- show nametag etc.
if yl_speak_up.speak_to[pname].obj then
local obj = yl_speak_up.speak_to[pname].obj
local ent = obj:get_luaentity()
if ent ~= nil then
ent.yl_speak_up.npc_name = dialog.n_npc
ent.yl_speak_up.npc_description = dialog.n_description
ent.owner = dialog.npc_owner
local i_text = dialog.n_npc .. "\n" .. dialog.n_description .. "\n" .. yl_speak_up.infotext
obj:set_properties({infotext = i_text})
obj:set_nametag_attributes({color="#00ff00", text=dialog.n_npc})
end
end
-- actually start a chat with our new npc
minetest.show_formspec(pname, "yl_speak_up:talk", get_fs_talkdialog(player, n_id, nil))
return