Merge pull request #2 from drpepper240/patch-3
will prevent messing with ship's dimensions
This commit is contained in:
commit
74cf689542
3 changed files with 32 additions and 17 deletions
|
@ -479,7 +479,13 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral
|
||||||
case 0: // dim_getp ()
|
case 0: // dim_getp ()
|
||||||
return new Integer[] { getFront(), getRight(), getUp() };
|
return new Integer[] { getFront(), getRight(), getUp() };
|
||||||
case 1: // dim_setp (front, right, up)
|
case 1: // dim_setp (front, right, up)
|
||||||
if (arguments.length != 3 || (((Double)arguments[0]).intValue() < 0 || ((Double)arguments[1]).intValue() < 0 || ((Double)arguments[2]).intValue() < 0))
|
if ( arguments.length != 3 ||
|
||||||
|
( ( (Double)arguments[0] ).intValue() < 0 ||
|
||||||
|
( (Double)arguments[1] ).intValue() < 0 ||
|
||||||
|
( (Double)arguments[2] ).intValue() < 0 ||
|
||||||
|
( (Double)arguments[1] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ||
|
||||||
|
( (Double)arguments[2] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ||
|
||||||
|
( (Double)arguments[3] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ) )
|
||||||
{
|
{
|
||||||
return new Integer[] { -1 };
|
return new Integer[] { -1 };
|
||||||
}
|
}
|
||||||
|
@ -494,7 +500,13 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral
|
||||||
case 2: // dim_getn ()
|
case 2: // dim_getn ()
|
||||||
return new Integer[] { getBack(), getLeft(), getDown() };
|
return new Integer[] { getBack(), getLeft(), getDown() };
|
||||||
case 3: // dim_setn (back, left, down)
|
case 3: // dim_setn (back, left, down)
|
||||||
if (arguments.length != 3 || (((Double)arguments[0]).intValue() < 0 || ((Double)arguments[1]).intValue() < 0 || ((Double)arguments[2]).intValue() < 0))
|
if ( arguments.length != 3 ||
|
||||||
|
( ( (Double)arguments[0] ).intValue() < 0 ||
|
||||||
|
( (Double)arguments[1] ).intValue() < 0 ||
|
||||||
|
( (Double)arguments[2] ).intValue() < 0 ||
|
||||||
|
( (Double)arguments[1] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ||
|
||||||
|
( (Double)arguments[2] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ||
|
||||||
|
( (Double)arguments[3] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ) )
|
||||||
{
|
{
|
||||||
return new Integer[] { -1 };
|
return new Integer[] { -1 };
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,8 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
||||||
public int shipLeft, shipRight;
|
public int shipLeft, shipRight;
|
||||||
public int shipUp, shipDown;
|
public int shipUp, shipDown;
|
||||||
public int shipHeight, shipWidth, shipLength;
|
public int shipHeight, shipWidth, shipLength;
|
||||||
int shipSize = 0;
|
int shipSize = 0; //ship length in the direction of a jump
|
||||||
int shipVolume;
|
int shipVolume = 0; //number of all blocks the ship consists of
|
||||||
int currentMode = 0;
|
int currentMode = 0;
|
||||||
|
|
||||||
int currentEnergyValue = 0;
|
int currentEnergyValue = 0;
|
||||||
|
@ -67,7 +67,6 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
||||||
private final byte MODE_GATE_JUMP = 6; // Jump via jumpgate
|
private final byte MODE_GATE_JUMP = 6; // Jump via jumpgate
|
||||||
|
|
||||||
int cooldownTime = 0;
|
int cooldownTime = 0;
|
||||||
public int randomCooldownAddition = 0;
|
|
||||||
|
|
||||||
private int registryUpdateTicks = 0;
|
private int registryUpdateTicks = 0;
|
||||||
public String coreFrequency = "default";
|
public String coreFrequency = "default";
|
||||||
|
@ -188,7 +187,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
||||||
}
|
}
|
||||||
|
|
||||||
// Awaiting cooldown time
|
// Awaiting cooldown time
|
||||||
if (/*currentMode != MODE_BASIC_JUMP && */cooldownTime++ < ((WarpDriveConfig.i.WC_COOLDOWN_INTERVAL_SECONDS) * 20) + randomCooldownAddition)
|
if (/*currentMode != MODE_BASIC_JUMP && */cooldownTime++ < ((WarpDriveConfig.i.WC_COOLDOWN_INTERVAL_SECONDS) * 20) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -454,28 +453,32 @@ System.out.println("ZLO7");
|
||||||
minY = yCoord - shipDown;
|
minY = yCoord - shipDown;
|
||||||
maxY = yCoord + shipUp;
|
maxY = yCoord + shipUp;
|
||||||
this.shipSize = 0;
|
this.shipSize = 0;
|
||||||
|
|
||||||
|
int sizeFrontBack = shipFront + shipBack;
|
||||||
|
int sizeRightLeft = shipRight + shipLeft;
|
||||||
|
int sizeUpDown = shipUp + shipDown;
|
||||||
|
|
||||||
switch (this.direction)
|
switch (this.direction)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
case 180:
|
case 180:
|
||||||
this.shipSize = this.shipBack + this.shipFront;
|
this.shipSize = sizeFrontBack;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 90:
|
case 90:
|
||||||
case 270:
|
case 270:
|
||||||
this.shipSize = this.shipLeft + shipRight;
|
this.shipSize = sizeRightLeft;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
case -2:
|
case -2:
|
||||||
this.shipSize = this.shipDown + this.shipUp;
|
this.shipSize = sizeUpDown;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Ship size is too big
|
||||||
// Ship side is too big
|
if (sizeFrontBack > WarpDriveConfig.i.WC_MAX_SHIP_SIDE || sizeRightLeft > WarpDriveConfig.i.WC_MAX_SHIP_SIDE || sizeUpDown > WarpDriveConfig.i.WC_MAX_SHIP_SIDE)
|
||||||
if (shipLength > WarpDriveConfig.i.WC_MAX_SHIP_SIDE || shipWidth > WarpDriveConfig.i.WC_MAX_SHIP_SIDE || shipHeight > WarpDriveConfig.i.WC_MAX_SHIP_SIDE)
|
|
||||||
{
|
{
|
||||||
|
messageToAllPlayersOnShip("Ship is too long. Cannot jump.");
|
||||||
this.controller.setJumpFlag(false);
|
this.controller.setJumpFlag(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,9 @@ public class WarpDriveConfig
|
||||||
public int WC_ENERGY_PER_DISTANCE_MODE2 = 1000; // eU
|
public int WC_ENERGY_PER_DISTANCE_MODE2 = 1000; // eU
|
||||||
public int WC_ENERGY_PER_ENTITY_TO_SPACE = 1000000; // eU
|
public int WC_ENERGY_PER_ENTITY_TO_SPACE = 1000000; // eU
|
||||||
public int WC_MAX_JUMP_DISTANCE = 128; // Maximum jump length value
|
public int WC_MAX_JUMP_DISTANCE = 128; // Maximum jump length value
|
||||||
public int WC_MAX_SHIP_VOLUME_ON_SURFACE = 15000; // Maximum ship mass to jump on earth (15k blocks)
|
public int WC_MAX_SHIP_VOLUME_ON_SURFACE = 15000; // Maximum ship volume to jump on earth
|
||||||
public int WC_MIN_SHIP_VOLUME_FOR_HYPERSPACE = 500; // Minimum ship volume value for
|
public int WC_MIN_SHIP_VOLUME_FOR_HYPERSPACE = 500; // Minimum ship volume value for hyperspace travel
|
||||||
public int WC_MAX_SHIP_SIDE = 100;
|
public int WC_MAX_SHIP_SIDE = 199; //miaximum ship length - 1
|
||||||
public int WC_COOLDOWN_INTERVAL_SECONDS = 4;
|
public int WC_COOLDOWN_INTERVAL_SECONDS = 4;
|
||||||
public int WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS = 10;
|
public int WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS = 10;
|
||||||
public int WC_ISOLATION_UPDATE_INTARVAL_SECONDS = 10;
|
public int WC_ISOLATION_UPDATE_INTARVAL_SECONDS = 10;
|
||||||
|
|
Loading…
Reference in a new issue