fix robots not consuming energy and getting free energy when placed

This commit is contained in:
Hea3veN 2015-02-16 15:34:19 -03:00
parent a92af4664a
commit ee681b19e7
11 changed files with 31 additions and 6 deletions

View file

@ -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;

View file

@ -129,7 +129,7 @@ public class AIRobotBreak extends AIRobot {
@Override
public int getEnergyCost() {
return 20;
return 30;
}
@Override

View file

@ -33,4 +33,9 @@ public abstract class AIRobotCraftGeneric extends AIRobot {
return crafted;
}
@Override
public int getEnergyCost() {
return 10;
}
}

View file

@ -155,4 +155,9 @@ public class AIRobotFetchItem extends AIRobot {
terminate();
}
}
@Override
public int getEnergyCost() {
return 20;
}
}

View file

@ -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);

View file

@ -68,7 +68,7 @@ public class AIRobotPumpBlock extends AIRobot {
@Override
public int getEnergyCost() {
return 20;
return 30;
}
@Override

View file

@ -96,4 +96,10 @@ public class AIRobotSearchBlock extends AIRobot {
public void unreserve() {
blockScanner.unreserve(blockFound);
}
@Override
public int getEnergyCost() {
return 2;
}
}

View file

@ -73,4 +73,9 @@ public class AIRobotSearchEntity extends AIRobot {
terminate();
}
@Override
public int getEnergyCost() {
return 2;
}
}

View file

@ -75,4 +75,9 @@ public class AIRobotSearchRandomGroundBlock extends AIRobot {
}
}
}
@Override
public int getEnergyCost() {
return 2;
}
}

View file

@ -70,6 +70,6 @@ public class AIRobotUseToolOnBlock extends AIRobot {
@Override
public int getEnergyCost() {
return 20;
return 30;
}
}

View file

@ -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;