}
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotFetchItem) {
AIRobotFetchItem fetching = (AIRobotFetchItem) ai;
if (fetching.itemPickupCancelled || fetching.target != null) {
// if we find an item - that may have been cancelled.
// let's try to get another one
startDelegateAI(new AIRobotFetchItem(robot, 250, ActionRobotFilter.getGateFilter(robot
.getLinkedStation()), robot.getZoneToWork()));
} else if (robot.containsItems()) {
startDelegateAI(new AIRobotGotoStationAndUnload(robot, robot.getZoneToWork()));
} else {
startDelegateAI(new AIRobotGotoSleep(robot));