Fixed pickups
parent
3e698d7b72
commit
198ac1892c
|
@ -358,13 +358,17 @@ void cBlockHandler::DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX
|
|||
|
||||
if (!Pickups.empty())
|
||||
{
|
||||
// Add random offset to the spawn position:
|
||||
// Commented out until bug with pickups not spawning properly is fixed, see World.cpp
|
||||
/*
|
||||
int MicroX = (int)(a_BlockX * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
|
||||
int MicroY = (int)(a_BlockY * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
|
||||
int MicroZ = (int)(a_BlockZ * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
|
||||
*/
|
||||
MTRand r1;
|
||||
|
||||
// Mid-block position first
|
||||
int MicroX = (int)(floor(a_BlockX) * 32) + 16;
|
||||
int MicroY = (int)(floor(a_BlockY) * 32) + 16;
|
||||
int MicroZ = (int)(floor(a_BlockZ) * 32) + 16;
|
||||
|
||||
// Add random offset second
|
||||
MicroX = (int)(a_BlockX * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
|
||||
MicroY = (int)(a_BlockY * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
|
||||
MicroZ = (int)(a_BlockZ * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
|
||||
|
||||
a_World->SpawnItemPickups(Pickups, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
|
||||
|
||||
cPickup::cPickup(int a_MicroPosX, int a_MicroPosY, int a_MicroPosZ, const cItem & a_Item, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */)
|
||||
: cEntity(etPickup, (((double)(a_MicroPosX)) / 32) + 0.1 /*Accomodate player vomiting*/, ((double)(a_MicroPosY)) / 32, ((double)(a_MicroPosZ)) / 32, 0.2, 0.2)
|
||||
cPickup::cPickup(double a_MicroPosX, double a_MicroPosY, double a_MicroPosZ, const cItem & a_Item, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */)
|
||||
: cEntity(etPickup, (double)(a_MicroPosX), (double)(a_MicroPosY), (double)(a_MicroPosZ), 0.2, 0.2)
|
||||
, m_Timer( 0.f )
|
||||
, m_Item(a_Item)
|
||||
, m_bCollected( false )
|
||||
|
|
|
@ -24,7 +24,7 @@ class cPickup :
|
|||
public:
|
||||
CLASS_PROTODEF(cPickup);
|
||||
|
||||
cPickup(int a_MicroPosX, int a_MicroPosY, int a_MicroPosZ, const cItem & a_Item, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f); // tolua_export
|
||||
cPickup(double a_MicroPosX, double a_MicroPosY, double a_MicroPosZ, const cItem & a_Item, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f); // tolua_export
|
||||
|
||||
cItem & GetItem(void) {return m_Item; } // tolua_export
|
||||
const cItem & GetItem(void) const {return m_Item; }
|
||||
|
|
|
@ -1522,14 +1522,9 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double
|
|||
float SpeedX = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
|
||||
float SpeedY = 1;
|
||||
float SpeedZ = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
|
||||
|
||||
// Pickup doesn't spawn on client without a mid block position. Perhaps the doubles are causing issues?
|
||||
int MicroX = (int)(floor(a_BlockX) * 32) + 16;
|
||||
int MicroY = (int)(floor(a_BlockY) * 32) + 16;
|
||||
int MicroZ = (int)(floor(a_BlockZ) * 32) + 16;
|
||||
|
||||
cPickup * Pickup = new cPickup(
|
||||
MicroX, MicroY, MicroZ,
|
||||
a_BlockX, a_BlockY, a_BlockZ,
|
||||
*itr, SpeedX, SpeedY, SpeedZ
|
||||
);
|
||||
Pickup->Initialize(this);
|
||||
|
@ -1542,16 +1537,10 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double
|
|||
|
||||
void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ)
|
||||
{
|
||||
MTRand r1;
|
||||
for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr)
|
||||
{
|
||||
// Pickup doesn't spawn on client without a mid block position. Perhaps the doubles are causing issues?
|
||||
int MicroX = (int)(floor(a_BlockX) * 32) + 16;
|
||||
int MicroY = (int)(floor(a_BlockY) * 32) + 16;
|
||||
int MicroZ = (int)(floor(a_BlockZ) * 32) + 16;
|
||||
|
||||
cPickup * Pickup = new cPickup(
|
||||
MicroX, MicroY, MicroZ,
|
||||
a_BlockX, a_BlockY, a_BlockZ,
|
||||
*itr, (float)a_SpeedX, (float)a_SpeedY, (float)a_SpeedZ
|
||||
);
|
||||
Pickup->Initialize(this);
|
||||
|
|
Loading…
Reference in New Issue