Digging leaves with shears now drops leaves
Falling Sand now notifies water around Implemented Function to get the relative chunk position in the total position (cChunk::PositionToWorldPosition) Pistons don´t drop water and lava items anymore when stopping water/lava implemented Getter for lava and water simulator IsBlockWater and IsBlockLava function in Defines.h git-svn-id: http://mc-server.googlecode.com/svn/trunk@97 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
e54373160b
commit
24efa6f864
@ -209,5 +209,6 @@ lightdust=348
|
||||
rawfish=349
|
||||
fish=349
|
||||
cookedfish=350
|
||||
shears=359
|
||||
goldrecord=2256
|
||||
greenrecord=2257
|
@ -46,11 +46,16 @@ inline bool IsValidItem( int a_ItemID ) //tolua_export
|
||||
return IsValidBlock( a_ItemID );
|
||||
} //tolua_export
|
||||
|
||||
inline bool IsBlockWater (char a_BlockID)
|
||||
inline bool IsBlockWater(char a_BlockID)
|
||||
{
|
||||
return (a_BlockID == E_BLOCK_WATER || a_BlockID == E_BLOCK_STATIONARY_WATER);
|
||||
}
|
||||
|
||||
inline bool IsBlockLava(char a_BlockID)
|
||||
{
|
||||
return (a_BlockID == E_BLOCK_LAVA || a_BlockID == E_BLOCK_STATIONARY_LAVA);
|
||||
}
|
||||
|
||||
inline void AddDirection( int & a_X, char & a_Y, int & a_Z, char a_Direction, bool a_bInverse = false ) //tolua_export
|
||||
{//tolua_export
|
||||
if( !a_bInverse )
|
||||
|
@ -5,8 +5,12 @@
|
||||
#include <sys/stat.h> // for mkdir
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "cChunk.h"
|
||||
#include "cWorld.h"
|
||||
#include "cWaterSimulator.h"
|
||||
#include "cLavaSimulator.h"
|
||||
#include "cClientHandle.h"
|
||||
#include "cServer.h"
|
||||
#include "zlib.h"
|
||||
@ -249,7 +253,13 @@ void cChunk::Tick(float a_Dt)
|
||||
{
|
||||
if( GetBlock( X, Y-1, Z ) == E_BLOCK_AIR )
|
||||
{
|
||||
SetBlock( X, Y, Z, 0, 0 );
|
||||
SetBlock( X, Y, Z, E_BLOCK_AIR, 0 );
|
||||
|
||||
int wX, wY, wZ;
|
||||
PositionToWorldPosition(X, Y, Z, wX, wY, wZ);
|
||||
|
||||
m_World->GetWaterSimulator()->WakeUp( wX, wY, wZ );
|
||||
m_World->GetLavaSimulator()->WakeUp( wX, wY, wZ );
|
||||
if (isRedstone) {
|
||||
cRedstone Redstone(m_World);
|
||||
Redstone.ChangeRedstone( (X+m_PosX*16), (Y+m_PosY*16), (Z+m_PosZ*16), false );
|
||||
@ -291,7 +301,7 @@ void cChunk::Tick(float a_Dt)
|
||||
AddDirection( XX, YY, ZZ, Dir, true );
|
||||
if( m_World->GetBlock( XX, YY, ZZ ) == E_BLOCK_AIR )
|
||||
{
|
||||
SetBlock( X, Y, Z, 0, 0 );
|
||||
SetBlock( X, Y, Z, E_BLOCK_AIR, 0 );
|
||||
cPickup* Pickup = new cPickup( (X+m_PosX*16) * 32 + 16, (Y+m_PosY*128) * 32 + 16, (Z+m_PosZ*16) * 32 + 16, cItem( (ENUM_ITEM_ID)BlockID, 1 ) );
|
||||
Pickup->Initialize( m_World );
|
||||
}
|
||||
@ -305,10 +315,19 @@ void cChunk::Tick(float a_Dt)
|
||||
case E_BLOCK_SAND:
|
||||
{
|
||||
char BottomBlock = GetBlock( X, Y-1, Z );
|
||||
if( BottomBlock == E_BLOCK_AIR || BottomBlock == E_BLOCK_WATER || BottomBlock == E_BLOCK_STATIONARY_WATER || BottomBlock == E_BLOCK_LAVA || BottomBlock == E_BLOCK_STATIONARY_LAVA )
|
||||
if( BottomBlock == E_BLOCK_AIR || IsBlockWater(BottomBlock) || IsBlockLava(BottomBlock) )
|
||||
{
|
||||
SetBlock( X, Y, Z, 0, 0 );
|
||||
SetBlock( X, Y, Z, E_BLOCK_AIR, 0 );
|
||||
SetBlock( X, Y-1, Z, BlockID, 0 );
|
||||
|
||||
int wX, wY, wZ;
|
||||
|
||||
PositionToWorldPosition(X, Y, Z, wX, wY, wZ);
|
||||
|
||||
m_World->GetWaterSimulator()->WakeUp( wX, wY, wZ );
|
||||
m_World->GetLavaSimulator()->WakeUp( wX, wY, wZ );
|
||||
m_World->GetWaterSimulator()->WakeUp( wX, wY - 1, wZ );
|
||||
m_World->GetLavaSimulator()->WakeUp( wX, wY - 1, wZ );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1448,3 +1467,11 @@ void cChunk::RemoveTickBlockEntity( cFurnaceEntity* a_Entity )
|
||||
{
|
||||
m_pState->m_TickBlockEntities.remove( a_Entity );
|
||||
}
|
||||
|
||||
|
||||
void cChunk::PositionToWorldPosition(int a_ChunkX, int a_ChunkY, int a_ChunkZ, int & a_X, int & a_Y, int & a_Z)
|
||||
{
|
||||
a_Y = a_ChunkY;
|
||||
a_X = m_PosX * 16 + a_ChunkX;
|
||||
a_Z = m_PosZ * 16 + a_ChunkZ;
|
||||
}
|
@ -77,6 +77,8 @@ public:
|
||||
void SetLight(char* a_Buffer, int a_BlockIdx, char a_Light);
|
||||
void SetLight(char* a_Buffer, int x, int y, int z, char light);
|
||||
|
||||
void PositionToWorldPosition(int a_ChunkX, int a_ChunkY, int a_ChunkZ, int & a_X, int & a_Y, int & a_Z);
|
||||
|
||||
void AddTickBlockEntity( cFurnaceEntity* a_Entity );
|
||||
//{
|
||||
// m_TickBlockEntities.remove( a_Entity );
|
||||
|
@ -503,7 +503,7 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
|
||||
m_Player->SetLastBlockActionCnt(LastActionCnt+1);
|
||||
if (LastActionCnt > 3) { //kick if more than 3 interactions per .1 seconds
|
||||
LOGWARN("Player %s tried to interact with a block too quickly! (could indicate bot) Was Kicked.", GetUsername() );
|
||||
//To many false-positives :s for example on a minimal server lagg :s should be re checked
|
||||
//TODO Too many false-positives :s for example on a minimal server lagg :s should be re checked
|
||||
Kick("You're a baaaaaad boy!");
|
||||
break;
|
||||
}
|
||||
@ -524,6 +524,7 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
|
||||
char OldBlock = World->GetBlock(PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ);
|
||||
char MetaData = World->GetBlockMeta(PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ);
|
||||
bool bBroken = (PacketData->m_Status == 0x02) || g_BlockOneHitDig[(int)OldBlock] || ( (PacketData->m_Status == 0x00) && (m_Player->GetGameMode() == 1) );
|
||||
if(bBroken == false) bBroken = (m_Player->GetInventory().GetEquippedItem().m_ItemID == E_ITEM_SHEARS && OldBlock == E_BLOCK_LEAVES);
|
||||
|
||||
cItem PickupItem;
|
||||
if( bBroken && !(m_Player->GetGameMode() == 1) ) // broken
|
||||
|
@ -217,6 +217,8 @@ void cPickup::HandlePhysics(float a_Dt)
|
||||
*m_Pos += *m_Speed*a_Dt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool cPickup::CollectedBy( cPlayer* a_Dest )
|
||||
|
@ -255,10 +255,10 @@ cWorld::cWorld( const char* a_WorldName )
|
||||
|
||||
// Blocks that breaks when pushed by piston
|
||||
g_BlockPistonBreakable[ E_BLOCK_AIR ] = true;
|
||||
g_BlockPistonBreakable[ E_BLOCK_STATIONARY_WATER ] = true;
|
||||
g_BlockPistonBreakable[ E_BLOCK_WATER ] = true;
|
||||
g_BlockPistonBreakable[ E_BLOCK_STATIONARY_LAVA ] = true;
|
||||
g_BlockPistonBreakable[ E_BLOCK_LAVA ] = true;
|
||||
g_BlockPistonBreakable[ E_BLOCK_STATIONARY_WATER ] = false; //This gave pistons the ability to drop water :D
|
||||
g_BlockPistonBreakable[ E_BLOCK_WATER ] = false;
|
||||
g_BlockPistonBreakable[ E_BLOCK_STATIONARY_LAVA ] = false;
|
||||
g_BlockPistonBreakable[ E_BLOCK_LAVA ] = false;
|
||||
g_BlockPistonBreakable[ E_BLOCK_BED ] = true;
|
||||
g_BlockPistonBreakable[ E_BLOCK_COBWEB ] = true;
|
||||
g_BlockPistonBreakable[ E_BLOCK_TALL_GRASS ] = true;
|
||||
@ -709,7 +709,7 @@ bool cWorld::DigBlock( int a_X, int a_Y, int a_Z, cItem & a_PickupItem )
|
||||
cChunk* DestChunk = GetChunk( ChunkX, ChunkY, ChunkZ );
|
||||
if(DestChunk)
|
||||
{
|
||||
DestChunk->SetBlock(PosX, PosY, PosZ, 0, 0 );
|
||||
DestChunk->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0 );
|
||||
m_WaterSimulator->WakeUp( a_X, a_Y, a_Z );
|
||||
m_LavaSimulator->WakeUp( a_X, a_Y, a_Z );
|
||||
|
||||
|
@ -81,6 +81,10 @@ public:
|
||||
const double & GetSpawnY(); //tolua_export
|
||||
const double & GetSpawnZ() { return m_SpawnZ; } //tolua_export
|
||||
|
||||
cWaterSimulator *GetWaterSimulator() { return m_WaterSimulator; }
|
||||
cLavaSimulator *GetLavaSimulator() { return m_LavaSimulator; }
|
||||
|
||||
|
||||
cBlockEntity* GetBlockEntity( int a_X, int a_Y, int a_Z ); //tolua_export
|
||||
|
||||
void GrowTree( int a_X, int a_Y, int a_Z ); //tolua_export
|
||||
|
Loading…
Reference in New Issue
Block a user