Fix nametags being shown in first person

This commit is contained in:
luk3yx 2021-07-19 10:07:03 +12:00 committed by MoNTE48
parent 8f0dd004f1
commit b1fa8f8e2b
2 changed files with 6 additions and 3 deletions

View File

@ -698,8 +698,6 @@ void Camera::drawNametags()
for (const Nametag *nametag : m_nametags) { for (const Nametag *nametag : m_nametags) {
// Nametags are hidden in GenericCAO::updateNametag() // Nametags are hidden in GenericCAO::updateNametag()
if (!nametag->parent_node->isVisible())
continue;
v3f pos = nametag->parent_node->getAbsolutePosition() + nametag->pos * BS; v3f pos = nametag->parent_node->getAbsolutePosition() + nametag->pos * BS;
f32 transformed_pos[4] = { pos.X, pos.Y, pos.Z, 1.0f }; f32 transformed_pos[4] = { pos.X, pos.Y, pos.Z, 1.0f };

View File

@ -941,7 +941,9 @@ void GenericCAO::updateMarker()
void GenericCAO::updateNametag() void GenericCAO::updateNametag()
{ {
if (m_prop.nametag.empty() || m_prop.nametag_color.getAlpha() == 0) { if (m_prop.nametag.empty() || m_prop.nametag_color.getAlpha() == 0 ||
(m_is_local_player &&
m_client->getCamera()->getCameraMode() == CAMERA_MODE_FIRST)) {
// Delete nametag // Delete nametag
if (m_nametag) { if (m_nametag) {
m_client->getCamera()->removeNametag(m_nametag); m_client->getCamera()->removeNametag(m_nametag);
@ -1983,6 +1985,9 @@ void GenericCAO::updateMeshCulling()
node->setMaterialFlag(video::EMF_FRONT_FACE_CULLING, node->setMaterialFlag(video::EMF_FRONT_FACE_CULLING,
false); false);
} }
// Show/hide the nametag
updateNametag();
} }
// Prototype // Prototype