Fixed command processing to work

This commit is contained in:
Henry Mao 2013-01-10 21:18:17 +08:00
parent af74b4230b
commit e07b10b47f
2 changed files with 16 additions and 0 deletions

View file

@ -4,12 +4,25 @@ import assemblyline.common.machine.armbot.TileEntityArmbot;
public class CommandIdle extends Command public class CommandIdle extends Command
{ {
/**
* The amount of time in which the machine will idle.
*/
public int idleTime = 80;
protected boolean doTask() protected boolean doTask()
{ {
/** /**
* Randomly move the arm to simulate life in the arm if the arm is powered * Randomly move the arm to simulate life in the arm if the arm is powered
*/ */
this.tileEntity.rotationPitch *= 0.98 * this.world.rand.nextFloat(); this.tileEntity.rotationPitch *= 0.98 * this.world.rand.nextFloat();
if (this.idleTime > 0)
{
this.idleTime--;
System.out.println("RESTING");
return true;
}
return false; return false;
} }

View file

@ -29,6 +29,7 @@ public class CommandManager
while (iter.hasNext()) while (iter.hasNext())
{ {
task = iter.next(); task = iter.next();
if (task.getTickInterval() > 0) if (task.getTickInterval() > 0)
{ {
if (this.ticks % task.getTickInterval() == 0) if (this.ticks % task.getTickInterval() == 0)
@ -38,6 +39,8 @@ public class CommandManager
task.onTaskEnd(); task.onTaskEnd();
iter.remove(); iter.remove();
} }
break;
} }
} }
} }