summaryrefslogtreecommitdiffstats
path: root/source/cPlayer.cpp
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-01 21:09:13 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-01 21:09:13 +0100
commitf849b664e085034a5c1e09bbb9a4ceb4127c05ae (patch)
tree35054d7ba1e231d71c1280eb5be26b7b0ab97f07 /source/cPlayer.cpp
parentPlayers can now place blocks in creative mode. The blocks players select from the creative mode inventory are not stored in the players' inventory. (I kind of like that) (diff)
downloadcuberite-f849b664e085034a5c1e09bbb9a4ceb4127c05ae.tar
cuberite-f849b664e085034a5c1e09bbb9a4ceb4127c05ae.tar.gz
cuberite-f849b664e085034a5c1e09bbb9a4ceb4127c05ae.tar.bz2
cuberite-f849b664e085034a5c1e09bbb9a4ceb4127c05ae.tar.lz
cuberite-f849b664e085034a5c1e09bbb9a4ceb4127c05ae.tar.xz
cuberite-f849b664e085034a5c1e09bbb9a4ceb4127c05ae.tar.zst
cuberite-f849b664e085034a5c1e09bbb9a4ceb4127c05ae.zip
Diffstat (limited to '')
-rw-r--r--source/cPlayer.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp
index fee8df966..da589a70f 100644
--- a/source/cPlayer.cpp
+++ b/source/cPlayer.cpp
@@ -58,6 +58,8 @@ struct cPlayer::sPlayerState
cPlayer::cPlayer(cClientHandle* a_Client, const char* a_PlayerName)
: m_bBurnable(true)
+ , m_GameMode( 0 )
+ , m_LastBlockActionTime( 0 )
, e_EPMetaState(NORMAL)
, m_bVisible( true )
, m_LastGroundHeight( 0 )
@@ -107,6 +109,8 @@ cPlayer::~cPlayer(void)
cRoot::Get()->GetWorld()->RemovePlayer( this ); // TODO - Remove from correct world? Or get rid of this?
}
+
+
void cPlayer::SpawnOn( cClientHandle* a_Target )
{
if( a_Target == m_ClientHandle || !m_bVisible ) return;
@@ -223,7 +227,7 @@ void cPlayer::InStateBurning(float a_Dt) {
char block = GetWorld()->GetBlock( (int)m_Pos->x, (int)m_Pos->y, (int)m_Pos->z );
char bblock = GetWorld()->GetBlock( (int)m_Pos->x, (int)m_Pos->y -1, (int)m_Pos->z );
if(m_FireDamageInterval > 1000) {
-
+
m_FireDamageInterval = 0;
int rem = rand()%3 + 1; //Burn most of the time
if(rem >= 2) {
@@ -234,20 +238,20 @@ void cPlayer::InStateBurning(float a_Dt) {
if(block == E_BLOCK_LAVA || block == E_BLOCK_STATIONARY_LAVA || block == E_BLOCK_FIRE
|| bblock == E_BLOCK_LAVA || bblock == E_BLOCK_STATIONARY_LAVA || bblock == E_BLOCK_FIRE)
m_BurnPeriod = 0;
-
+
if(m_BurnPeriod > 5) {
-
+
cChunk* InChunk = GetWorld()->GetChunkUnreliable( m_ChunkX, m_ChunkY, m_ChunkZ );
e_EPMetaState = NORMAL;
cPacket_Metadata md(NORMAL, GetUniqueID());
//md.m_UniqueID = GetUniqueID();
InChunk->Broadcast(md);
m_BurnPeriod = 0;
-
- }
+
+ }
}
-
+
}
//----Change Entity MetaData
@@ -359,7 +363,8 @@ void cPlayer::Respawn()
// Create Respawn player packet
cPacket_Respawn Packet;
//Set Gamemode for packet by looking at world's gamemode (Need to check players gamemode.)
- Packet.m_CreativeMode = (char)GetWorld()->GetGameMode();
+ //Packet.m_CreativeMode = (char)GetWorld()->GetGameMode();
+ Packet.m_CreativeMode = (char)m_GameMode; //Set GameMode packet based on Player's GameMode;
//Send Packet
m_ClientHandle->Send( Packet );
TeleportTo( GetWorld()->GetSpawnX(), GetWorld()->GetSpawnY(), GetWorld()->GetSpawnZ() );
@@ -389,6 +394,17 @@ void cPlayer::CloseWindow()
m_CurrentWindow = 0;
}
+void cPlayer::SetLastBlockActionTime()
+{
+ m_LastBlockActionTime = cRoot::Get()->GetWorld()->GetTime();
+}
+
+void cPlayer::SetGameMode( int a_GameMode )
+{
+ m_GameMode = a_GameMode;
+}
+
+
#ifdef SendMessage // Cause stupid windows.h defines SendMessage as SendMessageA
#undef SendMessage
#endif