Fix Oil Drill logic; rebalance EU cost
This commit is contained in:
parent
73662e531f
commit
0802fdbd02
3 changed files with 56 additions and 51 deletions
|
@ -53,18 +53,9 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi
|
|||
protected void setElectricityStats() {
|
||||
this.mEfficiency = getCurrentEfficiency(null);
|
||||
this.mEfficiencyIncrease = 10000;
|
||||
//T1 = 48; T2 = 192; T3 = 768; T4 = 3072
|
||||
this.mEUt = 12 * (1 << (getMinTier() << 1));
|
||||
this.mMaxProgresstime = (isPickingPipes ? 240: 80) / (1 << getMinTier());
|
||||
|
||||
long voltage = getMaxInputVoltage();
|
||||
long overclockEu = V[Math.max(1, GT_Utility.getTier(voltage)) - 1];
|
||||
while (this.mEUt <= overclockEu) {
|
||||
this.mEUt *= 4;
|
||||
this.mMaxProgresstime /= 2;
|
||||
}
|
||||
|
||||
this.mEUt = -this.mEUt;
|
||||
int tier = Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
|
||||
this.mEUt = -6 * (1 << (tier << 1));
|
||||
this.mMaxProgresstime = (workState == STATE_UPWARD ? 240 : 80) / (1 << tier);
|
||||
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
|
||||
}
|
||||
|
||||
|
@ -94,7 +85,7 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi
|
|||
mLastZOff = 0;
|
||||
return true;
|
||||
} else {
|
||||
isPickingPipes = false;
|
||||
workState = STATE_DOWNWARD;
|
||||
stopMachine();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,8 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
|
|||
private ForgeDirection back;
|
||||
|
||||
private int xDrill, yDrill, zDrill, xPipe, zPipe, yHead;
|
||||
protected boolean isPickingPipes;
|
||||
protected int workState;
|
||||
protected static final int STATE_DOWNWARD = 0, STATE_AT_BOTTOM = 1, STATE_UPWARD = 2;
|
||||
|
||||
public GT_MetaTileEntity_DrillerBase(int aID, String aName, String aNameRegional) {
|
||||
super(aID, aName, aNameRegional);
|
||||
|
@ -57,7 +58,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
|
|||
int frameId = 4096 + getFrameMaterial().mMetaItemSubID;
|
||||
frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W;
|
||||
casingTextureIndex = getCasingTextureIndex();
|
||||
isPickingPipes = false;
|
||||
workState = STATE_DOWNWARD;
|
||||
}
|
||||
|
||||
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
|
||||
|
@ -69,13 +70,14 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
|
|||
@Override
|
||||
public void saveNBTData(NBTTagCompound aNBT) {
|
||||
super.saveNBTData(aNBT);
|
||||
aNBT.setBoolean("isPickingPipe", isPickingPipes);
|
||||
aNBT.setInteger("workState", workState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadNBTData(NBTTagCompound aNBT) {
|
||||
super.loadNBTData(aNBT);
|
||||
isPickingPipes = aNBT.getBoolean("isPickingPipes");
|
||||
workState = aNBT.getInteger("workState");
|
||||
if (aNBT.hasKey("isPickingPipes")) workState = aNBT.getBoolean("isPickingPipes") ? STATE_UPWARD : STATE_DOWNWARD;
|
||||
}
|
||||
|
||||
protected boolean tryPickPipe() {
|
||||
|
@ -90,15 +92,21 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
|
|||
}
|
||||
|
||||
protected boolean tryLowerPipe() {
|
||||
return tryLowerPipe(false);
|
||||
}
|
||||
|
||||
protected boolean tryLowerPipe(boolean isSimulating) {
|
||||
if (!isHasMiningPipes()) return false;
|
||||
|
||||
if (yHead <= 0) return false;
|
||||
if (!canLowerPipe()) return false;
|
||||
|
||||
if (!isSimulating) {
|
||||
getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead - 1, zPipe, miningPipeTipBlock);
|
||||
if (yHead != yDrill) getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead, zPipe, miningPipeBlock);
|
||||
|
||||
getBaseMetaTileEntity().decrStackSize(1, 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -154,10 +162,19 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
|
|||
return false;
|
||||
}
|
||||
|
||||
protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead){
|
||||
if(!tryLowerPipe())
|
||||
protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
|
||||
if(!tryLowerPipe()) {
|
||||
if(waitForPipes()) return false;
|
||||
isPickingPipes = true;
|
||||
workState = STATE_AT_BOTTOM;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
|
||||
if(tryLowerPipe(true))
|
||||
workState = STATE_DOWNWARD;
|
||||
else
|
||||
workState = STATE_UPWARD;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -165,7 +182,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
|
|||
if (tryPickPipe()) {
|
||||
return true;
|
||||
} else {
|
||||
isPickingPipes = false;
|
||||
workState = STATE_DOWNWARD;
|
||||
stopMachine();
|
||||
return false;
|
||||
}
|
||||
|
@ -181,10 +198,16 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
|
|||
return false;
|
||||
}
|
||||
putMiningPipesFromInputsInController();
|
||||
if (!isPickingPipes)
|
||||
switch (workState) {
|
||||
case STATE_DOWNWARD:
|
||||
return workingDownward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead);
|
||||
else
|
||||
case STATE_AT_BOTTOM:
|
||||
return workingAtBottom(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead);
|
||||
case STATE_UPWARD:
|
||||
return workingUpward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -78,26 +78,19 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
|
|||
protected void setElectricityStats() {
|
||||
this.mEfficiency = getCurrentEfficiency(null);
|
||||
this.mEfficiencyIncrease = 10000;
|
||||
//T1 = 24; T2 = 96; T3 = 384
|
||||
this.mEUt = 6 * (1 << (getMinTier() << 1));
|
||||
//160 per chunk in MV
|
||||
this.mMaxProgresstime = (isPickingPipes ? 80 : 640 * getRangeInChunks() * getRangeInChunks()) / (1 << getMinTier());
|
||||
|
||||
long voltage = getMaxInputVoltage();
|
||||
long overclockEu = V[Math.max(1, GT_Utility.getTier(voltage)) - 1];
|
||||
while (this.mEUt <= overclockEu) {
|
||||
this.mEUt *= 4;
|
||||
this.mMaxProgresstime /= 2;
|
||||
}
|
||||
|
||||
this.mEUt = -this.mEUt;
|
||||
int tier = Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
|
||||
this.mEUt = -3 * (1 << (tier << 1));
|
||||
this.mMaxProgresstime = (workState == STATE_AT_BOTTOM ? 320 * getRangeInChunks() * getRangeInChunks() : 80) / (1 << tier);
|
||||
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead){
|
||||
if (!tryLowerPipe()){
|
||||
if (waitForPipes()) return false;
|
||||
protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
|
||||
if(tryLowerPipe(true)) {
|
||||
workState = STATE_DOWNWARD;
|
||||
setElectricityStats();
|
||||
}
|
||||
else {
|
||||
if (tryFillChunkList()) {
|
||||
float speed = .5F+(GT_Utility.getTier(getMaxInputVoltage()) - getMinTier()) *.25F;
|
||||
FluidStack tFluid = pumpOil(speed);
|
||||
|
@ -106,8 +99,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
|
|||
return true;
|
||||
}
|
||||
}
|
||||
isPickingPipes = true;
|
||||
return true;
|
||||
workState = STATE_UPWARD;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -124,11 +116,10 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
|
|||
if (mOilFieldChunks.isEmpty()) {
|
||||
Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
|
||||
int range = getRangeInChunks();
|
||||
int xChunk = (tChunk.xPosition / range) * range, zChunk = (tChunk.zPosition / range) * range;
|
||||
int xDir = tChunk.xPosition < 0 ? -1 : 1, zDir = tChunk.zPosition < 0 ? -1 : 1;
|
||||
int xChunk = (tChunk.xPosition / range) * range - (tChunk.xPosition < 0 ? range : 0), zChunk = (tChunk.zPosition / range) * range - (tChunk.zPosition < 0 ? range : 0);
|
||||
for (int i = 0; i < range; i++) {
|
||||
for (int j = 0; j < range; j++) {
|
||||
tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i * xDir, zChunk + j * zDir);
|
||||
tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i, zChunk + j);
|
||||
tFluid = undergroundOilReadInformation(tChunk);
|
||||
if (tOil.isFluidEqual(tFluid))
|
||||
mOilFieldChunks.add(tChunk);
|
||||
|
|
Loading…
Reference in a new issue