Add "Broadcasting" settings to world.ini
This commit is contained in:
parent
f79e682664
commit
a5cca16abe
@ -890,7 +890,7 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
|
|||||||
m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10);
|
m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10);
|
||||||
SaveToDisk(); // Save it, yeah the world is a tough place !
|
SaveToDisk(); // Save it, yeah the world is a tough place !
|
||||||
|
|
||||||
if (a_TDI.Attacker == NULL)
|
if ((a_TDI.Attacker == NULL) && m_World->ShouldBroadcastDeathMessages())
|
||||||
{
|
{
|
||||||
AString DamageText;
|
AString DamageText;
|
||||||
switch (a_TDI.DamageType)
|
switch (a_TDI.DamageType)
|
||||||
@ -1208,11 +1208,13 @@ unsigned int cPlayer::AwardAchievement(const eStatistic a_Ach)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// First time, announce it
|
if (m_World->ShouldBroadcastAchievementMessages())
|
||||||
cCompositeChat Msg;
|
{
|
||||||
Msg.SetMessageType(mtSuccess);
|
cCompositeChat Msg;
|
||||||
Msg.AddShowAchievementPart(GetName(), cStatInfo::GetName(a_Ach));
|
Msg.SetMessageType(mtSuccess);
|
||||||
m_World->BroadcastChat(Msg);
|
Msg.AddShowAchievementPart(GetName(), cStatInfo::GetName(a_Ach));
|
||||||
|
m_World->BroadcastChat(Msg);
|
||||||
|
}
|
||||||
|
|
||||||
// Increment the statistic
|
// Increment the statistic
|
||||||
StatValue New = m_Stats.AddValue(a_Ach);
|
StatValue New = m_Stats.AddValue(a_Ach);
|
||||||
|
@ -269,12 +269,12 @@ void cRoot::LoadWorlds(cIniFile & IniFile)
|
|||||||
{
|
{
|
||||||
// First get the default world
|
// First get the default world
|
||||||
AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world");
|
AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world");
|
||||||
m_pDefaultWorld = new cWorld( DefaultWorldName.c_str());
|
m_pDefaultWorld = new cWorld(DefaultWorldName.c_str());
|
||||||
m_WorldsByName[ DefaultWorldName ] = m_pDefaultWorld;
|
m_WorldsByName[ DefaultWorldName ] = m_pDefaultWorld;
|
||||||
|
|
||||||
// Then load the other worlds
|
// Then load the other worlds
|
||||||
unsigned int KeyNum = IniFile.FindKey("Worlds");
|
unsigned int KeyNum = IniFile.FindKey("Worlds");
|
||||||
unsigned int NumWorlds = IniFile.GetNumValues( KeyNum);
|
unsigned int NumWorlds = IniFile.GetNumValues(KeyNum);
|
||||||
if (NumWorlds <= 0)
|
if (NumWorlds <= 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -63,12 +63,12 @@ public: // tolua_export
|
|||||||
const AString & GetDescription(void) const {return m_Description; }
|
const AString & GetDescription(void) const {return m_Description; }
|
||||||
|
|
||||||
// Player counts:
|
// Player counts:
|
||||||
int GetMaxPlayers(void) const {return m_MaxPlayers; }
|
int GetMaxPlayers(void) const { return m_MaxPlayers; }
|
||||||
int GetNumPlayers(void) const;
|
int GetNumPlayers(void) const;
|
||||||
void SetMaxPlayers(int a_MaxPlayers) { m_MaxPlayers = a_MaxPlayers; }
|
void SetMaxPlayers(int a_MaxPlayers) { m_MaxPlayers = a_MaxPlayers; }
|
||||||
|
|
||||||
// Hardcore mode or not:
|
// Hardcore mode or not:
|
||||||
bool IsHardcore(void) const {return m_bIsHardcore; }
|
bool IsHardcore(void) const { return m_bIsHardcore; }
|
||||||
|
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
|
@ -522,6 +522,9 @@ void cWorld::Start(void)
|
|||||||
AString Dimension = IniFile.GetValueSet("General", "Dimension", "Overworld");
|
AString Dimension = IniFile.GetValueSet("General", "Dimension", "Overworld");
|
||||||
m_Dimension = StringToDimension(Dimension);
|
m_Dimension = StringToDimension(Dimension);
|
||||||
|
|
||||||
|
m_BroadcastDeathMessages = IniFile.GetValueSetB("Broadcasting", "BroadcastDeathMessages", true);
|
||||||
|
m_BroadcastAchievementMessages = IniFile.GetValueSetB("Broadcasting", "BroadcastAchievementMessages", true);
|
||||||
|
|
||||||
// Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
|
// Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
|
||||||
int KeyNum = IniFile.FindKey("SpawnPosition");
|
int KeyNum = IniFile.FindKey("SpawnPosition");
|
||||||
m_IsSpawnExplicitlySet =
|
m_IsSpawnExplicitlySet =
|
||||||
|
@ -622,7 +622,10 @@ public:
|
|||||||
|
|
||||||
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
|
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
|
||||||
void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }
|
void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }
|
||||||
|
|
||||||
|
bool ShouldBroadcastDeathMessages(void) const { return m_BroadcastDeathMessages; }
|
||||||
|
bool ShouldBroadcastAchievementMessages(void) const { return m_BroadcastAchievementMessages; }
|
||||||
|
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
/** Saves all chunks immediately. Dangerous interface, may deadlock, use QueueSaveAllChunks() instead */
|
/** Saves all chunks immediately. Dangerous interface, may deadlock, use QueueSaveAllChunks() instead */
|
||||||
@ -842,6 +845,9 @@ private:
|
|||||||
double m_SpawnY;
|
double m_SpawnY;
|
||||||
double m_SpawnZ;
|
double m_SpawnZ;
|
||||||
|
|
||||||
|
bool m_BroadcastDeathMessages;
|
||||||
|
bool m_BroadcastAchievementMessages;
|
||||||
|
|
||||||
double m_WorldAgeSecs; // World age, in seconds. Is only incremented, cannot be set by plugins.
|
double m_WorldAgeSecs; // World age, in seconds. Is only incremented, cannot be set by plugins.
|
||||||
double m_TimeOfDaySecs; // Time of day in seconds. Can be adjusted. Is wrapped to zero each day.
|
double m_TimeOfDaySecs; // Time of day in seconds. Can be adjusted. Is wrapped to zero each day.
|
||||||
Int64 m_WorldAge; // World age in ticks, calculated off of m_WorldAgeSecs
|
Int64 m_WorldAge; // World age in ticks, calculated off of m_WorldAgeSecs
|
||||||
|
Loading…
Reference in New Issue
Block a user