add a new Load/Unload area for robots
This commit is contained in:
parent
4652f19f28
commit
413cfc595d
30 changed files with 103 additions and 113 deletions
|
@ -57,6 +57,8 @@ public abstract class EntityRobotBase extends EntityLiving implements IInventory
|
|||
|
||||
public abstract IZone getZoneToWork();
|
||||
|
||||
public abstract IZone getZoneToLoadUnload();
|
||||
|
||||
public abstract boolean containsItems();
|
||||
|
||||
public abstract boolean hasFreeSlot();
|
||||
|
|
|
@ -139,6 +139,7 @@ gate.action.station.provide_machine_request=Provide Computed Items
|
|||
gate.action.station.accept_fluids=Accept Fluids
|
||||
gate.action.station.povide_fluids=Provide Fluids
|
||||
gate.action.robot.work_in_area=Work in Area
|
||||
gate.action.robot.load_unload_area=Load/Unload in Area
|
||||
gate.action.robot.wakeup=Wake Up
|
||||
gate.action.station.forbid_robot=Robot Forbidden
|
||||
gate.action.robot.filter=Filter
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 299 B |
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 259 B |
|
@ -155,6 +155,7 @@ import buildcraft.robotics.statements.RobotsTriggerProvider;
|
|||
import buildcraft.robotics.statements.TriggerRobotInStation;
|
||||
import buildcraft.robotics.statements.TriggerRobotLinked;
|
||||
import buildcraft.robotics.statements.TriggerRobotSleep;
|
||||
import buildcraft.robotics.statements.ActionRobotWorkInArea.AreaType;
|
||||
import buildcraft.silicon.ItemRedstoneChipset;
|
||||
|
||||
@Mod(name = "BuildCraft Robotics", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Robotics", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
|
@ -176,7 +177,8 @@ public class BuildCraftRobotics extends BuildCraftMod {
|
|||
|
||||
public static IActionInternal actionRobotGotoStation = new ActionRobotGotoStation();
|
||||
public static IActionInternal actionRobotWakeUp = new ActionRobotWakeUp();
|
||||
public static IActionInternal actionRobotWorkInArea = new ActionRobotWorkInArea();
|
||||
public static IActionInternal actionRobotWorkInArea = new ActionRobotWorkInArea(AreaType.WORK);
|
||||
public static IActionInternal actionRobotLoadUnloadArea = new ActionRobotWorkInArea(AreaType.LOAD_UNLOAD);
|
||||
public static IActionInternal actionRobotFilter = new ActionRobotFilter();
|
||||
public static IActionInternal actionRobotFilterTool = new ActionRobotFilterTool();
|
||||
public static IActionInternal actionRobotAllowCraft = new ActionStationAllowCraft();
|
||||
|
|
|
@ -67,6 +67,7 @@ import buildcraft.robotics.ai.AIRobotMain;
|
|||
import buildcraft.robotics.ai.AIRobotShutdown;
|
||||
import buildcraft.robotics.ai.AIRobotSleep;
|
||||
import buildcraft.robotics.statements.ActionRobotWorkInArea;
|
||||
import buildcraft.robotics.statements.ActionRobotWorkInArea.AreaType;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.gates.ActionIterator;
|
||||
|
||||
|
@ -606,8 +607,6 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
|
||||
currentDockingStationIndex = null;
|
||||
currentDockingStationSide = null;
|
||||
|
||||
mainAI.abortDelegateAI();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -923,14 +922,26 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
|
||||
@Override
|
||||
public IZone getZoneToWork() {
|
||||
if (linkedDockingStation instanceof DockingStation) {
|
||||
for (StatementSlot s : new ActionIterator(((DockingStation) linkedDockingStation).getPipe().getPipe())) {
|
||||
if (s.statement instanceof ActionRobotWorkInArea) {
|
||||
IZone zone = ActionRobotWorkInArea.getArea(s);
|
||||
return getZone(ActionRobotWorkInArea.AreaType.WORK);
|
||||
}
|
||||
|
||||
if (zone != null) {
|
||||
return zone;
|
||||
}
|
||||
@Override
|
||||
public IZone getZoneToLoadUnload() {
|
||||
IZone zone = getZone(ActionRobotWorkInArea.AreaType.LOAD_UNLOAD);
|
||||
if (zone == null) {
|
||||
zone = getZoneToWork();
|
||||
}
|
||||
return zone;
|
||||
}
|
||||
|
||||
private IZone getZone(AreaType areaType) {
|
||||
for (StatementSlot s : new ActionIterator(linkedDockingStation.getPipe().getPipe())) {
|
||||
if (s.statement instanceof ActionRobotWorkInArea
|
||||
&& ((ActionRobotWorkInArea) s.statement).getAreaType() == areaType) {
|
||||
IZone zone = ActionRobotWorkInArea.getArea(s);
|
||||
|
||||
if (zone != null) {
|
||||
return zone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -973,7 +984,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
@Override
|
||||
protected boolean interact(EntityPlayer player) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(player.isSneaking() && stack != null && stack.getItem() == BuildCraftCore.wrenchItem) {
|
||||
if (player.isSneaking() && stack != null && stack.getItem() == BuildCraftCore.wrenchItem) {
|
||||
if (!worldObj.isRemote) {
|
||||
convertToItems();
|
||||
} else {
|
||||
|
|
|
@ -67,7 +67,7 @@ public class AIRobotCraftAssemblyTable extends AIRobotCraftGeneric {
|
|||
if (table != null) {
|
||||
if (!craftStarted) {
|
||||
if (requirements.size() != 0) {
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, new ReqStackFilter(), robot.getZoneToWork(), 1));
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, new ReqStackFilter(), 1));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,14 +64,13 @@ public class AIRobotCraftFurnace extends AIRobotCraftGeneric {
|
|||
if (furnace != null) {
|
||||
if (!craftStarted) {
|
||||
if (furnace.getStackInSlot(FUEL_SLOT) == null && InvUtils.getItem(robot, new FuelFilter()) == null) {
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, new FuelFilter(), robot.getZoneToWork(), 1));
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, new FuelFilter(), 1));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (InvUtils.getItem(robot, new ArrayStackFilter(input)) == null) {
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, new ArrayStackFilter(input),
|
||||
robot.getZoneToWork(), 1));
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, new ArrayStackFilter(input), 1));
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class AIRobotCraftWorkbench extends AIRobotCraftGeneric {
|
|||
terminate();
|
||||
}
|
||||
} else if (requirements.size() > 0) {
|
||||
startDelegateAI(new AIRobotGotoStationToLoad(robot, new ReqStackFilter(), robot.getZoneToWork()));
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, new ReqStackFilter(), 1));
|
||||
} else {
|
||||
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationWorkbenchFilter(), robot.getZoneToWork()));
|
||||
}
|
||||
|
@ -98,14 +98,12 @@ public class AIRobotCraftWorkbench extends AIRobotCraftGeneric {
|
|||
|
||||
@Override
|
||||
public void delegateAIEnded(AIRobot ai) {
|
||||
if (ai instanceof AIRobotGotoStationToLoad) {
|
||||
if (ai instanceof AIRobotGotoStationAndLoad) {
|
||||
if (ai.success()) {
|
||||
startDelegateAI(new AIRobotLoad(robot, new ReqStackFilter(), 1));
|
||||
requirements = tryCraft(false);
|
||||
} else {
|
||||
terminate();
|
||||
}
|
||||
} else if (ai instanceof AIRobotLoad) {
|
||||
requirements = tryCraft(false);
|
||||
} else if (ai instanceof AIRobotSearchAndGotoStation) {
|
||||
if (new StationWorkbenchFilter().matches((DockingStation) robot.getDockingStation())) {
|
||||
craftingTimer = 40;
|
||||
|
|
|
@ -22,7 +22,7 @@ public class AIRobotDisposeItems extends AIRobot {
|
|||
|
||||
@Override
|
||||
public void start () {
|
||||
startDelegateAI(new AIRobotGotoStationAndUnload(robot, robot.getZoneToWork()));
|
||||
startDelegateAI(new AIRobotGotoStationAndUnload(robot));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,7 @@ public class AIRobotDisposeItems extends AIRobot {
|
|||
if (ai instanceof AIRobotGotoStationAndUnload) {
|
||||
if (ai.success()) {
|
||||
if (robot.containsItems()) {
|
||||
startDelegateAI(new AIRobotGotoStationAndUnload(robot, robot.getZoneToWork()));
|
||||
startDelegateAI(new AIRobotGotoStationAndUnload(robot));
|
||||
} else {
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class AIRobotFetchAndEquipItemStack extends AIRobot {
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, robot.getZoneToWork()));
|
||||
startDelegateAI(new AIRobotGotoStationToLoad(robot, filter));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
package buildcraft.robotics.ai;
|
||||
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.lib.inventory.filters.IStackFilter;
|
||||
|
@ -16,24 +15,22 @@ import buildcraft.core.lib.inventory.filters.IStackFilter;
|
|||
public class AIRobotGotoStationAndLoad extends AIRobot {
|
||||
|
||||
private IStackFilter filter;
|
||||
private IZone zone;
|
||||
private int quantity;
|
||||
|
||||
public AIRobotGotoStationAndLoad(EntityRobotBase iRobot) {
|
||||
super(iRobot);
|
||||
}
|
||||
|
||||
public AIRobotGotoStationAndLoad(EntityRobotBase iRobot, IStackFilter iFilter, IZone iZone, int iQuantity) {
|
||||
public AIRobotGotoStationAndLoad(EntityRobotBase iRobot, IStackFilter iFilter, int iQuantity) {
|
||||
this(iRobot);
|
||||
|
||||
filter = iFilter;
|
||||
zone = iZone;
|
||||
quantity = iQuantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, zone));
|
||||
startDelegateAI(new AIRobotGotoStationToLoad(robot, filter));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,30 +8,27 @@
|
|||
*/
|
||||
package buildcraft.robotics.ai;
|
||||
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.lib.inventory.filters.IFluidFilter;
|
||||
|
||||
public class AIRobotGotoStationAndLoadFluids extends AIRobot {
|
||||
|
||||
private IZone zone;
|
||||
private IFluidFilter filter;
|
||||
|
||||
public AIRobotGotoStationAndLoadFluids(EntityRobotBase iRobot) {
|
||||
super(iRobot);
|
||||
}
|
||||
|
||||
public AIRobotGotoStationAndLoadFluids(EntityRobotBase iRobot, IFluidFilter iFilter, IZone iZone) {
|
||||
public AIRobotGotoStationAndLoadFluids(EntityRobotBase iRobot, IFluidFilter iFilter) {
|
||||
this(iRobot);
|
||||
|
||||
zone = iZone;
|
||||
filter = iFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
startDelegateAI(new AIRobotGotoStationToLoadFluids(robot, filter, zone));
|
||||
startDelegateAI(new AIRobotGotoStationToLoadFluids(robot, filter));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,24 +8,18 @@
|
|||
*/
|
||||
package buildcraft.robotics.ai;
|
||||
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.DockingStation;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
|
||||
public class AIRobotGotoStationAndUnload extends AIRobot {
|
||||
|
||||
private IZone zone;
|
||||
private DockingStation station;
|
||||
|
||||
public AIRobotGotoStationAndUnload(EntityRobotBase iRobot) {
|
||||
super(iRobot);
|
||||
}
|
||||
|
||||
public AIRobotGotoStationAndUnload(EntityRobotBase iRobot, IZone iZone) {
|
||||
this(iRobot);
|
||||
|
||||
zone = iZone;
|
||||
station = null;
|
||||
}
|
||||
|
||||
public AIRobotGotoStationAndUnload(EntityRobotBase iRobot, DockingStation iStation) {
|
||||
|
@ -37,7 +31,7 @@ public class AIRobotGotoStationAndUnload extends AIRobot {
|
|||
@Override
|
||||
public void start() {
|
||||
if (station == null) {
|
||||
startDelegateAI(new AIRobotGotoStationToUnload(robot, zone));
|
||||
startDelegateAI(new AIRobotGotoStationToUnload(robot));
|
||||
} else {
|
||||
startDelegateAI(new AIRobotGotoStation(robot, station));
|
||||
}
|
||||
|
|
|
@ -8,27 +8,18 @@
|
|||
*/
|
||||
package buildcraft.robotics.ai;
|
||||
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
|
||||
public class AIRobotGotoStationAndUnloadFluids extends AIRobot {
|
||||
|
||||
private IZone zone;
|
||||
|
||||
public AIRobotGotoStationAndUnloadFluids(EntityRobotBase iRobot) {
|
||||
super(iRobot);
|
||||
}
|
||||
|
||||
public AIRobotGotoStationAndUnloadFluids(EntityRobotBase iRobot, IZone iZone) {
|
||||
this(iRobot);
|
||||
|
||||
zone = iZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
startDelegateAI(new AIRobotGotoStationToUnloadFluids(robot, zone));
|
||||
startDelegateAI(new AIRobotGotoStationToUnloadFluids(robot));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,6 @@ package buildcraft.robotics.ai;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.DockingStation;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
|
@ -25,22 +24,20 @@ import buildcraft.robotics.statements.ActionStationProvideItems;
|
|||
public class AIRobotGotoStationToLoad extends AIRobot {
|
||||
|
||||
private IStackFilter filter;
|
||||
private IZone zone;
|
||||
|
||||
public AIRobotGotoStationToLoad(EntityRobotBase iRobot) {
|
||||
super(iRobot);
|
||||
}
|
||||
|
||||
public AIRobotGotoStationToLoad(EntityRobotBase iRobot, IStackFilter iFilter, IZone iZone) {
|
||||
public AIRobotGotoStationToLoad(EntityRobotBase iRobot, IStackFilter iFilter) {
|
||||
this(iRobot);
|
||||
|
||||
filter = iFilter;
|
||||
zone = iZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationFilter(), zone));
|
||||
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationFilter(), robot.getZoneToLoadUnload()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,16 +30,15 @@ public class AIRobotGotoStationToLoadFluids extends AIRobot {
|
|||
super(iRobot);
|
||||
}
|
||||
|
||||
public AIRobotGotoStationToLoadFluids(EntityRobotBase iRobot, IFluidFilter iFiler, IZone iZone) {
|
||||
public AIRobotGotoStationToLoadFluids(EntityRobotBase iRobot, IFluidFilter iFiler) {
|
||||
this(iRobot);
|
||||
|
||||
zone = iZone;
|
||||
filter = iFiler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationFilter(), zone));
|
||||
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationFilter(), robot.getZoneToLoadUnload()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,6 @@ package buildcraft.robotics.ai;
|
|||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.core.IInvSlot;
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.DockingStation;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
|
@ -24,22 +23,13 @@ import buildcraft.transport.gates.ActionIterator;
|
|||
|
||||
public class AIRobotGotoStationToUnload extends AIRobot {
|
||||
|
||||
private IZone zone;
|
||||
|
||||
public AIRobotGotoStationToUnload(EntityRobotBase iRobot) {
|
||||
super(iRobot);
|
||||
}
|
||||
|
||||
public AIRobotGotoStationToUnload(EntityRobotBase iRobot, IZone iZone) {
|
||||
this(iRobot);
|
||||
|
||||
zone = iZone;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationInventory(), zone));
|
||||
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationInventory(), robot.getZoneToLoadUnload()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,6 @@ package buildcraft.robotics.ai;
|
|||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.DockingStation;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
|
@ -23,21 +22,13 @@ import buildcraft.transport.PipeTransportFluids;
|
|||
|
||||
public class AIRobotGotoStationToUnloadFluids extends AIRobot {
|
||||
|
||||
private IZone zone;
|
||||
|
||||
public AIRobotGotoStationToUnloadFluids(EntityRobotBase iRobot) {
|
||||
super(iRobot);
|
||||
}
|
||||
|
||||
public AIRobotGotoStationToUnloadFluids(EntityRobotBase iRobot, IZone iZone) {
|
||||
this(iRobot);
|
||||
|
||||
zone = iZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationFilter(), zone));
|
||||
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationFilter(), robot.getZoneToLoadUnload()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,6 +23,7 @@ public class AIRobotSearchBlock extends AIRobot {
|
|||
private IterableAlgorithmRunner blockScannerJob;
|
||||
private IBlockFilter pathFound;
|
||||
private Iterator<BlockIndex> blockIter;
|
||||
private IZone zone;
|
||||
|
||||
public AIRobotSearchBlock(EntityRobotBase iRobot, boolean random, IBlockFilter iPathFound) {
|
||||
super(iRobot);
|
||||
|
@ -31,7 +32,7 @@ public class AIRobotSearchBlock extends AIRobot {
|
|||
if (!random) {
|
||||
blockIter = new BlockScannerExpanding().iterator();
|
||||
} else {
|
||||
IZone zone = iRobot.getZoneToWork();
|
||||
zone = iRobot.getZoneToWork();
|
||||
if (zone != null) {
|
||||
BlockIndex pos = new BlockIndex(iRobot);
|
||||
blockIter = new BlockScannerZoneRandom(pos.x, pos.y, pos.z, iRobot.worldObj.rand, zone)
|
||||
|
@ -47,8 +48,7 @@ public class AIRobotSearchBlock extends AIRobot {
|
|||
@Override
|
||||
public void start() {
|
||||
blockScanner = new PathFindingSearch(robot.worldObj, new BlockIndex(
|
||||
robot), blockIter, pathFound, 96, robot
|
||||
.getZoneToWork());
|
||||
robot), blockIter, pathFound, 96, zone);
|
||||
blockScannerJob = new IterableAlgorithmRunner(blockScanner);
|
||||
blockScannerJob.start();
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class BoardRobotBomber extends RedstoneBoardRobot {
|
|||
}
|
||||
|
||||
if (!containItems) {
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, TNT_FILTER, null, AIRobotLoad.ANY_QUANTITY));
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, TNT_FILTER, AIRobotLoad.ANY_QUANTITY));
|
||||
} else {
|
||||
startDelegateAI(new AIRobotSearchRandomGroundBlock(robot, 100, new IBlockFilter() {
|
||||
@Override
|
||||
|
|
|
@ -21,8 +21,7 @@ import buildcraft.core.builders.BuildingSlot;
|
|||
import buildcraft.core.lib.inventory.filters.ArrayStackFilter;
|
||||
import buildcraft.robotics.ai.AIRobotGotoBlock;
|
||||
import buildcraft.robotics.ai.AIRobotGotoSleep;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationToLoad;
|
||||
import buildcraft.robotics.ai.AIRobotLoad;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationAndLoad;
|
||||
import buildcraft.robotics.ai.AIRobotRecharge;
|
||||
|
||||
public class BoardRobotBuilder extends RedstoneBoardRobot {
|
||||
|
@ -93,9 +92,8 @@ public class BoardRobotBuilder extends RedstoneBoardRobot {
|
|||
}
|
||||
|
||||
if (requirementsToLookFor != null && requirementsToLookFor.size() > 0) {
|
||||
startDelegateAI(new AIRobotGotoStationToLoad(robot,
|
||||
new ArrayStackFilter(requirementsToLookFor.getFirst()),
|
||||
robot.getZoneToWork()));
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, new ArrayStackFilter(
|
||||
requirementsToLookFor.getFirst()), requirementsToLookFor.getFirst().stackSize));
|
||||
}
|
||||
|
||||
if (currentBuildingSlot != null && requirementsToLookFor != null && requirementsToLookFor.size() == 0) {
|
||||
|
@ -121,16 +119,12 @@ public class BoardRobotBuilder extends RedstoneBoardRobot {
|
|||
|
||||
@Override
|
||||
public void delegateAIEnded(AIRobot ai) {
|
||||
if (ai instanceof AIRobotGotoStationToLoad) {
|
||||
if (ai instanceof AIRobotGotoStationAndLoad) {
|
||||
if (ai.success()) {
|
||||
startDelegateAI(new AIRobotLoad(robot, new ArrayStackFilter(requirementsToLookFor.getFirst()),
|
||||
requirementsToLookFor.getFirst().stackSize));
|
||||
requirementsToLookFor.removeFirst();
|
||||
} else {
|
||||
startDelegateAI(new AIRobotGotoSleep(robot));
|
||||
}
|
||||
} else if (ai instanceof AIRobotLoad) {
|
||||
// TODO: check that we get the proper items in
|
||||
requirementsToLookFor.removeFirst();
|
||||
} else if (ai instanceof AIRobotGotoBlock) {
|
||||
if (markerToBuild == null || markerToBuild.bluePrintBuilder == null) {
|
||||
// defensive code, in case of a wrong load from NBT
|
||||
|
|
|
@ -34,10 +34,9 @@ public class BoardRobotCarrier extends RedstoneBoardRobot {
|
|||
public void update() {
|
||||
if (!robot.containsItems()) {
|
||||
IStackFilter filter = ActionRobotFilter.getGateFilter(robot.getLinkedStation());
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, filter, robot.getZoneToWork(),
|
||||
AIRobotLoad.ANY_QUANTITY));
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, filter, AIRobotLoad.ANY_QUANTITY));
|
||||
} else {
|
||||
startDelegateAI(new AIRobotGotoStationAndUnload(robot, robot.getZoneToWork()));
|
||||
startDelegateAI(new AIRobotGotoStationAndUnload(robot));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class BoardRobotDelivery extends RedstoneBoardRobot {
|
|||
startDelegateAI(new AIRobotSearchStackRequest(robot, ActionRobotFilter.getGateFilter(robot
|
||||
.getLinkedStation()), deliveryBlacklist));
|
||||
} else {
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, new ReqFilter(), robot.getZoneToWork(), 1));
|
||||
startDelegateAI(new AIRobotGotoStationAndLoad(robot, new ReqFilter(), 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,9 @@ public class BoardRobotFluidCarrier extends RedstoneBoardRobot {
|
|||
public void update() {
|
||||
if (!robotHasFluid()) {
|
||||
IFluidFilter filter = ActionRobotFilter.getGateFluidFilter(robot.getLinkedStation());
|
||||
startDelegateAI(new AIRobotGotoStationAndLoadFluids(robot, filter,
|
||||
robot.getZoneToWork()));
|
||||
startDelegateAI(new AIRobotGotoStationAndLoadFluids(robot, filter));
|
||||
} else {
|
||||
startDelegateAI(new AIRobotGotoStationAndUnloadFluids(robot, robot.getZoneToWork()));
|
||||
startDelegateAI(new AIRobotGotoStationAndUnloadFluids(robot));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class BoardRobotPicker extends RedstoneBoardRobot {
|
|||
startDelegateAI(new AIRobotFetchItem(robot, 250, ActionRobotFilter.getGateFilter(robot
|
||||
.getLinkedStation()), robot.getZoneToWork()));
|
||||
} else if (robot.containsItems()) {
|
||||
startDelegateAI(new AIRobotGotoStationAndUnload(robot, robot.getZoneToWork()));
|
||||
startDelegateAI(new AIRobotGotoStationAndUnload(robot));
|
||||
} else {
|
||||
startDelegateAI(new AIRobotGotoSleep(robot));
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class BoardRobotPump extends RedstoneBoardRobot {
|
|||
FluidStack tank = robot.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;
|
||||
|
||||
if (tank != null && tank.amount > 0) {
|
||||
startDelegateAI(new AIRobotGotoStationAndUnloadFluids(robot, robot.getZoneToWork()));
|
||||
startDelegateAI(new AIRobotGotoStationAndUnloadFluids(robot));
|
||||
} else {
|
||||
updateFilter();
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public class BoardRobotStripes extends RedstoneBoardRobot {
|
|||
startDelegateAI(new AIRobotGotoSleep(robot));
|
||||
}
|
||||
} else if (ai instanceof AIRobotFetchAndEquipItemStack) {
|
||||
if (robot.getHeldItem() == null) {
|
||||
if (!ai.success()) {
|
||||
startDelegateAI(new AIRobotGotoSleep(robot));
|
||||
}
|
||||
} else if (ai instanceof AIRobotStripesHandler) {
|
||||
|
|
|
@ -22,18 +22,45 @@ import buildcraft.core.statements.BCStatement;
|
|||
|
||||
public class ActionRobotWorkInArea extends BCStatement implements IActionInternal {
|
||||
|
||||
public ActionRobotWorkInArea() {
|
||||
super("buildcraft:robot.work_in_area");
|
||||
public enum AreaType {
|
||||
WORK("work_in_area"),
|
||||
LOAD_UNLOAD("load_unload_area");
|
||||
|
||||
private String name;
|
||||
|
||||
private AreaType(String iName) {
|
||||
name = iName;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return "buildcraft:robot." + name;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return "gate.action.robot." + name;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return "buildcraftrobotics:triggers/action_robot_" + name;
|
||||
}
|
||||
}
|
||||
|
||||
private AreaType areaType;
|
||||
|
||||
public ActionRobotWorkInArea(AreaType iAreaType) {
|
||||
super(iAreaType.getTag());
|
||||
|
||||
areaType = iAreaType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return StringUtils.localize("gate.action.robot.work_in_area");
|
||||
return StringUtils.localize(areaType.getUnlocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icon = iconRegister.registerIcon("buildcraftrobotics:triggers/action_robot_in_area");
|
||||
icon = iconRegister.registerIcon(areaType.getIcon());
|
||||
}
|
||||
|
||||
public static IZone getArea(StatementSlot slot) {
|
||||
|
@ -67,8 +94,10 @@ public class ActionRobotWorkInArea extends BCStatement implements IActionInterna
|
|||
}
|
||||
|
||||
@Override
|
||||
public void actionActivate(IStatementContainer source,
|
||||
IStatementParameter[] parameters) {
|
||||
|
||||
public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) {
|
||||
}
|
||||
|
||||
public AreaType getAreaType() {
|
||||
return areaType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
package buildcraft.robotics.statements;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -52,6 +51,7 @@ public class RobotsActionProvider implements IActionProvider {
|
|||
|
||||
result.add(BuildCraftRobotics.actionRobotGotoStation);
|
||||
result.add(BuildCraftRobotics.actionRobotWorkInArea);
|
||||
result.add(BuildCraftRobotics.actionRobotLoadUnloadArea);
|
||||
result.add(BuildCraftRobotics.actionRobotWakeUp);
|
||||
result.add(BuildCraftRobotics.actionRobotFilter);
|
||||
result.add(BuildCraftRobotics.actionRobotFilterTool);
|
||||
|
|
Loading…
Reference in a new issue