Package megamek.common
Class Engine
java.lang.Object
megamek.common.Engine
- All Implemented Interfaces:
Serializable
,ITechnology
This class represents an engine, such as those driving 'Meks.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface megamek.common.ITechnology
ITechnology.AvailabilityValue, ITechnology.Era, ITechnology.Faction, ITechnology.FactionAffiliation, ITechnology.TechBase, ITechnology.TechRating
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final double[]
boolean
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Fields inherited from interface megamek.common.ITechnology
DATE_ES, DATE_NONE, DATE_PS
-
Constructor Summary
ConstructorsConstructorDescriptionEngine
(int engineRating, int engineType, int engineFlags) The constructor takes the rating of the engine, the type of engine and any flags. -
Method Summary
Modifier and TypeMethodDescriptionint
getBaseChassisHeatSinks
(boolean compact) Return the Base Chassies Engine heat Sinks or integralHeatSinkCapacity which ever is less.int
double
int[]
getCenterTorsoCriticalSlots
(int gyroType) int
int
getCommonDate
(boolean clan) This returns a non-localized name of the engine, it's mostly used to generate files.int
static int
getEngineTypeByString
(String type) Parses a string to find the engine type.static String
getEngineTypeName
(int engineType) int
int
getExtinctionDate
(boolean clan) int
getExtinctionDate
(boolean clan, ITechnology.Faction faction) int
getFlags()
int
int
getIntroductionDate
(boolean clan) int
getIntroductionDate
(boolean clan, ITechnology.Faction faction) int
getJumpHeat
(int movedMP) int
int
getProductionDate
(boolean clan) int
getProductionDate
(boolean clan, ITechnology.Faction faction) int
int
getPrototypeDate
(boolean clan) int
getPrototypeDate
(boolean clan, ITechnology.Faction faction) int
int
int
getReintroductionDate
(boolean clan) int
getReintroductionDate
(boolean clan, ITechnology.Faction faction) int
getRunHeat
(Entity e) Get the name of this engine, this is the localized name used in displays.int[]
int
int
For non-era-based usage, provide a single tech level that does not vary with date.static double
getSVCostMultiplier
(int etype) Values used for calculating the cost of a support vehicle engine.int
getTechType
(int year) int
double
getWeightEngine
(Entity entity) Returns the weight of the engine in tons, rounded to the next highest half ton.double
getWeightEngine
(Entity entity, RoundWeight roundWeight) Returns the weight of the engine, rounded by roundWeight.int
boolean
hasFlag
(int flag) returns true if the engine has the flag set, false otherwiseint
integralHeatSinkCapacity
(boolean compact) Returns the number of heat sinks which can be built into the engine and therefore don't require a critical slot.boolean
isClan()
boolean
boolean
isFusion()
boolean
isICE()
boolean
boolean
boolean
isSolar()
boolean
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
Methods inherited from interface megamek.common.ITechnology
calcEraAvailability, calcEraAvailability, calcYearAvailability, calcYearAvailability, calcYearAvailability, findMinimumRulesLevel, findMinimumRulesLevel, getAdvancedRange, getAdvancedRange, getCodeFromIOAbbr, getCodeFromMMAbbr, getEraAvailabilityName, getEraAvailabilityName, getExperimentalRange, getExperimentalRange, getExtinctionRange, getExtinctionRange, getFullRatingName, getFullRatingName, getSimpleLevel, getSimpleLevel, getSimpleLevel, getStandardRange, getStandardRange, getTechLevel, getTechLevel, getTechRatingName, isAvailableIn, isAvailableIn, isAvailableIn, isExtinct, isExtinct, isExtinct, isLegal, isLegal
-
Field Details
-
ENGINE_RATINGS
public static final double[] ENGINE_RATINGS -
CLAN_ENGINE
public static final int CLAN_ENGINE- See Also:
-
TANK_ENGINE
public static final int TANK_ENGINE- See Also:
-
LARGE_ENGINE
public static final int LARGE_ENGINE- See Also:
-
SUPERHEAVY_ENGINE
public static final int SUPERHEAVY_ENGINE- See Also:
-
SUPPORT_VEE_ENGINE
public static final int SUPPORT_VEE_ENGINE- See Also:
-
COMBUSTION_ENGINE
public static final int COMBUSTION_ENGINE- See Also:
-
NORMAL_ENGINE
public static final int NORMAL_ENGINE- See Also:
-
XL_ENGINE
public static final int XL_ENGINE- See Also:
-
XXL_ENGINE
public static final int XXL_ENGINE- See Also:
-
FUEL_CELL
public static final int FUEL_CELL- See Also:
-
LIGHT_ENGINE
public static final int LIGHT_ENGINE- See Also:
-
COMPACT_ENGINE
public static final int COMPACT_ENGINE- See Also:
-
FISSION
public static final int FISSION- See Also:
-
NONE
public static final int NONE- See Also:
-
MAGLEV
public static final int MAGLEV- See Also:
-
STEAM
public static final int STEAM- See Also:
-
BATTERY
public static final int BATTERY- See Also:
-
SOLAR
public static final int SOLAR- See Also:
-
EXTERNAL
public static final int EXTERNAL- See Also:
-
engineValid
public boolean engineValid -
problem
-
-
Constructor Details
-
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 mek to get they walk MP.- Parameters:
engineRating
- the rating of the engineengineType
- 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 Details
-
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
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 this engine is a fusion engine.
-
isFission
public boolean isFission()- Returns:
- True if this engine is a fission engine.
-
isSolar
public boolean isSolar() -
isICE
public boolean isICE() -
getWeightEngine
Returns the weight of the engine in tons, rounded to the next highest half ton.- Returns:
- the weight of the engine.
-
getWeightEngine
Returns the weight of the engine, rounded by roundWeight.- Parameters:
roundWeight
- One of the rounding factors given inTestEntity
.- Returns:
- the weight of the engine in tons.
-
getWeightFreeEngineHeatSinks
public int getWeightFreeEngineHeatSinks()- Returns:
- the number of heatsinks that fit weight-free into the engine
-
integralHeatSinkCapacity
public int integralHeatSinkCapacity(boolean compact) Returns the number of heat sinks which can be built into the engine and therefore don't require a critical slot.- Parameters:
compact
- Whether this engine uses compact heat sinks or not.- Returns:
- the maximum number of heat sinks built into the engine.
-
getShortEngineName
Get the name of this engine, this is the localized name used in displays. The name of an Engine is based on its type.- Returns:
- the engine name.
-
getEngineTypeName
-
getAllEngineCodeName
-
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
-
getCenterTorsoCriticalSlots
public int[] getCenterTorsoCriticalSlots(int gyroType) - Returns:
- The slots taken up by the engine in the center torso.
-
getSideTorsoCriticalSlots
public int[] getSideTorsoCriticalSlots()- Returns:
- the engine criticals in the side torsos.
-
getStandingHeat
public int getStandingHeat()- Returns:
- the heat generated while the mek is standing still.
-
getWalkHeat
- Returns:
- the heat generated while the mek is walking.
-
getRunHeat
- Returns:
- the heat generated while the mek is running.
-
getSprintHeat
- Returns:
- the heat generated while the mek is sprinting.
-
getJumpHeat
public int getJumpHeat(int movedMP) - Returns:
- the heat generated while the mek is jumping.
-
getBVMultiplier
public double getBVMultiplier() -
getBaseCost
public int getBaseCost() -
getSVCostMultiplier
public static double getSVCostMultiplier(int etype) Values used for calculating the cost of a support vehicle engine. The engine cost in C-bills is tonnage * 5,000 * type multiplier- Parameters:
etype
- The engine type- Returns:
- The type multiplier for cost
-
getTechAdvancement
-
getTechType
public int getTechType(int year) - Parameters:
year
- The game year- Returns:
- the tech type (tech level + tech base) for the current engine.
-
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
- The number to set as base chassis heat sinks
-
getBaseChassisHeatSinks
public int getBaseChassisHeatSinks(boolean compact) Return the Base Chassies Engine heat Sinks or integralHeatSinkCapacity which ever is less.- Parameters:
compact
- Whether this engine uses compact heat sinks or not.- Returns:
- The number of integral heat sinks in the base chassis
-
getFlags
public int getFlags() -
getTechBase
- Specified by:
getTechBase
in interfaceITechnology
-
isClan
public boolean isClan()- Specified by:
isClan
in interfaceITechnology
-
isMixedTech
public boolean isMixedTech()- Specified by:
isMixedTech
in interfaceITechnology
-
isIntroLevel
public boolean isIntroLevel()- Specified by:
isIntroLevel
in interfaceITechnology
-
isUnofficial
public boolean isUnofficial()- Specified by:
isUnofficial
in interfaceITechnology
-
getIntroductionDate
public int getIntroductionDate(boolean clan) - Specified by:
getIntroductionDate
in interfaceITechnology
-
getIntroductionDate
- Specified by:
getIntroductionDate
in interfaceITechnology
-
getIntroductionDate
public int getIntroductionDate()- Specified by:
getIntroductionDate
in interfaceITechnology
-
getPrototypeDate
public int getPrototypeDate(boolean clan) - Specified by:
getPrototypeDate
in interfaceITechnology
-
getPrototypeDate
public int getPrototypeDate()- Specified by:
getPrototypeDate
in interfaceITechnology
-
getPrototypeDate
- Specified by:
getPrototypeDate
in interfaceITechnology
-
getProductionDate
public int getProductionDate(boolean clan) - Specified by:
getProductionDate
in interfaceITechnology
-
getProductionDate
public int getProductionDate()- Specified by:
getProductionDate
in interfaceITechnology
-
getProductionDate
- Specified by:
getProductionDate
in interfaceITechnology
-
getCommonDate
public int getCommonDate(boolean clan) - Specified by:
getCommonDate
in interfaceITechnology
-
getCommonDate
public int getCommonDate()- Specified by:
getCommonDate
in interfaceITechnology
-
getExtinctionDate
public int getExtinctionDate(boolean clan) - Specified by:
getExtinctionDate
in interfaceITechnology
-
getExtinctionDate
public int getExtinctionDate()- Specified by:
getExtinctionDate
in interfaceITechnology
-
getExtinctionDate
- Specified by:
getExtinctionDate
in interfaceITechnology
-
getReintroductionDate
public int getReintroductionDate(boolean clan) - Specified by:
getReintroductionDate
in interfaceITechnology
-
getReintroductionDate
public int getReintroductionDate()- Specified by:
getReintroductionDate
in interfaceITechnology
-
getReintroductionDate
- Specified by:
getReintroductionDate
in interfaceITechnology
-
getTechRating
- Specified by:
getTechRating
in interfaceITechnology
-
getBaseAvailability
- Specified by:
getBaseAvailability
in interfaceITechnology
-
getStaticTechLevel
Description copied from interface:ITechnology
For non-era-based usage, provide a single tech level that does not vary with date.- Specified by:
getStaticTechLevel
in interfaceITechnology
- Returns:
- The base rules level of the equipment or unit.
-