Class Engine

java.lang.Object
megamek.common.Engine
All Implemented Interfaces:
Serializable, ITechnology

public class Engine extends Object implements Serializable, ITechnology
This class represents an engine, such as those driving 'Meks.
See Also:
  • Field Details

  • 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 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 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

      public static int getEngineTypeByString(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 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

      public double 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 double getWeightEngine(Entity entity, RoundWeight 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()
      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

      public String 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

      public static String getEngineTypeName(int engineType)
    • getAllEngineCodeName

      public static Map<Integer,String> getAllEngineCodeName()
    • getEngineName

      public 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
    • 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

      public int getWalkHeat(Entity e)
      Returns:
      the heat generated while the mek is walking.
    • getRunHeat

      public int getRunHeat(Entity e)
      Returns:
      the heat generated while the mek is running.
    • getSprintHeat

      public int getSprintHeat(Entity e)
      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

      public TechAdvancement 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

      public ITechnology.TechBase getTechBase()
      Specified by:
      getTechBase in interface ITechnology
    • isClan

      public boolean isClan()
      Specified by:
      isClan in interface ITechnology
    • isMixedTech

      public boolean isMixedTech()
      Specified by:
      isMixedTech in interface ITechnology
    • isIntroLevel

      public boolean isIntroLevel()
      Specified by:
      isIntroLevel in interface ITechnology
    • isUnofficial

      public boolean isUnofficial()
      Specified by:
      isUnofficial in interface ITechnology
    • getIntroductionDate

      public int getIntroductionDate(boolean clan)
      Specified by:
      getIntroductionDate in interface ITechnology
    • getIntroductionDate

      public int getIntroductionDate(boolean clan, ITechnology.Faction faction)
      Specified by:
      getIntroductionDate in interface ITechnology
    • getIntroductionDate

      public int getIntroductionDate()
      Specified by:
      getIntroductionDate in interface ITechnology
    • getPrototypeDate

      public int getPrototypeDate(boolean clan)
      Specified by:
      getPrototypeDate in interface ITechnology
    • getPrototypeDate

      public int getPrototypeDate()
      Specified by:
      getPrototypeDate in interface ITechnology
    • getPrototypeDate

      public int getPrototypeDate(boolean clan, ITechnology.Faction faction)
      Specified by:
      getPrototypeDate in interface ITechnology
    • getProductionDate

      public int getProductionDate(boolean clan)
      Specified by:
      getProductionDate in interface ITechnology
    • getProductionDate

      public int getProductionDate()
      Specified by:
      getProductionDate in interface ITechnology
    • getProductionDate

      public int getProductionDate(boolean clan, ITechnology.Faction faction)
      Specified by:
      getProductionDate in interface ITechnology
    • getCommonDate

      public int getCommonDate(boolean clan)
      Specified by:
      getCommonDate in interface ITechnology
    • getCommonDate

      public int getCommonDate()
      Specified by:
      getCommonDate in interface ITechnology
    • getExtinctionDate

      public int getExtinctionDate(boolean clan)
      Specified by:
      getExtinctionDate in interface ITechnology
    • getExtinctionDate

      public int getExtinctionDate()
      Specified by:
      getExtinctionDate in interface ITechnology
    • getExtinctionDate

      public int getExtinctionDate(boolean clan, ITechnology.Faction faction)
      Specified by:
      getExtinctionDate in interface ITechnology
    • getReintroductionDate

      public int getReintroductionDate(boolean clan)
      Specified by:
      getReintroductionDate in interface ITechnology
    • getReintroductionDate

      public int getReintroductionDate()
      Specified by:
      getReintroductionDate in interface ITechnology
    • getReintroductionDate

      public int getReintroductionDate(boolean clan, ITechnology.Faction faction)
      Specified by:
      getReintroductionDate in interface ITechnology
    • getTechRating

      public ITechnology.TechRating getTechRating()
      Specified by:
      getTechRating in interface ITechnology
    • getBaseAvailability

      public ITechnology.AvailabilityValue getBaseAvailability(ITechnology.Era era)
      Specified by:
      getBaseAvailability in interface ITechnology
    • getStaticTechLevel

      public SimpleTechLevel 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 interface ITechnology
      Returns:
      The base rules level of the equipment or unit.