From 86a963caca9604ad57904e9acd9bef7c46ca47d8 Mon Sep 17 00:00:00 2001 From: TeTpaAka Date: Thu, 14 May 2015 15:54:54 +0200 Subject: Add get and set functions for the nametag color --- src/content_cao.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/content_cao.cpp') diff --git a/src/content_cao.cpp b/src/content_cao.cpp index a8b107b49..5bf4d8e9c 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -552,6 +552,7 @@ GenericCAO::GenericCAO(IGameDef *gamedef, ClientEnvironment *env): m_animated_meshnode(NULL), m_wield_meshnode(NULL), m_spritenode(NULL), + m_nametag_color(video::SColor(255, 255, 255, 255)), m_textnode(NULL), m_position(v3f(0,10*BS,0)), m_velocity(v3f(0,0,0)), @@ -962,7 +963,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc, gui::IGUIEnvironment* gui = irr->getGUIEnvironment(); std::wstring wname = narrow_to_wide(m_name); m_textnode = smgr->addTextSceneNode(gui->getSkin()->getFont(), - wname.c_str(), video::SColor(255,255,255,255), node); + wname.c_str(), m_nametag_color, node); m_textnode->grab(); m_textnode->setPosition(v3f(0, BS*1.1, 0)); } @@ -1714,6 +1715,11 @@ void GenericCAO::processMessage(const std::string &data) int rating = readS16(is); m_armor_groups[name] = rating; } + } else if (cmd == GENERIC_CMD_SET_NAMETAG_COLOR) { + m_nametag_color = readARGB8(is); + if (m_textnode != NULL) { + m_textnode->setTextColor(m_nametag_color); + } } } -- cgit v1.2.3