1
0
forked from s425077/PotatoPlan

small update

This commit is contained in:
BOTLester 2020-05-10 15:02:22 +02:00
parent 2375a52cd4
commit aee7262c45
3 changed files with 16 additions and 3 deletions

View File

@ -9,6 +9,8 @@ class Tractor
private Path path = new Path(); private Path path = new Path();
private SmartTractor smartTractor = new SmartTractor(); private SmartTractor smartTractor = new SmartTractor();
private HandleRotation handleRotation = new HandleRotation(); private HandleRotation handleRotation = new HandleRotation();
private int j = 60;
public void updateSizing(Input input, int Status, Vector2 newHousePos, DayNightCycle Time) public void updateSizing(Input input, int Status, Vector2 newHousePos, DayNightCycle Time)
{ {
@ -61,7 +63,6 @@ class Tractor
public void updatePosition(Vector2 Size, int Status) // updates the position public void updatePosition(Vector2 Size, int Status) // updates the position
{ {
//farm.updateSize(Size, sizeTile, Spacing); //farm.updateSize(Size, sizeTile, Spacing);
for (int i = 0; i < Speed; i++) for (int i = 0; i < Speed; i++)
{ {

View File

@ -18,6 +18,7 @@ class AI
private FertilizerHolder fertilizerHolder = new FertilizerHolder(); private FertilizerHolder fertilizerHolder = new FertilizerHolder();
private int Rotation; private int Rotation;
private Astar astar = new Astar(); private Astar astar = new Astar();
public bool WaitTwoFrames { get; set; }
private Random r = new Random(); private Random r = new Random();
@ -95,6 +96,7 @@ class AI
int y = (int)tractorPos.Y; int y = (int)tractorPos.Y;
Fertilizer fertilizer = new Fertilizer(); Fertilizer fertilizer = new Fertilizer();
fertilizerHolder.init(); fertilizerHolder.init();
WaitTwoFrames = false;
if (farm.getCrop(x, y).getStatus() >= 2) if (farm.getCrop(x, y).getStatus() >= 2)
{ {
fertilizer = fertilizerHolder.GetFertilizer(Engine.PredictFertilizer(farm.getCrop(x, y), farm.getPresetCropTypes(farm.getCrop(x, y).getCropType()))); fertilizer = fertilizerHolder.GetFertilizer(Engine.PredictFertilizer(farm.getCrop(x, y), farm.getPresetCropTypes(farm.getCrop(x, y).getCropType())));
@ -102,6 +104,7 @@ class AI
{ {
farm.getCrop(x, y).Fertilize(fertilizer); farm.getCrop(x, y).Fertilize(fertilizer);
fertilizer = fertilizerHolder.GetFertilizer(Engine.PredictFertilizer(farm.getCrop(x, y), farm.getPresetCropTypes(farm.getCrop(x, y).getCropType()))); fertilizer = fertilizerHolder.GetFertilizer(Engine.PredictFertilizer(farm.getCrop(x, y), farm.getPresetCropTypes(farm.getCrop(x, y).getCropType())));
WaitTwoFrames = true;
//System.Threading.Thread.Sleep(5); //System.Threading.Thread.Sleep(5);
} }
} }

View File

@ -24,9 +24,8 @@ class SmartTractor
//astar.update(farm.getCrops(), Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target / (tileSize + Spacing), Rotation); //astar.update(farm.getCrops(), Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target / (tileSize + Spacing), Rotation);
if (tractorPos == housePos) if (tractorPos == housePos)
ai.reloadCargo(); ai.reloadCargo();
return ai.newTarget(); return ai.newTarget();
//return astar.FindPath(true); //return astar.FindPath(true);
} }
@ -85,4 +84,14 @@ class SmartTractor
{ {
return ai.getInventory(); return ai.getInventory();
} }
public bool getWaitTwoFrames()
{
return ai.WaitTwoFrames;
}
public void setWaitTwoFrames(bool input)
{
ai.WaitTwoFrames = input;
}
} }