summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-01 20:12:56 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-01 20:12:56 +0200
commit7c4cb9a3852e33d8bcc5f8283485e833c6eab93e (patch)
treea9f183b2ec527016f49da587e54641156db2a007 /src/Mobs/Monster.cpp
parentFixed Bindings regeneration under MSVC. (diff)
downloadcuberite-7c4cb9a3852e33d8bcc5f8283485e833c6eab93e.tar
cuberite-7c4cb9a3852e33d8bcc5f8283485e833c6eab93e.tar.gz
cuberite-7c4cb9a3852e33d8bcc5f8283485e833c6eab93e.tar.bz2
cuberite-7c4cb9a3852e33d8bcc5f8283485e833c6eab93e.tar.lz
cuberite-7c4cb9a3852e33d8bcc5f8283485e833c6eab93e.tar.xz
cuberite-7c4cb9a3852e33d8bcc5f8283485e833c6eab93e.tar.zst
cuberite-7c4cb9a3852e33d8bcc5f8283485e833c6eab93e.zip
Diffstat (limited to 'src/Mobs/Monster.cpp')
-rw-r--r--src/Mobs/Monster.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index f7ee0b0c0..6a477ca1c 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -75,6 +75,8 @@ cMonster::cMonster(const AString & a_ConfigName, eType a_MobType, const AString
, m_IdleInterval(0)
, m_DestroyTimer(0)
, m_MobType(a_MobType)
+ , m_CustomName("")
+ , m_CustomNameAlwaysVisible(false)
, m_SoundHurt(a_SoundHurt)
, m_SoundDeath(a_SoundDeath)
, m_AttackRate(3)
@@ -679,6 +681,33 @@ void cMonster::InStateEscaping(float a_Dt)
+void cMonster::SetCustomName(const AString & a_CustomName)
+{
+ m_CustomName = a_CustomName;
+
+ // The maximal length is 64
+ if (a_CustomName.length() > 64)
+ {
+ m_CustomName = a_CustomName.substr(0, 64);
+ }
+
+ m_World->BroadcastEntityMetadata(*this);
+}
+
+
+
+
+
+void cMonster::SetCustomNameAlwaysVisible(bool a_CustomNameAlwaysVisible)
+{
+ m_CustomNameAlwaysVisible = a_CustomNameAlwaysVisible;
+ m_World->BroadcastEntityMetadata(*this);
+}
+
+
+
+
+
void cMonster::GetMonsterConfig(const AString & a_Name)
{
cRoot::Get()->GetMonsterConfig()->AssignAttributes(this, a_Name);