diff options
author | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-11-06 10:23:20 +0100 |
---|---|---|
committer | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-11-06 10:23:20 +0100 |
commit | 36f7084e3fb4193676b14f302d0f961f2102e4ba (patch) | |
tree | b2e7d7c7d1854dbe484605b4054e707c0bd09cef /source/cPickup.cpp | |
parent | Finished most of piston class. Pistons should work when a redstone current with wire is lit up or extinguished near them but don't yet. There'sa bug to kill. (diff) | |
download | cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar.gz cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar.bz2 cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar.lz cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar.xz cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar.zst cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.zip |
Diffstat (limited to 'source/cPickup.cpp')
-rw-r--r-- | source/cPickup.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/cPickup.cpp b/source/cPickup.cpp index c712d9919..10427f5b3 100644 --- a/source/cPickup.cpp +++ b/source/cPickup.cpp @@ -125,7 +125,8 @@ void cPickup::Tick(float a_Dt) return;
}
- HandlePhysics( a_Dt );
+ if(!m_bCollected)
+ HandlePhysics( a_Dt );
if( !m_bReplicated || m_bDirtyPosition )
{
@@ -148,14 +149,18 @@ void cPickup::HandlePhysics(float a_Dt) if( m_bOnGround ) // check if it's still on the ground
{
cWorld* World = GetWorld();
- int BlockX = (int)m_Pos->x;
- if( m_Pos->x < 0 ) BlockX--;
- int BlockZ = (int)m_Pos->z;
- if( m_Pos->z < 0 ) BlockZ--;
+ int BlockX = (m_Pos->x)<0 ? (int)m_Pos->x-1 : (int)m_Pos->x;
+ int BlockZ = (m_Pos->z)<0 ? (int)m_Pos->z-1 : (int)m_Pos->z;
if( World->GetBlock( BlockX, (int)m_Pos->y -1, BlockZ ) == E_BLOCK_AIR )
{
m_bOnGround = false;
}
+ char block = World->GetBlock( BlockX, (int)m_Pos->y - (int)m_bOnGround, BlockZ );
+ if( block == E_BLOCK_STATIONARY_LAVA || block == E_BLOCK_LAVA ) {
+ m_bCollected = true;
+ m_Timer = 0;
+ return;
+ }
if( World->GetBlock( BlockX, (int)m_Pos->y, BlockZ ) != E_BLOCK_AIR ) // If in ground itself, push it out
{
m_bOnGround = true;
@@ -211,7 +216,7 @@ void cPickup::HandlePhysics(float a_Dt) bool cPickup::CollectedBy( cPlayer* a_Dest )
{
if(m_bCollected) return false; // It's already collected!
- if(m_Timer < 1000.f) return false; // Not old enough
+ if(m_Timer < 800.f) return false; // Not old enough
if( cRoot::Get()->GetPluginManager()->CallHook( cPluginManager::E_PLUGIN_COLLECT_ITEM, 2, this, a_Dest ) ) return false;
|