fix some robots not going to sleep if they fail to equip items

This commit is contained in:
Hea3veN 2015-06-04 19:59:07 -03:00
parent dfaf820db9
commit 9286f76dd5
4 changed files with 11 additions and 3 deletions

View file

@ -14,3 +14,4 @@ Bugs fixed:
* Use the OreDict for the pipes recipes (ganymedes01)
* Fix robots not keeping their energy when being reprogrammed (hea3ven)
* Fix the builder robot not respecting the working area (hea3ven)
* Fix some robots not going to sleep if they fail to equip items (hea3ven)

View file

@ -15,6 +15,7 @@ import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.robotics.ai.AIRobotBreak;
import buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack;
import buildcraft.robotics.ai.AIRobotSleep;
public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearchBlock {
@ -42,7 +43,11 @@ public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearc
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotBreak) {
if (ai instanceof AIRobotFetchAndEquipItemStack) {
if (!ai.success()) {
startDelegateAI(new AIRobotSleep(robot));
}
} else if (ai instanceof AIRobotBreak) {
releaseBlockFound(ai.success());
}
super.delegateAIEnded(ai);

View file

@ -32,7 +32,9 @@ public class BoardRobotMiner extends BoardRobotGenericBreakBlock {
super.delegateAIEnded(ai);
if (ai instanceof AIRobotFetchAndEquipItemStack) {
detectHarvestLevel();
if (ai.success()) {
detectHarvestLevel();
}
}
}

View file

@ -78,7 +78,7 @@ public class BoardRobotPlanter extends RedstoneBoardRobot {
} else if (ai instanceof AIRobotPlant) {
releaseBlockFound();
} else if (ai instanceof AIRobotFetchAndEquipItemStack) {
if (robot.getHeldItem() == null) {
if (!ai.success()) {
startDelegateAI(new AIRobotGotoSleep(robot));
}
}