From bc838e5bd28172cf6dd1c1a4568270cb4250cac4 Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Thu, 21 May 2015 12:27:54 +0200 Subject: Renamed hook HOOK_ENTITY_CHANGE_WORLD --- src/Entities/Entity.cpp | 6 +++--- src/Entities/Player.cpp | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index bc2b3e93e..dca44488b 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1403,10 +1403,10 @@ bool cEntity::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn) return false; } - // Ask the plugins if the entity is allowed to change the world - if (cRoot::Get()->GetPluginManager()->CallHookEntityChangeWorld(*this, *a_World)) + // Ask the plugins if the entity is allowed to changing the world + if (cRoot::Get()->GetPluginManager()->CallHookEntityChangingWorld(*this, *a_World)) { - // A Plugin doesn't allow the entity to change the world + // A Plugin doesn't allow the entity to changing the world return false; } diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 01ad26297..f23d58ed1 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1606,9 +1606,10 @@ bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn) return false; } - if (cRoot::Get()->GetPluginManager()->CallHookEntityChangeWorld(*this, *a_World)) + // Ask the plugins if the player is allowed to changing the world + if (cRoot::Get()->GetPluginManager()->CallHookEntityChangingWorld(*this, *a_World)) { - // A Plugin doesn't allow the player to change the world + // A Plugin doesn't allow the player to changing the world return false; } -- cgit v1.2.3 From 906288c6eb007c7cd71ada3b5793fb373d722484 Mon Sep 17 00:00:00 2001 From: b33duck Date: Fri, 22 May 2015 12:25:16 -0700 Subject: Fixed players head visible when in spectator mode --- src/Entities/Player.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Entities') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 607a663de..1dab952c5 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1205,6 +1205,15 @@ void cPlayer::SetGameMode(eGameMode a_GameMode) SetCanFly(false); } + if (IsGameModeSpectator() && IsVisible()) + { + SetVisible(false); + } + else if (!IsVisible()) + { + SetVisible(true); + } + m_World->BroadcastPlayerListUpdateGameMode(*this); } -- cgit v1.2.3 From afb96c5bd6c5d85f0635151803a6d6030ac1fc12 Mon Sep 17 00:00:00 2001 From: b33duck Date: Fri, 22 May 2015 16:30:23 -0700 Subject: Added a fix for players falling through the world when connecting in spectator mode --- src/Entities/Player.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Entities') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 607a663de..aeda173fc 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -128,6 +128,13 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) : m_IsFlying = true; } } + + if (m_GameMode == gmSpectator) // If player is reconnecting to the server in spectator mode + { + m_CanFly = true; + m_IsFlying = true; + m_bVisible = false; + } cRoot::Get()->GetServer()->PlayerCreated(this); } -- cgit v1.2.3 From e30b2ed487b4a676eff98fcd6118e0837de204e3 Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Sat, 23 May 2015 13:56:08 +0200 Subject: Fixed missing overrides and added a ignore flag for reserved macro for clang version 3.6 and higher. --- src/Entities/Minecart.h | 2 +- src/Entities/Player.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h index d1736e9b9..05eaf16e9 100644 --- a/src/Entities/Minecart.h +++ b/src/Entities/Minecart.h @@ -135,7 +135,7 @@ protected: virtual void Destroyed() override; // cItemGrid::cListener overrides: - virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) + virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override { UNUSED(a_SlotNum); ASSERT(a_Grid == &m_Contents); diff --git a/src/Entities/Player.h b/src/Entities/Player.h index a0cd9b1d6..579eb8748 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -483,11 +483,11 @@ public: bool PlaceBlocks(const sSetBlockVector & a_Blocks); // cEntity overrides: - virtual bool IsCrouched (void) const { return m_IsCrouched; } - virtual bool IsSprinting(void) const { return m_IsSprinting; } - virtual bool IsRclking (void) const { return IsEating() || IsChargingBow(); } + virtual bool IsCrouched (void) const override { return m_IsCrouched; } + virtual bool IsSprinting(void) const override { return m_IsSprinting; } + virtual bool IsRclking (void) const override { return IsEating() || IsChargingBow(); } - virtual void Detach(void); + virtual void Detach(void) override; /** Called by cClientHandle when the client is being destroyed. The player removes its m_ClientHandle ownership so that the ClientHandle gets deleted. */ @@ -642,7 +642,7 @@ protected: void ResolvePermissions(void); void ResolveGroups(void); - virtual void Destroyed(void); + virtual void Destroyed(void) override; /** Filters out damage for creative mode / friendly fire */ virtual bool DoTakeDamage(TakeDamageInfo & TDI) override; -- cgit v1.2.3