From 36f7084e3fb4193676b14f302d0f961f2102e4ba Mon Sep 17 00:00:00 2001 From: "admin@omencraft.com" Date: Sun, 6 Nov 2011 09:23:20 +0000 Subject: Patch with diff file created by Sebi (implemented some stuff like lava physics, drops are deleted when in lava, water is now slower, lava gives actual damage etc.). Pistons now work mostly as they should. They do not yet show the motion animation and do not emit sound. They do extend, push, and retract as they should though. Right now the only way to activate a piston is to light redstone wire adjacent to it with a redstone torch. git-svn-id: http://mc-server.googlecode.com/svn/trunk@67 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cPickup.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'source/cPickup.cpp') 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; -- cgit v1.2.3