@@ -47,6 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
47
47
#include < algorithm>
48
48
#include < cmath>
49
49
#include " client/shader.h"
50
+ #include " client/minimap.h"
50
51
51
52
class Settings ;
52
53
struct ToolCapabilities ;
@@ -566,6 +567,9 @@ void GenericCAO::removeFromScene(bool permanent)
566
567
m_client->getCamera ()->removeNametag (m_nametag);
567
568
m_nametag = nullptr ;
568
569
}
570
+
571
+ if (m_marker && m_client->getMinimap ())
572
+ m_client->getMinimap ()->removeMarker (&m_marker);
569
573
}
570
574
571
575
void GenericCAO::addToScene (ITextureSource *tsrc)
@@ -794,6 +798,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
794
798
node->setParent (m_matrixnode);
795
799
796
800
updateNametag ();
801
+ updateMarker ();
797
802
updateNodePos ();
798
803
updateAnimation ();
799
804
updateBonePosition ();
@@ -885,6 +890,23 @@ u16 GenericCAO::getLightPosition(v3s16 *pos)
885
890
return 3 ;
886
891
}
887
892
893
+ void GenericCAO::updateMarker ()
894
+ {
895
+ if (!m_prop.show_on_minimap ) {
896
+ if (m_marker)
897
+ m_client->getMinimap ()->removeMarker (&m_marker);
898
+ return ;
899
+ }
900
+
901
+ if (m_marker)
902
+ return ;
903
+
904
+ scene::ISceneNode *node = getSceneNode ();
905
+ if (!node)
906
+ return ;
907
+ m_marker = m_client->getMinimap ()->addMarker (node);
908
+ }
909
+
888
910
void GenericCAO::updateNametag ()
889
911
{
890
912
if (m_is_local_player) // No nametag for local player
@@ -1576,6 +1598,8 @@ void GenericCAO::processMessage(const std::string &data)
1576
1598
u8 cmd = readU8 (is);
1577
1599
if (cmd == AO_CMD_SET_PROPERTIES) {
1578
1600
ObjectProperties newprops;
1601
+ newprops.show_on_minimap = m_is_player; // default
1602
+
1579
1603
newprops.deSerialize (is);
1580
1604
1581
1605
// Check what exactly changed
@@ -1609,6 +1633,8 @@ void GenericCAO::processMessage(const std::string &data)
1609
1633
1610
1634
if ((m_is_player && !m_is_local_player) && m_prop.nametag .empty ())
1611
1635
m_prop.nametag = m_name;
1636
+ if (m_is_local_player)
1637
+ m_prop.show_on_minimap = false ;
1612
1638
1613
1639
if (expire_visuals) {
1614
1640
expireVisuals ();
@@ -1621,6 +1647,7 @@ void GenericCAO::processMessage(const std::string &data)
1621
1647
updateTextures (m_current_texture_modifier);
1622
1648
}
1623
1649
updateNametag ();
1650
+ updateMarker ();
1624
1651
}
1625
1652
} else if (cmd == AO_CMD_UPDATE_POSITION) {
1626
1653
// Not sent by the server if this object is an attachment.
0 commit comments