summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-04 09:10:14 +0100
committerMattes D <github@xoft.cz>2014-12-04 09:10:14 +0100
commitc8e75994ccde76c0f506fec7c2cbf948aec36fef (patch)
treef2dfb58f5a8fb3306ca66209c6dfa38bb40b64e5 /src/Entities
parentMerge pull request #1646 from p-mcgowan/luaCheckstyleWarnings (diff)
parentUpdated whitespace in comment, changed conditional to logical equivalent due to popular demand (diff)
downloadcuberite-c8e75994ccde76c0f506fec7c2cbf948aec36fef.tar
cuberite-c8e75994ccde76c0f506fec7c2cbf948aec36fef.tar.gz
cuberite-c8e75994ccde76c0f506fec7c2cbf948aec36fef.tar.bz2
cuberite-c8e75994ccde76c0f506fec7c2cbf948aec36fef.tar.lz
cuberite-c8e75994ccde76c0f506fec7c2cbf948aec36fef.tar.xz
cuberite-c8e75994ccde76c0f506fec7c2cbf948aec36fef.tar.zst
cuberite-c8e75994ccde76c0f506fec7c2cbf948aec36fef.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Player.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index edcdb4799..bafd06277 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -120,6 +120,11 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) :
{
m_CanFly = true;
}
+ if (World->IsGameModeSpectator()) // Otherwise Player will fall out of the world on join
+ {
+ m_CanFly = true;
+ m_IsFlying = true;
+ }
}
cRoot::Get()->GetServer()->PlayerCreated(this);
@@ -1074,7 +1079,7 @@ bool cPlayer::IsGameModeAdventure(void) const
bool cPlayer::IsGameModeSpectator(void) const
{
return (m_GameMode == gmSpectator) || // Either the player is explicitly in Spectator
- ((m_GameMode == gmNotSet) && m_World->IsGameModeSpectator()); // or they inherit from the world and the world is Adventure
+ ((m_GameMode == gmNotSet) && m_World->IsGameModeSpectator()); // or they inherit from the world and the world is Spectator
}
@@ -1893,8 +1898,8 @@ void cPlayer::UseEquippedItem(int a_Amount)
void cPlayer::TickBurning(cChunk & a_Chunk)
{
- // Don't burn in creative and stop burning in creative if necessary
- if (!IsGameModeCreative())
+ // Don't burn in creative or spectator and stop burning in creative if necessary
+ if (!IsGameModeCreative() && !IsGameModeSpectator())
{
super::TickBurning(a_Chunk);
}
@@ -1913,9 +1918,9 @@ void cPlayer::HandleFood(void)
{
// Ref.: http://www.minecraftwiki.net/wiki/Hunger
- if (IsGameModeCreative())
+ if (IsGameModeCreative() || IsGameModeSpectator())
{
- // Hunger is disabled for Creative
+ // Hunger is disabled for Creative and Spectator
return;
}
@@ -2080,7 +2085,7 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos)
void cPlayer::ApplyFoodExhaustionFromMovement()
{
- if (IsGameModeCreative())
+ if (IsGameModeCreative() || IsGameModeSpectator())
{
return;
}