Item-dropping code rewritten and centralized - now there's only one place to modify if we want to split or merge same-item drops: cWorld:SpawnItemPickups(). Also, mined blocks can now drop more items, and they recognize if they're being mined by the correct tool.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@561 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
#include "Globals.h"
|
||||
|
||||
#include <set>
|
||||
#include <queue>
|
||||
|
||||
#include "cFluidSimulator.h"
|
||||
#include "cWorld.h"
|
||||
#include "Vector3i.h"
|
||||
#include "BlockID.h"
|
||||
#include "Defines.h"
|
||||
#include <set>
|
||||
#include "cPickup.h"
|
||||
#include "cItem.h"
|
||||
#include <queue>
|
||||
#include "cBlockToPickup.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//#define DEBUG_FLUID
|
||||
#ifdef DEBUG_FLUID
|
||||
@@ -17,6 +23,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class cFluidSimulator::FluidData
|
||||
{
|
||||
public:
|
||||
@@ -343,14 +352,15 @@ void cFluidSimulator::Simulate( float a_Dt )
|
||||
{
|
||||
char DownID = m_World->GetBlock( pos.x, pos.y-1, pos.z );
|
||||
bool bWashedAwayItem = CanWashAway( DownID );
|
||||
if( (IsPassableForFluid(DownID) || bWashedAwayItem)&&!IsStationaryBlock(DownID) ) // free for fluid
|
||||
if( (IsPassableForFluid(DownID) || bWashedAwayItem) && !IsStationaryBlock(DownID) ) // free for fluid
|
||||
{
|
||||
if( bWashedAwayItem )
|
||||
{
|
||||
cPickup* Pickup = new cPickup( pos.x * 32 + 16, (pos.y-1) * 32 + 16, pos.z * 32 + 16, cItem( (ENUM_ITEM_ID)DownID, 1, m_World->GetBlockMeta( pos.x, pos.y-1, pos.z ) ) );
|
||||
Pickup->Initialize( m_World );
|
||||
cItems Drops;
|
||||
cBlockToPickup::ToPickup(DownID, m_World->GetBlockMeta(pos.x, pos.y - 1, pos.z), E_ITEM_EMPTY, Drops);
|
||||
m_World->SpawnItemPickups(Drops, pos.x, pos.y - 1, pos.z);
|
||||
}
|
||||
if( pos.y > 0 )
|
||||
if (pos.y > 0)
|
||||
{
|
||||
m_World->FastSetBlock( pos.x, pos.y-1, pos.z, m_FluidBlock, 8 ); // falling
|
||||
AddBlock( pos.x, pos.y-1, pos.z );
|
||||
@@ -374,14 +384,15 @@ void cFluidSimulator::Simulate( float a_Dt )
|
||||
char BlockID = m_World->GetBlock( p.x, p.y, p.z );
|
||||
bool bWashedAwayItem = CanWashAway( BlockID );
|
||||
|
||||
if(!IsPassableForFluid(BlockID)) continue;
|
||||
if (!IsPassableForFluid(BlockID)) continue;
|
||||
|
||||
if( !IsAllowedBlock( BlockID ) )
|
||||
if (!IsAllowedBlock(BlockID))
|
||||
{
|
||||
if( bWashedAwayItem )
|
||||
if (bWashedAwayItem)
|
||||
{
|
||||
cPickup* Pickup = new cPickup( p.x * 32 + 16, p.y * 32 + 16, p.z * 32 + 16, cItem( (ENUM_ITEM_ID)BlockID, 1, m_World->GetBlockMeta( p.x, p.y, p.z ) ) );
|
||||
Pickup->Initialize( m_World );
|
||||
cItems Drops;
|
||||
cBlockToPickup::ToPickup(DownID, m_World->GetBlockMeta(p.x, p.y, p.z), E_ITEM_EMPTY, Drops);
|
||||
m_World->SpawnItemPickups(Drops, p.x, p.y, p.z);
|
||||
}
|
||||
|
||||
if( p.y == pos.y )
|
||||
|
||||
Reference in New Issue
Block a user