diff options
author | TeTpaAka <TeTpaAka@users.noreply.github.com> | 2015-05-14 15:54:54 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-05-15 11:03:27 +0200 |
commit | 86a963caca9604ad57904e9acd9bef7c46ca47d8 (patch) | |
tree | ebe637727aeb7479c3cd327fba5dbc7dce0c9b5c /src/content_cao.cpp | |
parent | 99cf53c9087671d0a2130d2272b9a4f61d680517 (diff) | |
download | minetest-86a963caca9604ad57904e9acd9bef7c46ca47d8.tar.gz minetest-86a963caca9604ad57904e9acd9bef7c46ca47d8.tar.bz2 minetest-86a963caca9604ad57904e9acd9bef7c46ca47d8.zip |
Add get and set functions for the nametag color
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r-- | src/content_cao.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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); + } } } |