Can now set gamemode via lua.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@89 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
9f3f60c666
commit
993680a39e
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** Lua binding: AllToLua
|
** Lua binding: AllToLua
|
||||||
** Generated automatically by tolua++-1.0.92 on 11/10/11 10:15:41.
|
** Generated automatically by tolua++-1.0.92 on 11/10/11 12:27:03.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** Lua binding: AllToLua
|
** Lua binding: AllToLua
|
||||||
** Generated automatically by tolua++-1.0.92 on 11/10/11 10:15:41.
|
** Generated automatically by tolua++-1.0.92 on 11/10/11 12:27:03.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Exported function */
|
/* Exported function */
|
||||||
|
@ -1160,7 +1160,7 @@ void cClientHandle::Tick(float a_Dt)
|
|||||||
cWorld* World = cRoot::Get()->GetWorld( m_Player->GetLoadedWorldName() ); // TODO - Get the correct world or better yet, move this to the main thread so we don't have to lock anything
|
cWorld* World = cRoot::Get()->GetWorld( m_Player->GetLoadedWorldName() ); // TODO - Get the correct world or better yet, move this to the main thread so we don't have to lock anything
|
||||||
if( !World ) World = cRoot::Get()->GetDefaultWorld();
|
if( !World ) World = cRoot::Get()->GetDefaultWorld();
|
||||||
World->LockEntities();
|
World->LockEntities();
|
||||||
m_Player->SetGameMode ( World->GetGameMode() ); //set player's gamemode to server's gamemode at login.
|
m_Player->LoginSetGameMode ( World->GetGameMode() ); //set player's gamemode to server's gamemode at login.
|
||||||
|
|
||||||
m_Player->SetIP ( m_pState->Socket.GetIPString() );
|
m_Player->SetIP ( m_pState->Socket.GetIPString() );
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "packets/cPacket_DestroyEntity.h"
|
#include "packets/cPacket_DestroyEntity.h"
|
||||||
#include "packets/cPacket_Metadata.h"
|
#include "packets/cPacket_Metadata.h"
|
||||||
#include "packets/cPacket_Chat.h"
|
#include "packets/cPacket_Chat.h"
|
||||||
|
#include "packets/cPacket_NewInvalidState.h"
|
||||||
|
|
||||||
#include "Vector3d.h"
|
#include "Vector3d.h"
|
||||||
#include "Vector3f.h"
|
#include "Vector3f.h"
|
||||||
@ -422,6 +423,19 @@ void cPlayer::SetLastBlockActionCnt( int a_LastBlockActionCnt )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cPlayer::SetGameMode( int a_GameMode )
|
void cPlayer::SetGameMode( int a_GameMode )
|
||||||
|
{
|
||||||
|
if ( (a_GameMode < 2) && (a_GameMode >= 0) ) {
|
||||||
|
if (m_GameMode != a_GameMode) {
|
||||||
|
m_GameMode = a_GameMode;
|
||||||
|
cPacket_NewInvalidState GameModePacket;
|
||||||
|
GameModePacket.m_Reason = 3; //GameModeChange
|
||||||
|
GameModePacket.m_GameMode = (char)a_GameMode; //GameModeChange
|
||||||
|
m_ClientHandle->Send ( GameModePacket );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cPlayer::LoginSetGameMode( int a_GameMode )
|
||||||
{
|
{
|
||||||
m_GameMode = a_GameMode;
|
m_GameMode = a_GameMode;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
void SetLastBlockActionCnt( int ); //tolua_export
|
void SetLastBlockActionCnt( int ); //tolua_export
|
||||||
void SetLastBlockActionTime(); //tolua_export
|
void SetLastBlockActionTime(); //tolua_export
|
||||||
void SetGameMode( int a_GameMode ); //tolua_export
|
void SetGameMode( int a_GameMode ); //tolua_export
|
||||||
|
void LoginSetGameMode( int a_GameMode );
|
||||||
void SetIP( std::string a_IP );
|
void SetIP( std::string a_IP );
|
||||||
|
|
||||||
// Tries to move to a new position, with collision checks and stuff
|
// Tries to move to a new position, with collision checks and stuff
|
||||||
|
Loading…
Reference in New Issue
Block a user