Package megamek.common.equipment
Class Engine
java.lang.Object
megamek.common.equipment.Engine
- All Implemented Interfaces:
Serializable,ITechnology
This class represents an engine, such as those driving 'Meks.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final double[]booleanstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from interface megamek.common.interfaces.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 TypeMethodDescriptiongetBaseAvailability(Era era) intgetBaseChassisHeatSinks(boolean compact) Return the Base Chassis Engine heat Sinks or integralHeatSinkCapacity which ever is less.intdoubleint[]getCenterTorsoCriticalSlots(int gyroType) intintgetCommonDate(boolean clan) This returns a non-localized name of the engine, it's mostly used to generate files.intstatic intgetEngineTypeByString(String type) Parses a string to find the engine type.static StringgetEngineTypeName(int engineType) intintgetExtinctionDate(boolean clan) intgetExtinctionDate(boolean clan, Faction faction) intgetFlags()intintgetIntroductionDate(boolean clan) intgetIntroductionDate(boolean clan, Faction faction) intgetJumpHeat(int movedMP) intintgetProductionDate(boolean clan) intgetProductionDate(boolean clan, Faction faction) intintgetPrototypeDate(boolean clan) intgetPrototypeDate(boolean clan, Faction faction) intintintgetReintroductionDate(boolean clan) intgetReintroductionDate(boolean clan, Faction faction) intgetRunHeat(Entity entity) Get the name of this engine, this is the localized name used in displays.int[]intgetSprintHeat(Entity entity) intgetStandingHeat(Entity entity) For non-era-based usage, provide a single tech level that does not vary with date.static doublegetSVCostMultiplier(int etype) Values used for calculating the cost of a support vehicle engine.intgetTechType(int year) intgetWalkHeat(Entity entity) doublegetWeightEngine(Entity entity) Returns the weight of the engine in tons, rounded to the next highest half ton.doublegetWeightEngine(Entity entity, RoundWeight roundWeight) Returns the weight of the engine, rounded by roundWeight.intbooleanhasFlag(int flag) returns true if the engine has the flag set, false otherwiseintintegralHeatSinkCapacity(boolean compact) Returns the number of heat sinks which can be built into the engine and therefore don't require a critical slot.booleanisClan()booleanbooleanisFusion()booleanisICE()booleanbooleanbooleanisSolar()booleanvoidsetBaseChassisHeatSinks(int amount) For OmniMeks set the base Chassis 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, waitMethods inherited from interface megamek.common.interfaces.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- Weather 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 heat sinks 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 critical slots in the side torsos.
-
getStandingHeat
- Returns:
- the heat generated while the mek is standing still.
-
getWalkHeat
- Returns:
- the heat generated while the mek is walking. Only Meks generate movement heat.
-
getRunHeat
- Returns:
- the heat generated while the mek is running. Only Meks generate movement heat.
-
getSprintHeat
- Returns:
- the heat generated while the mek is sprinting. Only Meks generate movement heat.
-
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 OmniMeks set the base Chassis 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 Chassis 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:
getTechBasein interfaceITechnology
-
isClan
public boolean isClan()- Specified by:
isClanin interfaceITechnology
-
isMixedTech
public boolean isMixedTech()- Specified by:
isMixedTechin interfaceITechnology
-
isIntroLevel
public boolean isIntroLevel()- Specified by:
isIntroLevelin interfaceITechnology
-
isUnofficial
public boolean isUnofficial()- Specified by:
isUnofficialin interfaceITechnology
-
getIntroductionDate
public int getIntroductionDate(boolean clan) - Specified by:
getIntroductionDatein interfaceITechnology
-
getIntroductionDate
- Specified by:
getIntroductionDatein interfaceITechnology
-
getIntroductionDate
public int getIntroductionDate()- Specified by:
getIntroductionDatein interfaceITechnology
-
getPrototypeDate
public int getPrototypeDate(boolean clan) - Specified by:
getPrototypeDatein interfaceITechnology
-
getPrototypeDate
public int getPrototypeDate()- Specified by:
getPrototypeDatein interfaceITechnology
-
getPrototypeDate
- Specified by:
getPrototypeDatein interfaceITechnology
-
getProductionDate
public int getProductionDate(boolean clan) - Specified by:
getProductionDatein interfaceITechnology
-
getProductionDate
public int getProductionDate()- Specified by:
getProductionDatein interfaceITechnology
-
getProductionDate
- Specified by:
getProductionDatein interfaceITechnology
-
getCommonDate
public int getCommonDate(boolean clan) - Specified by:
getCommonDatein interfaceITechnology
-
getCommonDate
public int getCommonDate()- Specified by:
getCommonDatein interfaceITechnology
-
getExtinctionDate
public int getExtinctionDate(boolean clan) - Specified by:
getExtinctionDatein interfaceITechnology
-
getExtinctionDate
public int getExtinctionDate()- Specified by:
getExtinctionDatein interfaceITechnology
-
getExtinctionDate
- Specified by:
getExtinctionDatein interfaceITechnology
-
getReintroductionDate
public int getReintroductionDate(boolean clan) - Specified by:
getReintroductionDatein interfaceITechnology
-
getReintroductionDate
public int getReintroductionDate()- Specified by:
getReintroductionDatein interfaceITechnology
-
getReintroductionDate
- Specified by:
getReintroductionDatein interfaceITechnology
-
getTechRating
- Specified by:
getTechRatingin interfaceITechnology
-
getBaseAvailability
- Specified by:
getBaseAvailabilityin interfaceITechnology
-
getStaticTechLevel
Description copied from interface:ITechnologyFor non-era-based usage, provide a single tech level that does not vary with date.- Specified by:
getStaticTechLevelin interfaceITechnology- Returns:
- The base rules level of the equipment or unit.
-