Added CustomName to cMonster.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user