Villager: Farmer: Crops finding is more random.
This commit is contained in:
parent
9807056a9c
commit
3dbe6c6de9
@ -101,13 +101,15 @@ void cVillager::HandleFarmer()
|
|||||||
(int) GetPosZ() - 5,
|
(int) GetPosZ() - 5,
|
||||||
(int) GetPosZ() + 5);
|
(int) GetPosZ() + 5);
|
||||||
|
|
||||||
// Check for crops in a 10x6x10 area.
|
|
||||||
for (int X = 0; X < 10; X++)
|
for (int I = 0; I < 5; I++)
|
||||||
{
|
{
|
||||||
for (int Y = 0; Y < 6; Y++)
|
for (int Y = 0; Y < 6; Y++)
|
||||||
{
|
{
|
||||||
for (int Z = 0; Z < 10; Z++)
|
// Pick random coordinates and check for crops.
|
||||||
{
|
int X = m_World->GetTickRandomNumber(11);
|
||||||
|
int Z = m_World->GetTickRandomNumber(11);
|
||||||
|
|
||||||
if (!IsBlockFarmable(Surrounding.GetRelBlockType(X, Y, Z)))
|
if (!IsBlockFarmable(Surrounding.GetRelBlockType(X, Y, Z)))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -121,9 +123,8 @@ void cVillager::HandleFarmer()
|
|||||||
m_CropsPos = Vector3i((int) GetPosX() + X - 5, (int) GetPosY() + Y - 3, (int) GetPosZ() + Z - 5);
|
m_CropsPos = Vector3i((int) GetPosX() + X - 5, (int) GetPosY() + Y - 3, (int) GetPosZ() + Z - 5);
|
||||||
MoveToPosition(Vector3f((float) (m_CropsPos.x + 0.5), (float) m_CropsPos.y, (float) (m_CropsPos.z + 0.5)));
|
MoveToPosition(Vector3f((float) (m_CropsPos.x + 0.5), (float) m_CropsPos.y, (float) (m_CropsPos.z + 0.5)));
|
||||||
return;
|
return;
|
||||||
}
|
} // for Y loop.
|
||||||
}
|
} // Repeat the procces 5 times.
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user