From 413cfc595d52f4b30d4b3d93852b06b09db4a681 Mon Sep 17 00:00:00 2001 From: Hea3veN Date: Wed, 8 Apr 2015 20:47:03 -0300 Subject: [PATCH] add a new Load/Unload area for robots --- .../api/robots/EntityRobotBase.java | 2 + .../assets/buildcraft/lang/en_US.lang | 1 + .../action_robot_load_unload_area.png | Bin 0 -> 299 bytes ...area.png => action_robot_work_in_area.png} | Bin common/buildcraft/BuildCraftRobotics.java | 4 +- common/buildcraft/robotics/EntityRobot.java | 31 +++++++++---- .../ai/AIRobotCraftAssemblyTable.java | 2 +- .../robotics/ai/AIRobotCraftFurnace.java | 5 +- .../robotics/ai/AIRobotCraftWorkbench.java | 8 ++-- .../robotics/ai/AIRobotDisposeItems.java | 4 +- .../ai/AIRobotFetchAndEquipItemStack.java | 2 +- .../ai/AIRobotGotoStationAndLoad.java | 7 +-- .../ai/AIRobotGotoStationAndLoadFluids.java | 7 +-- .../ai/AIRobotGotoStationAndUnload.java | 10 +--- .../ai/AIRobotGotoStationAndUnloadFluids.java | 11 +---- .../robotics/ai/AIRobotGotoStationToLoad.java | 7 +-- .../ai/AIRobotGotoStationToLoadFluids.java | 5 +- .../ai/AIRobotGotoStationToUnload.java | 12 +---- .../ai/AIRobotGotoStationToUnloadFluids.java | 11 +---- .../robotics/ai/AIRobotSearchBlock.java | 6 +-- .../robotics/boards/BoardRobotBomber.java | 2 +- .../robotics/boards/BoardRobotBuilder.java | 16 ++----- .../robotics/boards/BoardRobotCarrier.java | 5 +- .../robotics/boards/BoardRobotDelivery.java | 2 +- .../boards/BoardRobotFluidCarrier.java | 5 +- .../robotics/boards/BoardRobotPicker.java | 2 +- .../robotics/boards/BoardRobotPump.java | 2 +- .../robotics/boards/BoardRobotStripes.java | 2 +- .../statements/ActionRobotWorkInArea.java | 43 +++++++++++++++--- .../statements/RobotsActionProvider.java | 2 +- 30 files changed, 103 insertions(+), 113 deletions(-) create mode 100644 buildcraft_resources/assets/buildcraftrobotics/textures/items/triggers/action_robot_load_unload_area.png rename buildcraft_resources/assets/buildcraftrobotics/textures/items/triggers/{action_robot_in_area.png => action_robot_work_in_area.png} (100%) diff --git a/api/buildcraft/api/robots/EntityRobotBase.java b/api/buildcraft/api/robots/EntityRobotBase.java index 35ecc2af..f1fab17f 100755 --- a/api/buildcraft/api/robots/EntityRobotBase.java +++ b/api/buildcraft/api/robots/EntityRobotBase.java @@ -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(); diff --git a/buildcraft_resources/assets/buildcraft/lang/en_US.lang b/buildcraft_resources/assets/buildcraft/lang/en_US.lang index 6f40f6f2..5bf9d815 100644 --- a/buildcraft_resources/assets/buildcraft/lang/en_US.lang +++ b/buildcraft_resources/assets/buildcraft/lang/en_US.lang @@ -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 diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/items/triggers/action_robot_load_unload_area.png b/buildcraft_resources/assets/buildcraftrobotics/textures/items/triggers/action_robot_load_unload_area.png new file mode 100644 index 0000000000000000000000000000000000000000..8f16081d9849b4932d539681ed5c52b1d7920718 GIT binary patch literal 299 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP~3x}Acj&=Q(cR-;Xo-U3d7N?I+GURG85O9s3rrLY# z*r__v{D+d?TpnG_xpRv921lHOfxw$Bk<+fqc0XteZaw+u`1~h_uP)tp?lk9G^9RP& z)AL^MihEY6<|));$aB~sP{eDNDC04SPd4eZ)Q%OZa5On>S%~D<$kl*kt qcHynoWPQ7$@B2ml+{p;47(8A5T-G@yGywo8 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; diff --git a/common/buildcraft/robotics/ai/AIRobotDisposeItems.java b/common/buildcraft/robotics/ai/AIRobotDisposeItems.java index 03c6c298..e04b84d7 100755 --- a/common/buildcraft/robotics/ai/AIRobotDisposeItems.java +++ b/common/buildcraft/robotics/ai/AIRobotDisposeItems.java @@ -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(); } diff --git a/common/buildcraft/robotics/ai/AIRobotFetchAndEquipItemStack.java b/common/buildcraft/robotics/ai/AIRobotFetchAndEquipItemStack.java index d10b51a4..fee76423 100755 --- a/common/buildcraft/robotics/ai/AIRobotFetchAndEquipItemStack.java +++ b/common/buildcraft/robotics/ai/AIRobotFetchAndEquipItemStack.java @@ -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 diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java b/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java index 91b2a8b3..bfd3ea6e 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java @@ -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 diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoadFluids.java b/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoadFluids.java index 5a59e4c0..d1c89faf 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoadFluids.java @@ -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 diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnload.java b/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnload.java index 1ac32f1d..4e4d9897 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnload.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnload.java @@ -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)); } diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnloadFluids.java b/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnloadFluids.java index c5105449..3ebd02a3 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnloadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnloadFluids.java @@ -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 diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationToLoad.java b/common/buildcraft/robotics/ai/AIRobotGotoStationToLoad.java index 8153c17b..10542d73 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationToLoad.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationToLoad.java @@ -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 diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationToLoadFluids.java b/common/buildcraft/robotics/ai/AIRobotGotoStationToLoadFluids.java index a66eceae..08872f92 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationToLoadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationToLoadFluids.java @@ -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 diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationToUnload.java b/common/buildcraft/robotics/ai/AIRobotGotoStationToUnload.java index b230488e..23cd0ccf 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationToUnload.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationToUnload.java @@ -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 diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationToUnloadFluids.java b/common/buildcraft/robotics/ai/AIRobotGotoStationToUnloadFluids.java index 79016aae..db47d7ff 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationToUnloadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationToUnloadFluids.java @@ -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 diff --git a/common/buildcraft/robotics/ai/AIRobotSearchBlock.java b/common/buildcraft/robotics/ai/AIRobotSearchBlock.java index 6c9eed90..61a74b73 100644 --- a/common/buildcraft/robotics/ai/AIRobotSearchBlock.java +++ b/common/buildcraft/robotics/ai/AIRobotSearchBlock.java @@ -23,6 +23,7 @@ public class AIRobotSearchBlock extends AIRobot { private IterableAlgorithmRunner blockScannerJob; private IBlockFilter pathFound; private Iterator 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(); } diff --git a/common/buildcraft/robotics/boards/BoardRobotBomber.java b/common/buildcraft/robotics/boards/BoardRobotBomber.java index 0319ae53..b74aee14 100755 --- a/common/buildcraft/robotics/boards/BoardRobotBomber.java +++ b/common/buildcraft/robotics/boards/BoardRobotBomber.java @@ -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 diff --git a/common/buildcraft/robotics/boards/BoardRobotBuilder.java b/common/buildcraft/robotics/boards/BoardRobotBuilder.java index 64c744d3..bb1ad547 100644 --- a/common/buildcraft/robotics/boards/BoardRobotBuilder.java +++ b/common/buildcraft/robotics/boards/BoardRobotBuilder.java @@ -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 diff --git a/common/buildcraft/robotics/boards/BoardRobotCarrier.java b/common/buildcraft/robotics/boards/BoardRobotCarrier.java index d044d562..191b5ef1 100755 --- a/common/buildcraft/robotics/boards/BoardRobotCarrier.java +++ b/common/buildcraft/robotics/boards/BoardRobotCarrier.java @@ -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)); } } diff --git a/common/buildcraft/robotics/boards/BoardRobotDelivery.java b/common/buildcraft/robotics/boards/BoardRobotDelivery.java index cedc4e9e..204a1569 100755 --- a/common/buildcraft/robotics/boards/BoardRobotDelivery.java +++ b/common/buildcraft/robotics/boards/BoardRobotDelivery.java @@ -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)); } } diff --git a/common/buildcraft/robotics/boards/BoardRobotFluidCarrier.java b/common/buildcraft/robotics/boards/BoardRobotFluidCarrier.java index 443ce044..7753c86e 100755 --- a/common/buildcraft/robotics/boards/BoardRobotFluidCarrier.java +++ b/common/buildcraft/robotics/boards/BoardRobotFluidCarrier.java @@ -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)); } } diff --git a/common/buildcraft/robotics/boards/BoardRobotPicker.java b/common/buildcraft/robotics/boards/BoardRobotPicker.java index 2f186ba3..270f1324 100755 --- a/common/buildcraft/robotics/boards/BoardRobotPicker.java +++ b/common/buildcraft/robotics/boards/BoardRobotPicker.java @@ -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)); } diff --git a/common/buildcraft/robotics/boards/BoardRobotPump.java b/common/buildcraft/robotics/boards/BoardRobotPump.java index 9c4db18a..56cb23fe 100644 --- a/common/buildcraft/robotics/boards/BoardRobotPump.java +++ b/common/buildcraft/robotics/boards/BoardRobotPump.java @@ -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(); diff --git a/common/buildcraft/robotics/boards/BoardRobotStripes.java b/common/buildcraft/robotics/boards/BoardRobotStripes.java index 6950bedb..20806f08 100644 --- a/common/buildcraft/robotics/boards/BoardRobotStripes.java +++ b/common/buildcraft/robotics/boards/BoardRobotStripes.java @@ -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) { diff --git a/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java b/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java index 2a14e778..95da78b3 100755 --- a/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java +++ b/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java @@ -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; } } diff --git a/common/buildcraft/robotics/statements/RobotsActionProvider.java b/common/buildcraft/robotics/statements/RobotsActionProvider.java index 1daf8dcd..642507c9 100755 --- a/common/buildcraft/robotics/statements/RobotsActionProvider.java +++ b/common/buildcraft/robotics/statements/RobotsActionProvider.java @@ -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);