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) * Use the OreDict for the pipes recipes (ganymedes01)
* Fix robots not keeping their energy when being reprogrammed (hea3ven) * Fix robots not keeping their energy when being reprogrammed (hea3ven)
* Fix the builder robot not respecting the working area (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.core.lib.inventory.filters.IStackFilter;
import buildcraft.robotics.ai.AIRobotBreak; import buildcraft.robotics.ai.AIRobotBreak;
import buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack; import buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack;
import buildcraft.robotics.ai.AIRobotSleep;
public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearchBlock { public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearchBlock {
@ -42,7 +43,11 @@ public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearc
@Override @Override
public void delegateAIEnded(AIRobot ai) { 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()); releaseBlockFound(ai.success());
} }
super.delegateAIEnded(ai); super.delegateAIEnded(ai);

View file

@ -32,9 +32,11 @@ public class BoardRobotMiner extends BoardRobotGenericBreakBlock {
super.delegateAIEnded(ai); super.delegateAIEnded(ai);
if (ai instanceof AIRobotFetchAndEquipItemStack) { if (ai instanceof AIRobotFetchAndEquipItemStack) {
if (ai.success()) {
detectHarvestLevel(); detectHarvestLevel();
} }
} }
}
private void detectHarvestLevel() { private void detectHarvestLevel() {
ItemStack stack = robot.getHeldItem(); ItemStack stack = robot.getHeldItem();

View file

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