Fixed issues with pickups.
* Now when picking up max. stack amount is checked. * Added cInventory::AddItemAnyAmount() which will not fail if it cannot add all items (it will just modify amount) * If there is no space in inventory and picking up stacked items, it will try to fill stacks already in inventory, partially picking up the item. * When closing inventory player will drop any items it's currently 'dragging' git-svn-id: http://mc-server.googlecode.com/svn/trunk@1008 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -256,12 +256,16 @@ bool cPickup::CollectedBy( cPlayer* a_Dest )
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a_Dest->GetInventory().AddItem(*m_Item))
|
||||
if (a_Dest->GetInventory().AddItemAnyAmount(*m_Item))
|
||||
{
|
||||
m_World->BroadcastCollectPickup(*this, *a_Dest);
|
||||
|
||||
m_bCollected = true;
|
||||
m_Timer = 0;
|
||||
if( m_Item->m_ItemCount != 0 ) {
|
||||
cItems Pickup;
|
||||
Pickup.push_back(cItem(*m_Item));
|
||||
m_World->SpawnItemPickups(Pickup, m_Pos.x, m_Pos.y, m_Pos.z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user