summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authornesco <emmanuel@federbusch.fr>2014-09-17 17:15:47 +0200
committernesco <emmanuel@federbusch.fr>2014-09-17 17:15:47 +0200
commitc63e14b6d11a97b56e17d628aebdd5e244999a15 (patch)
treecb96b04df8d809748d508500e1066b4a4e9be53a /src/Entities
parentPreparing 1.8 update (diff)
downloadcuberite-c63e14b6d11a97b56e17d628aebdd5e244999a15.tar
cuberite-c63e14b6d11a97b56e17d628aebdd5e244999a15.tar.gz
cuberite-c63e14b6d11a97b56e17d628aebdd5e244999a15.tar.bz2
cuberite-c63e14b6d11a97b56e17d628aebdd5e244999a15.tar.lz
cuberite-c63e14b6d11a97b56e17d628aebdd5e244999a15.tar.xz
cuberite-c63e14b6d11a97b56e17d628aebdd5e244999a15.tar.zst
cuberite-c63e14b6d11a97b56e17d628aebdd5e244999a15.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Player.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 0f15ba620..660ad3239 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -451,6 +451,11 @@ void cPlayer::CancelChargingBow(void)
void cPlayer::SetTouchGround(bool a_bTouchGround)
{
+ if (IsGameModeSpectator()) // You can fly through the ground in survival
+ {
+ return;
+ }
+
m_bTouchGround = a_bTouchGround;
if (!m_bTouchGround)
@@ -585,7 +590,7 @@ bool cPlayer::Feed(int a_Food, double a_Saturation)
void cPlayer::AddFoodExhaustion(double a_Exhaustion)
{
- if (!IsGameModeCreative())
+ if (!(IsGameModeCreative() || IsGameModeSpectator()))
{
m_FoodExhaustionLevel = std::min(m_FoodExhaustionLevel + a_Exhaustion, 40.0);
}
@@ -823,9 +828,9 @@ bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
{
if ((a_TDI.DamageType != dtInVoid) && (a_TDI.DamageType != dtPlugin))
{
- if (IsGameModeCreative())
+ if (IsGameModeCreative() || IsGameModeSpectator())
{
- // No damage / health in creative mode if not void or plugin damage
+ // No damage / health in creative or spectator mode if not void or plugin damage
return false;
}
}
@@ -1348,7 +1353,7 @@ void cPlayer::MoveTo( const Vector3d & a_NewPos)
void cPlayer::SetVisible(bool a_bVisible)
{
- // Need to Check if this or other players are in gamemode spectator
+ // Need to Check if the player or other players are in gamemode spectator, but will break compatibility
if (a_bVisible && !m_bVisible) // Make visible
{
m_bVisible = true;
@@ -1509,6 +1514,11 @@ void cPlayer::TossPickup(const cItem & a_Item)
void cPlayer::TossItems(const cItems & a_Items)
{
+ if (IsGameModeSpectator()) // Players can't toss items in spectator
+ {
+ return;
+ }
+
m_Stats.AddValue(statItemsDropped, (StatValue)a_Items.Size());
double vX = 0, vY = 0, vZ = 0;
@@ -1795,7 +1805,7 @@ bool cPlayer::SaveToDisk()
void cPlayer::UseEquippedItem(int a_Amount)
{
- if (IsGameModeCreative()) // No damage in creative
+ if (IsGameModeCreative() || IsGameModeSpectator()) // No damage in creative or spectator
{
return;
}