parent
7e0dc0f9bc
commit
febc8529b1
@ -1206,20 +1206,7 @@ void cPlayer::SetGameMode(eGameMode a_GameMode)
|
||||
m_GameMode = a_GameMode;
|
||||
m_ClientHandle->SendGameMode(a_GameMode);
|
||||
|
||||
if (!(IsGameModeCreative() || IsGameModeSpectator()))
|
||||
{
|
||||
SetFlying(false);
|
||||
SetCanFly(false);
|
||||
}
|
||||
|
||||
if (IsGameModeSpectator() && IsVisible())
|
||||
{
|
||||
SetVisible(false);
|
||||
}
|
||||
else if (!IsVisible())
|
||||
{
|
||||
SetVisible(true);
|
||||
}
|
||||
SetCapabilities();
|
||||
|
||||
m_World->BroadcastPlayerListUpdateGameMode(*this);
|
||||
}
|
||||
@ -1231,6 +1218,30 @@ void cPlayer::SetGameMode(eGameMode a_GameMode)
|
||||
void cPlayer::LoginSetGameMode( eGameMode a_GameMode)
|
||||
{
|
||||
m_GameMode = a_GameMode;
|
||||
|
||||
SetCapabilities();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cPlayer::SetCapabilities()
|
||||
{
|
||||
if (!IsGameModeCreative() || IsGameModeSpectator())
|
||||
{
|
||||
SetFlying(false);
|
||||
SetCanFly(false);
|
||||
}
|
||||
|
||||
if (IsGameModeSpectator())
|
||||
{
|
||||
SetVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2372,7 +2383,3 @@ AString cPlayer::GetUUIDFileName(const AString & a_UUID)
|
||||
res.append(".json");
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -162,6 +162,12 @@ public:
|
||||
*/
|
||||
void SetGameMode(eGameMode a_GameMode);
|
||||
|
||||
// Sets the current gamemode, doesn't check validity, doesn't send update packets to client
|
||||
void LoginSetGameMode(eGameMode a_GameMode);
|
||||
|
||||
// Updates player's capabilities - flying, visibility, etc. from their gamemode.
|
||||
void SetCapabilities();
|
||||
|
||||
/** Returns true if the player is in Creative mode, either explicitly, or by inheriting from current world */
|
||||
bool IsGameModeCreative(void) const;
|
||||
|
||||
@ -198,9 +204,6 @@ public:
|
||||
|
||||
void SetIP(const AString & a_IP);
|
||||
|
||||
// Sets the current gamemode, doesn't check validity, doesn't send update packets to client
|
||||
void LoginSetGameMode(eGameMode a_GameMode);
|
||||
|
||||
/** Forces the player to move in the given direction.
|
||||
@deprecated Use SetSpeed instead. */
|
||||
void ForceSetSpeed(const Vector3d & a_Speed); // tolua_export
|
||||
@ -666,7 +669,3 @@ protected:
|
||||
This can be used both for online and offline UUIDs. */
|
||||
AString GetUUIDFileName(const AString & a_UUID);
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user