summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Entities/Player.cpp14
-rw-r--r--src/Root.cpp4
-rw-r--r--src/Server.h4
-rw-r--r--src/World.cpp3
-rw-r--r--src/World.h8
5 files changed, 22 insertions, 11 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index fcc8eb9a0..393afc3b6 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -890,7 +890,7 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10);
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;
switch (a_TDI.DamageType)
@@ -1208,11 +1208,13 @@ unsigned int cPlayer::AwardAchievement(const eStatistic a_Ach)
}
else
{
- // First time, announce it
- cCompositeChat Msg;
- Msg.SetMessageType(mtSuccess);
- Msg.AddShowAchievementPart(GetName(), cStatInfo::GetName(a_Ach));
- m_World->BroadcastChat(Msg);
+ if (m_World->ShouldBroadcastAchievementMessages())
+ {
+ cCompositeChat Msg;
+ Msg.SetMessageType(mtSuccess);
+ Msg.AddShowAchievementPart(GetName(), cStatInfo::GetName(a_Ach));
+ m_World->BroadcastChat(Msg);
+ }
// Increment the statistic
StatValue New = m_Stats.AddValue(a_Ach);
diff --git a/src/Root.cpp b/src/Root.cpp
index b03a13382..efa21b775 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -269,12 +269,12 @@ void cRoot::LoadWorlds(cIniFile & IniFile)
{
// First get the default 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;
// Then load the other worlds
unsigned int KeyNum = IniFile.FindKey("Worlds");
- unsigned int NumWorlds = IniFile.GetNumValues( KeyNum);
+ unsigned int NumWorlds = IniFile.GetNumValues(KeyNum);
if (NumWorlds <= 0)
{
return;
diff --git a/src/Server.h b/src/Server.h
index b03359f03..c1640b388 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -63,12 +63,12 @@ public: // tolua_export
const AString & GetDescription(void) const {return m_Description; }
// Player counts:
- int GetMaxPlayers(void) const {return m_MaxPlayers; }
+ int GetMaxPlayers(void) const { return m_MaxPlayers; }
int GetNumPlayers(void) const;
void SetMaxPlayers(int a_MaxPlayers) { m_MaxPlayers = a_MaxPlayers; }
// Hardcore mode or not:
- bool IsHardcore(void) const {return m_bIsHardcore; }
+ bool IsHardcore(void) const { return m_bIsHardcore; }
// tolua_end
diff --git a/src/World.cpp b/src/World.cpp
index 7ad350e24..ff393bc2b 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -522,6 +522,9 @@ void cWorld::Start(void)
AString Dimension = IniFile.GetValueSet("General", "Dimension", "Overworld");
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
int KeyNum = IniFile.FindKey("SpawnPosition");
m_IsSpawnExplicitlySet =
diff --git a/src/World.h b/src/World.h
index 9658178ae..cb77361f6 100644
--- a/src/World.h
+++ b/src/World.h
@@ -622,7 +622,10 @@ public:
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
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
/** Saves all chunks immediately. Dangerous interface, may deadlock, use QueueSaveAllChunks() instead */
@@ -842,6 +845,9 @@ private:
double m_SpawnY;
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_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