megamek.common
Class Engine

java.lang.Object
  extended by megamek.common.Engine
All Implemented Interfaces:
java.io.Serializable

public class Engine
extends java.lang.Object
implements java.io.Serializable

This class represents an engine, such as those driving mechs.

See Also:
Serialized Form

Field Summary
static int CLAN_ENGINE
           
static int COMBUSTION_ENGINE
           
static int COMPACT_ENGINE
           
static float[] ENGINE_RATINGS
           
 boolean engineValid
           
static int FISSION
           
static int FUEL_CELL
           
static int LARGE_ENGINE
           
static int LIGHT_ENGINE
           
static int NORMAL_ENGINE
           
 java.lang.StringBuffer problem
           
static int TANK_ENGINE
           
static int XL_ENGINE
           
static int XXL_ENGINE
           
 
Constructor Summary
Engine(int engineRating, int engineType, int engineFlags)
          The constructor takes the rating of the engine, the type of engine and any flags.
 
Method Summary
 int getBaseChassisHeatSinks()
          Return the Base Chassies Engine heat Sinks or intergalHeatSinkCapacity which ever is less.
 int getBaseCost()
           
 double getBVMultiplier()
           
 int[] getCenterTorsoCriticalSlots(int gyroType)
          returns the slots taken up by the engine in the center torso.
 java.lang.String getEngineName()
          This returns a non-localized name of the engine, it's mostly used to generate files.
 int getEngineType()
           
static int getEngineTypeByString(java.lang.String type)
          Parses a string to find the engine type.
 int getJumpHeat(int movedMP)
           
 int getRating()
          Returns the rating of the engine.
 int getRunHeat()
           
 java.lang.String getShortEngineName()
          Get the name of this engine, this is the localized name used in displays.
 int[] getSideTorsoCriticalSlots()
          Returns the engine criticals in the side torsos.
 int getSprintHeat()
           
 int getStandingHeat()
          Return the heat generated while the mech is standing still.
 int getTechType()
           
 int getWalkHeat()
           
 float getWeightEngine(Entity entity)
          Returns the weight of the engine in tons, rounded to the next highest half ton.
 float getWeightEngine(Entity entity, float roundWeight)
          Returns the weight of the engine, rounded by roundWeight.
 int getWeightFreeEngineHeatSinks()
          return the number of heatsinks that fit weight-free into the engine
 boolean hasFlag(int flag)
          returns true if the engine has the flag set, false otherwise
 int integralHeatSinkCapacity()
          Returns the number of heat sinks which can be built into the engine and therefore don't require a critical slot.
 boolean isFusion()
          returns true if and only if this engine is a fusion engine
 void setBaseChassisHeatSinks(int amount)
          For omnis set the base Chassies HS any variants will only use this and the reset will have to be added.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENGINE_RATINGS

public static final float[] ENGINE_RATINGS

CLAN_ENGINE

public static final int CLAN_ENGINE
See Also:
Constant Field Values

TANK_ENGINE

public static final int TANK_ENGINE
See Also:
Constant Field Values

LARGE_ENGINE

public static final int LARGE_ENGINE
See Also:
Constant Field Values

COMBUSTION_ENGINE

public static final int COMBUSTION_ENGINE
See Also:
Constant Field Values

NORMAL_ENGINE

public static final int NORMAL_ENGINE
See Also:
Constant Field Values

XL_ENGINE

public static final int XL_ENGINE
See Also:
Constant Field Values

XXL_ENGINE

public static final int XXL_ENGINE
See Also:
Constant Field Values

FUEL_CELL

public static final int FUEL_CELL
See Also:
Constant Field Values

LIGHT_ENGINE

public static final int LIGHT_ENGINE
See Also:
Constant Field Values

COMPACT_ENGINE

public static final int COMPACT_ENGINE
See Also:
Constant Field Values

FISSION

public static final int FISSION
See Also:
Constant Field Values

engineValid

public boolean engineValid

problem

public java.lang.StringBuffer problem
Constructor Detail

Engine

public Engine(int engineRating,
              int engineType,
              int engineFlags)
The constructor takes the rating of the engine, the type of engine and any flags. Engine ratings are divided by the weight of the mech to get they walk MP.

Parameters:
engineRating - the rating of the engine
engineType - the type of the engine, either combustion or a type of fusion engine.
engineFlags - Wether the engine is a tank engine, a clan engine, or large engine, or any combination of those.
Method Detail

hasFlag

public boolean hasFlag(int flag)
returns true if the engine has the flag set, false otherwise

Parameters:
flag - the flag to check for.
Returns:
true if the flag is set.

getEngineTypeByString

public static int getEngineTypeByString(java.lang.String type)
Parses a string to find the engine type.

Parameters:
type - the string to parse
Returns:
the type of the engine.

isFusion

public boolean isFusion()
returns true if and only if this engine is a fusion engine

Returns:
true if it is not an internal combustion engine.

getWeightEngine

public float getWeightEngine(Entity entity)
Returns the weight of the engine in tons, rounded to the next highest half ton.

Returns:
the weight of the engine.

getWeightEngine

public float getWeightEngine(Entity entity,
                             float roundWeight)
Returns the weight of the engine, rounded by roundWeight.

Parameters:
roundWeight - One of the rounding factors given in TestEntity.
Returns:
the weight of the engine in tons.

getWeightFreeEngineHeatSinks

public int getWeightFreeEngineHeatSinks()
return the number of heatsinks that fit weight-free into the engine

Returns:

integralHeatSinkCapacity

public int integralHeatSinkCapacity()
Returns the number of heat sinks which can be built into the engine and therefore don't require a critical slot.

Returns:
the maximum number of heat sinks built into the engine.

getShortEngineName

public java.lang.String getShortEngineName()
Get the name of this engine, this is the localized name used in displays. The name of an Engine is based on it's type.

Returns:
the engine name.

getEngineName

public java.lang.String getEngineName()
This returns a non-localized name of the engine, it's mostly used to generate files.


getRating

public int getRating()
Returns the rating of the engine.

Returns:

getCenterTorsoCriticalSlots

public int[] getCenterTorsoCriticalSlots(int gyroType)
returns the slots taken up by the engine in the center torso.

Returns:

getSideTorsoCriticalSlots

public int[] getSideTorsoCriticalSlots()
Returns the engine criticals in the side torsos.

Returns:

getStandingHeat

public int getStandingHeat()
Return the heat generated while the mech is standing still.

Returns:

getWalkHeat

public int getWalkHeat()

getRunHeat

public int getRunHeat()

getSprintHeat

public int getSprintHeat()

getJumpHeat

public int getJumpHeat(int movedMP)

getBVMultiplier

public double getBVMultiplier()

getBaseCost

public int getBaseCost()

getTechType

public int getTechType()

getEngineType

public int getEngineType()

setBaseChassisHeatSinks

public void setBaseChassisHeatSinks(int amount)
For omnis set the base Chassies HS any variants will only use this and the reset will have to be added.

Parameters:
amount -

getBaseChassisHeatSinks

public int getBaseChassisHeatSinks()
Return the Base Chassies Engine heat Sinks or intergalHeatSinkCapacity which ever is less.

Returns: