1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Add get and set functions for the nametag color

This commit is contained in:
TeTpaAka 2015-05-14 15:54:54 +02:00 committed by est31
parent 99cf53c908
commit 86a963caca
9 changed files with 104 additions and 2 deletions

View file

@ -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);
}
}
}