From e54373160b69c342dd1a625a841bda3707ba7acf Mon Sep 17 00:00:00 2001 From: "lapayo94@gmail.com" Date: Thu, 22 Dec 2011 16:30:40 +0000 Subject: Fixes: - Pickups fall through water now (Server-side they stayed in the water surface) - Suppressed some warnings (int to short etc.) - Water is now passable for cTracer git-svn-id: http://mc-server.googlecode.com/svn/trunk@96 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cPickup.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'source/cPickup.cpp') diff --git a/source/cPickup.cpp b/source/cPickup.cpp index 4788c2e1f..7c4a546ec 100644 --- a/source/cPickup.cpp +++ b/source/cPickup.cpp @@ -80,7 +80,8 @@ cPickup::cPickup(cPacket_PickupSpawn* a_PickupSpawnPacket) m_Speed->z = (float)(a_PickupSpawnPacket->m_Roll) / 8; // Spawn it on clients - cRoot::Get()->GetServer()->Broadcast( *a_PickupSpawnPacket ); + if(a_PickupSpawnPacket->m_Item != E_ITEM_EMPTY) + cRoot::Get()->GetServer()->Broadcast( *a_PickupSpawnPacket ); m_EntityType = E_PICKUP; } @@ -98,12 +99,13 @@ void cPickup::SpawnOn( cClientHandle* a_Target ) PickupSpawn.m_Rotation = (char)(m_Speed->x * 8); PickupSpawn.m_Pitch = (char)(m_Speed->y * 8); PickupSpawn.m_Roll = (char)(m_Speed->z * 8); - a_Target->Send( PickupSpawn ); + if(PickupSpawn.m_Item != E_ITEM_EMPTY) + a_Target->Send( PickupSpawn ); } void cPickup::Tick(float a_Dt) { - m_Timer+=a_Dt; + m_Timer += a_Dt; a_Dt = a_Dt / 1000.f; if(m_bCollected) { @@ -152,7 +154,9 @@ void cPickup::HandlePhysics(float a_Dt) cWorld* World = GetWorld(); 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 ) + char BlockBelow = World->GetBlock( BlockX, (int)m_Pos->y -1, BlockZ ); + //Not only air, falls through water ;) + if( BlockBelow == E_BLOCK_AIR || IsBlockWater(BlockBelow)) { m_bOnGround = false; } @@ -162,7 +166,8 @@ void cPickup::HandlePhysics(float a_Dt) m_Timer = 0; return; } - if( World->GetBlock( BlockX, (int)m_Pos->y, BlockZ ) != E_BLOCK_AIR ) // If in ground itself, push it out + char BlockIn = World->GetBlock( BlockX, (int)m_Pos->y, BlockZ ); + if( BlockIn != E_BLOCK_AIR && !IsBlockWater(BlockIn) ) // If in ground itself, push it out { m_bOnGround = true; m_Pos->y += 0.2; -- cgit v1.2.3