From ee681b19e78a4b74ff4479847a1b2d471fdced2b Mon Sep 17 00:00:00 2001 From: Hea3veN Date: Mon, 16 Feb 2015 15:34:19 -0300 Subject: [PATCH] fix robots not consuming energy and getting free energy when placed --- common/buildcraft/robots/EntityRobot.java | 2 +- common/buildcraft/robots/ai/AIRobotBreak.java | 2 +- common/buildcraft/robots/ai/AIRobotCraftGeneric.java | 5 +++++ common/buildcraft/robots/ai/AIRobotFetchItem.java | 5 +++++ common/buildcraft/robots/ai/AIRobotMain.java | 2 +- common/buildcraft/robots/ai/AIRobotPumpBlock.java | 2 +- common/buildcraft/robots/ai/AIRobotSearchBlock.java | 6 ++++++ common/buildcraft/robots/ai/AIRobotSearchEntity.java | 5 +++++ .../robots/ai/AIRobotSearchRandomGroundBlock.java | 5 +++++ common/buildcraft/robots/ai/AIRobotUseToolOnBlock.java | 2 +- common/buildcraft/transport/BlockGenericPipe.java | 1 - 11 files changed, 31 insertions(+), 6 deletions(-) diff --git a/common/buildcraft/robots/EntityRobot.java b/common/buildcraft/robots/EntityRobot.java index a8411579..30d3f7bb 100644 --- a/common/buildcraft/robots/EntityRobot.java +++ b/common/buildcraft/robots/EntityRobot.java @@ -116,7 +116,7 @@ public class EntityRobot extends EntityRobotBase implements private NBTTagList stackRequestNBT; - private RFBattery battery = new RFBattery(MAX_ENERGY, MAX_ENERGY, 0); + private RFBattery battery = new RFBattery(MAX_ENERGY, MAX_ENERGY, 100); private boolean firstUpdateDone = false; diff --git a/common/buildcraft/robots/ai/AIRobotBreak.java b/common/buildcraft/robots/ai/AIRobotBreak.java index 06966aa2..c6e08c9b 100644 --- a/common/buildcraft/robots/ai/AIRobotBreak.java +++ b/common/buildcraft/robots/ai/AIRobotBreak.java @@ -129,7 +129,7 @@ public class AIRobotBreak extends AIRobot { @Override public int getEnergyCost() { - return 20; + return 30; } @Override diff --git a/common/buildcraft/robots/ai/AIRobotCraftGeneric.java b/common/buildcraft/robots/ai/AIRobotCraftGeneric.java index 11cf82d8..6bd37de3 100755 --- a/common/buildcraft/robots/ai/AIRobotCraftGeneric.java +++ b/common/buildcraft/robots/ai/AIRobotCraftGeneric.java @@ -33,4 +33,9 @@ public abstract class AIRobotCraftGeneric extends AIRobot { return crafted; } + @Override + public int getEnergyCost() { + return 10; + } + } diff --git a/common/buildcraft/robots/ai/AIRobotFetchItem.java b/common/buildcraft/robots/ai/AIRobotFetchItem.java index 6cf9f6e2..e7c3d153 100755 --- a/common/buildcraft/robots/ai/AIRobotFetchItem.java +++ b/common/buildcraft/robots/ai/AIRobotFetchItem.java @@ -155,4 +155,9 @@ public class AIRobotFetchItem extends AIRobot { terminate(); } } + + @Override + public int getEnergyCost() { + return 20; + } } diff --git a/common/buildcraft/robots/ai/AIRobotMain.java b/common/buildcraft/robots/ai/AIRobotMain.java index 4ab9b27d..018e428a 100755 --- a/common/buildcraft/robots/ai/AIRobotMain.java +++ b/common/buildcraft/robots/ai/AIRobotMain.java @@ -22,7 +22,7 @@ public class AIRobotMain extends AIRobot { @Override public void preempt(AIRobot ai) { if (!(ai instanceof AIRobotRecharge)) { - if (robot.getEnergy() < EntityRobotBase.MAX_ENERGY / 4.0) { + if (robot.getEnergy() < EntityRobotBase.SAFETY_ENERGY) { startDelegateAI(new AIRobotRecharge(robot)); } else if (overridingAI != null && ai != overridingAI) { startDelegateAI(overridingAI); diff --git a/common/buildcraft/robots/ai/AIRobotPumpBlock.java b/common/buildcraft/robots/ai/AIRobotPumpBlock.java index 7c541ac9..79f0b442 100644 --- a/common/buildcraft/robots/ai/AIRobotPumpBlock.java +++ b/common/buildcraft/robots/ai/AIRobotPumpBlock.java @@ -68,7 +68,7 @@ public class AIRobotPumpBlock extends AIRobot { @Override public int getEnergyCost() { - return 20; + return 30; } @Override diff --git a/common/buildcraft/robots/ai/AIRobotSearchBlock.java b/common/buildcraft/robots/ai/AIRobotSearchBlock.java index 2a5c67cc..70a78036 100755 --- a/common/buildcraft/robots/ai/AIRobotSearchBlock.java +++ b/common/buildcraft/robots/ai/AIRobotSearchBlock.java @@ -96,4 +96,10 @@ public class AIRobotSearchBlock extends AIRobot { public void unreserve() { blockScanner.unreserve(blockFound); } + + @Override + public int getEnergyCost() { + return 2; + } + } diff --git a/common/buildcraft/robots/ai/AIRobotSearchEntity.java b/common/buildcraft/robots/ai/AIRobotSearchEntity.java index 9672e0c4..dc8c36ad 100755 --- a/common/buildcraft/robots/ai/AIRobotSearchEntity.java +++ b/common/buildcraft/robots/ai/AIRobotSearchEntity.java @@ -73,4 +73,9 @@ public class AIRobotSearchEntity extends AIRobot { terminate(); } + + @Override + public int getEnergyCost() { + return 2; + } } diff --git a/common/buildcraft/robots/ai/AIRobotSearchRandomGroundBlock.java b/common/buildcraft/robots/ai/AIRobotSearchRandomGroundBlock.java index 7e3dfb72..fa1c461d 100755 --- a/common/buildcraft/robots/ai/AIRobotSearchRandomGroundBlock.java +++ b/common/buildcraft/robots/ai/AIRobotSearchRandomGroundBlock.java @@ -75,4 +75,9 @@ public class AIRobotSearchRandomGroundBlock extends AIRobot { } } } + + @Override + public int getEnergyCost() { + return 2; + } } diff --git a/common/buildcraft/robots/ai/AIRobotUseToolOnBlock.java b/common/buildcraft/robots/ai/AIRobotUseToolOnBlock.java index 6fae02ab..eb6bfba3 100755 --- a/common/buildcraft/robots/ai/AIRobotUseToolOnBlock.java +++ b/common/buildcraft/robots/ai/AIRobotUseToolOnBlock.java @@ -70,6 +70,6 @@ public class AIRobotUseToolOnBlock extends AIRobot { @Override public int getEnergyCost() { - return 20; + return 30; } } diff --git a/common/buildcraft/transport/BlockGenericPipe.java b/common/buildcraft/transport/BlockGenericPipe.java index 71edeb7b..98406ce5 100644 --- a/common/buildcraft/transport/BlockGenericPipe.java +++ b/common/buildcraft/transport/BlockGenericPipe.java @@ -670,7 +670,6 @@ public class BlockGenericPipe extends BlockBuildCraft { if (robot != null && robot.getRegistry() != null) { robot.setUniqueRobotId(robot.getRegistry().getNextRobotId()); - robot.getBattery().setEnergy(EntityRobotBase.MAX_ENERGY); float px = x + 0.5F + rayTraceResult.sideHit.offsetX * 0.5F; float py = y + 0.5F + rayTraceResult.sideHit.offsetY * 0.5F;