Fixed dropspensing speed and position

master
Tiger Wang 2013-11-02 14:09:07 +00:00
parent 77b3db7e25
commit 96cd7d65a3
1 changed files with 22 additions and 1 deletions

View File

@ -89,6 +89,8 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
int SmokeDir = 0;
switch (Meta)
{
case E_META_DROPSPENSER_FACING_YP: SmokeDir = 4; break; // YP & YM don't have associated smoke dirs, just do 4 (centre of block)
case E_META_DROPSPENSER_FACING_YM: SmokeDir = 4; break;
case E_META_DROPSPENSER_FACING_XM: SmokeDir = 3; break;
case E_META_DROPSPENSER_FACING_XP: SmokeDir = 5; break;
case E_META_DROPSPENSER_FACING_ZM: SmokeDir = 1; break;
@ -237,7 +239,26 @@ void cDropSpenserEntity::DropFromSlot(cChunk & a_Chunk, int a_SlotNum)
cItems Pickups;
Pickups.push_back(m_Contents.RemoveOneItem(a_SlotNum));
m_World->SpawnItemPickups(Pickups, DispX, DispY, DispZ);
const int PickupSpeed = m_World->GetTickRandomNumber(4) + 2; // At least 2, at most 6
int PickupSpeedX = 0, PickupSpeedY = 0, PickupSpeedZ = 0;
switch (Meta)
{
case E_META_DROPSPENSER_FACING_YP: PickupSpeedY = PickupSpeed; break;
case E_META_DROPSPENSER_FACING_YM: PickupSpeedY = -PickupSpeed; break;
case E_META_DROPSPENSER_FACING_XM: PickupSpeedX = -PickupSpeed; break;
case E_META_DROPSPENSER_FACING_XP: PickupSpeedX = PickupSpeed; break;
case E_META_DROPSPENSER_FACING_ZM: PickupSpeedZ = -PickupSpeed; break;
case E_META_DROPSPENSER_FACING_ZP: PickupSpeedZ = PickupSpeed; break;
}
double MicroX, MicroY, MicroZ;
MicroX = DispX + 0.5;
MicroY = DispY + 0.4; // Slightly less than half, to accomodate actual texture hole on DropSpenser
MicroZ = DispZ + 0.5;
m_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ, PickupSpeedX, PickupSpeedY, PickupSpeedZ);
}