1
0

Players can switch worlds on the fly with the command /gotoworld [worldName]. This uses the function cPlayer::MoveToWorld()

Changed isValidItem to IsValidItem in Core.lua

git-svn-id: http://mc-server.googlecode.com/svn/trunk@126 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth
2011-12-26 21:54:08 +00:00
parent 9f77572fb0
commit eb942797b8
13 changed files with 222 additions and 144 deletions

View File

@@ -701,6 +701,33 @@ void cPlayer::TossItem( bool a_bDraggingItem, int a_Amount /* = 1 */ )
}
}
bool cPlayer::MoveToWorld( const char* a_WorldName )
{
cWorld* World = cRoot::Get()->GetWorld( a_WorldName );
if( World )
{
/* Remove all links to the old world */
GetWorld()->RemovePlayer( this );
GetClientHandle()->RemoveFromAllChunks();
cChunk* Chunk = GetWorld()->GetChunkUnreliable( m_ChunkX, m_ChunkY, m_ChunkZ );
if( Chunk )
{
Chunk->RemoveEntity( *this );
Chunk->Broadcast( cPacket_DestroyEntity( this ) ); // Remove player entity from all clients in old world
}
/* Add player to all the necessary parts of the new world */
SetWorld( World );
GetWorld()->AddPlayer( this );
MoveToCorrectChunk(true);
GetClientHandle()->StreamChunks();
return true;
}
return false;
}
bool cPlayer::LoadFromDisk() // TODO - This should also get/set/whatever the correct world for this player
{
cIniFile IniFile("users.ini");