fix some robots not going to sleep if they fail to equip items
This commit is contained in:
parent
dfaf820db9
commit
9286f76dd5
4 changed files with 11 additions and 3 deletions
|
@ -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)
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue