Interface BTObject

All Known Subinterfaces:
ASCardDisplayable, ForceAssignable, ICarryable, InGameObject, Targetable
All Known Implementing Classes:
AbstractBuildingEntity, Aero, AeroSpaceFighter, AlphaStrikeElement, BattleArmor, BattlefieldSupportAsset, BipedMek, Briefcase, BuildingEntity, BuildingTarget, Cargo, CombatVehicleEscapePod, ConvFighter, ConvInfantry, Dropship, EjectedCrew, Entity, EscapePods, FighterSquadron, FixedWingSupport, FloorTarget, Formation, GroundObject, GunEmplacement, HandheldWeapon, HexTarget, INarcPod, Infantry, Jumpship, LandAirMek, LargeSupportTank, Mek, MekSummary, MekWarrior, MekWithArms, MinefieldTarget, MobileStructure, ProtoMek, QuadMek, QuadVee, SBFFormation, SBFIGotSomethingUnitPlaceholder, SBFPartialScanUnitPlaceHolder, SBFSomethingOutThereUnitPlaceHolder, SBFUnitPlaceHolder, SmallCraft, SpaceStation, SuperHeavyTank, SupportTank, SupportVTOL, Tank, TeleMissile, TripodMek, VTOL, Warship

public interface BTObject
This interface represents any physical object that can find itself on the battlefield, including units of any sort (Entity, AlphaStrikeElement, BF Unit, SBF Formation), but also objective markers, carryable objects, noncombatants, buildings. This does not include players or forces. This interface is for all objects even if they are not part of a game (e.g. a unit loaded in the unit selector).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the general name or type name of this unit/object.
    default Image
    Returns a fluff image for this unit or object to be shown e.g.
    default Image
    Returns an icon for this unit or object for the game board.
    default boolean
    Returns true when this object has the distinction between aerodyne and spheroid, i.e.
    default boolean
    Returns true when this object uses or can use aerospace movement.
    default boolean
    Returns true when this object is aerodyne.
    default boolean
    Returns true when this object is an aerospace unit (fighter, aerospace support vehicle or large craft) or of type AS/CF/SC/DS/DA/WS/JS/SS for Alpha Strike.
    default boolean
    Returns true when this object is an aerospace fighter (not conventional, nor Fixed-Wing Support) or of type AF for Alpha Strike.
    default boolean
    Returns true when this object is a Support Vehicle using aerospace movement such as a Fixed-Wing support.
    default boolean
    Returns true when this object is a BattleArmor unit or of type BA for Alpha Strike.
    default boolean
     
    default boolean
    Returns true when this object is a BattleMek or of type BM for Alpha Strike.
    default boolean
    For future reference.
    default boolean
    Returns true when this object is a ground Combat Vehicle, including VTOL but not including Support Vehicles, or of type CV for Alpha Strike.
    default boolean
    Returns true when this object is a conventional fighter (not aerospace, nor Fixed-Wing Support) or of type CF for Alpha Strike.
    default boolean
    Returns true when this object is a Conventional Infantry unit or of type CI for Alpha Strike.
    default boolean
    Returns true when this object is a DropShip.
    default boolean
    Returns true when this object is a fighter (aerospace or conventional) including Fixed-Wing Support or of type CF/AF/SV(MV a) for Alpha Strike.
    default boolean
    Returns true when this object is a Fixed-Wing Support or of type SV(MV a) for Alpha Strike.
    default boolean
    Returns true when this object is a ground unit (all types of Mek, Infantry and Vehicle except aerospace support vehicles such as Fixed-Wing Support).
    default boolean
     
    default boolean
    Returns true when this object is an Industrial Mek or of type IM for Alpha Strike.
    default boolean
    Returns true when this object is any Infantry unit or of type CI/BA for Alpha Strike.
    default boolean
    Returns true when this object is a JumpShip (but not a Space Station nor a WarShip).
    default boolean
    Returns true when this object is a large aerospace unit (SmallCraft, DropShip, JumpShip, WarShip, Space Station).
    default boolean
    Returns true when this object is a Mek (Industrial Mek or BattleMek) or of type BM/IM for Alpha Strike.
    default boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    default boolean
    Returns true when this object is a ProtoMek or of type PM for Alpha Strike.
    default boolean
    Returns true when this object is a Quad Mek or QuadVee, regardless of conversion state.
    default boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    default boolean
    Returns true when this object is a SmallCraft (not a DropShip).
    default boolean
    Returns true when this object is a SpaceStation (but not a WarShip nor a JumpShip).
    default boolean
    Returns true when this object has the distinction between aerodyne and spheroid, i.e.
    default boolean
    Returns true when this object is a Support Vehicle of any kind (including ground and aerospace).
    default boolean
    Returns true when this object is a Tripod Mek.
    default boolean
    Returns true when this is a group of units or elements such as a TW Squadron, BF Unit or SBF Formation even if it happens to contain only a single element at the time.
    default boolean
    Returns true when this object is a Combat Vehicle or ground Support Vehicle (including VTOL) or of type CV, ground SV for Alpha Strike.
    default boolean
    Returns true when this object is a WarShip (but not a Space Station nor a JumpShip).
    Returns the specific name or type name of this unit/object.
  • Field Details

  • Method Details

    • isMek

      default boolean isMek()
      Returns true when this object is a Mek (Industrial Mek or BattleMek) or of type BM/IM for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a Mek or BM/IM
    • isAerospace

      default boolean isAerospace()
      Returns true when this object is an aerospace unit (fighter, aerospace support vehicle or large craft) or of type AS/CF/SC/DS/DA/WS/JS/SS for Alpha Strike. An aerospace unit is not isGround().
      Returns:
      True when this is an aerospace unit (including aerospace support vehicles) or aerospace group (SBF)
    • isProtoMek

      default boolean isProtoMek()
      Returns true when this object is a ProtoMek or of type PM for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a ProtoMek
    • isBattleMek

      default boolean isBattleMek()
      Returns true when this object is a BattleMek or of type BM for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a BattleMek (not an Industrial Mek)
    • isTripodMek

      default boolean isTripodMek()
      Returns true when this object is a Tripod Mek. Returns false for any type of unit group even if it consists only of Tripods.
      Returns:
      True when this is a Tripod Mek
    • isQuadMek

      default boolean isQuadMek()
      Returns true when this object is a Quad Mek or QuadVee, regardless of conversion state. Returns false for any type of unit group even if it consists only of Quad Meks.
      Returns:
      True when this is a Quad (four-legged) Mek
    • isIndustrialMek

      default boolean isIndustrialMek()
      Returns true when this object is an Industrial Mek or of type IM for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is an Industrial Mek (not a BattleMek)
    • isGround

      default boolean isGround()
      Returns true when this object is a ground unit (all types of Mek, Infantry and Vehicle except aerospace support vehicles such as Fixed-Wing Support). A unit is a ground unit if it is not isAerospace(). This method should not require overriding.
      Returns:
      True when this is a ground unit or ground group (SBF)
    • isFighter

      default boolean isFighter()
      Returns true when this object is a fighter (aerospace or conventional) including Fixed-Wing Support or of type CF/AF/SV(MV a) for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a fighter including fixed-wing support
    • isAerospaceFighter

      default boolean isAerospaceFighter()
      Returns true when this object is an aerospace fighter (not conventional, nor Fixed-Wing Support) or of type AF for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is an aerospace fighter
    • isConventionalFighter

      default boolean isConventionalFighter()
      Returns true when this object is a conventional fighter (not aerospace, nor Fixed-Wing Support) or of type CF for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a conventional fighter including fixed-wing support
    • isFixedWingSupport

      default boolean isFixedWingSupport()
      Returns true when this object is a Fixed-Wing Support or of type SV(MV a) for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a fixed-wing support unit
    • isLargeAerospace

      default boolean isLargeAerospace()
      Returns true when this object is a large aerospace unit (SmallCraft, DropShip, JumpShip, WarShip, Space Station). Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a large aerospace unit
    • isBattleArmor

      default boolean isBattleArmor()
      Returns true when this object is a BattleArmor unit or of type BA for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a BattleArmor unit
    • isConventionalInfantry

      default boolean isConventionalInfantry()
      Returns true when this object is a Conventional Infantry unit or of type CI for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a Conventional Infantry unit
    • isHandheldWeapon

      default boolean isHandheldWeapon()
      Returns:
      True when this object is a Handheld Weapon.
    • isBattlefieldSupportAsset

      default boolean isBattlefieldSupportAsset()
      Returns:
      True when this object is a Battlefield Support Asset (a simplified unit governed by the Battlefield Support rules rather than by full construction/combat rules). False for all standard units.
    • isAerospaceSV

      default boolean isAerospaceSV()
      Returns true when this object is a Support Vehicle using aerospace movement such as a Fixed-Wing support. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is an aerospace Support Vehicle
    • isSmallCraft

      default boolean isSmallCraft()
      Returns true when this object is a SmallCraft (not a DropShip). Returns false for any type of unit group.
      Returns:
      True when this is a SmallCraft
    • isDropShip

      default boolean isDropShip()
      Returns true when this object is a DropShip. Returns false for any type of unit group.
      Returns:
      True when this is a DropShip
    • isJumpShip

      default boolean isJumpShip()
      Returns true when this object is a JumpShip (but not a Space Station nor a WarShip). Returns false for any type of unit group.
      Returns:
      True when this is a JumpShip
    • isWarShip

      default boolean isWarShip()
      Returns true when this object is a WarShip (but not a Space Station nor a JumpShip). Returns false for any type of unit group.
      Returns:
      True when this is a WarShip
    • isSpaceStation

      default boolean isSpaceStation()
      Returns true when this object is a SpaceStation (but not a WarShip nor a JumpShip). Returns false for any type of unit group.
      Returns:
      True when this is a SpaceStation
    • hasAerodyneSpheroidDistinction

      default boolean hasAerodyneSpheroidDistinction()
      Returns true when this object has the distinction between aerodyne and spheroid, i.e. if it is a DropShip or SmallCraft. Returns false for fighters as they are always aerodyne and do not have the distinction. Returns false for any type of unit group. This method should not require overriding.
      Returns:
      True when this is object can be aerodyne or spheroid
    • isAerodyne

      default boolean isAerodyne()
      Returns true when this object is aerodyne. All fighters are aerodyne. Units that have the aerodyne/spheroid distinction, i.e. DropShips and SmallCraft return true when they are aerodyne. Returns false for any type of unit group. This method refers to isSpheroid() and should not require overriding.
      Returns:
      True when this is object is aerodyne (fighter, aerodyne DropShip or aerodyne SmallCraft)
    • isSpheroid

      default boolean isSpheroid()
      Returns true when this object has the distinction between aerodyne and spheroid, i.e. if it is a DropShip or SmallCraft, and it is spheroid, false for any other type of object. Returns false for any type of unit group and for any unit that does not have the distinction.
      Returns:
      True when this is object is spheroid
    • isSupportVehicle

      default boolean isSupportVehicle()
      Returns true when this object is a Support Vehicle of any kind (including ground and aerospace). Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a Support Vehicle
    • isInfantry

      default boolean isInfantry()
      Returns true when this object is any Infantry unit or of type CI/BA for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is an Infantry unit (BattleArmor and Conventional)
    • isVehicle

      default boolean isVehicle()
      Returns true when this object is a Combat Vehicle or ground Support Vehicle (including VTOL) or of type CV, ground SV for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a ground vehicle (including support vehicle and VTOL)
    • isCombatVehicle

      default boolean isCombatVehicle()
      Returns true when this object is a ground Combat Vehicle, including VTOL but not including Support Vehicles, or of type CV for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a ground Combat Vehicle (not including Support Vehicle)
    • isCarryableObject

      default boolean isCarryableObject()
      For future reference. Returns true when this object is a battlefield object (such as a crate) that can be picked up and carried by some types of units.
      Returns:
      True when this is a carryable battlefield object.
    • isObjectiveMarker

      @Deprecated(since="0.51.0", forRemoval=true) default boolean isObjectiveMarker()
      Deprecated, for removal: This API element is subject to removal in a future version.
      For future reference. Returns true when this object is an objective marker, marking a certain hex or building or other object as valuable to conquer, hold or destroy.
      Returns:
      True when this is an objective marker.
    • isAero

      default boolean isAero()
      Returns true when this object uses or can use aerospace movement. This includes all aerospace units as well as LAMs (in fighter mode when in a TW game). Returns false for any type of unit group even if it is of the right type.

      Note that this is not equivalent to "this instanceof Aero" as LAMs are not an Aero subclass. It is also not equivalent to "this instanceof IAero" as LAMs are always IAero but only return true for isAero() when they are in fighter conversion mode. The following cast can be safely made:

      if (entity.isAero()) {
           IAero iAero = (IAero) entity;
       }
      Returns:
      True when this may use aerospace movement (aerospace and LAM units)
    • isUnitGroup

      default boolean isUnitGroup()
      Returns true when this is a group of units or elements such as a TW Squadron, BF Unit or SBF Formation even if it happens to contain only a single element at the time.
      Returns:
      True when this is a group type unit
    • isSingleUnit

      @Deprecated(since="0.51.0", forRemoval=true) default boolean isSingleUnit()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns true when this is a single unit such as a TW Entity or AlphaStrikeElement, false when it is a group unit type, see isUnitGroup() This method forwards to isUnitGroup() and should not require overriding.
      Returns:
      True when this is a single unit or element.
    • generalName

      String generalName()
      Returns the general name or type name of this unit/object. For standard individual units, this is the chassis. For other types of units or objects this can be the full designation or a general part of the designation. Much like the chassis, this can be much more narrow than the general type of unit ("Mek").

      The general name should not be empty and not return null. Return the chassis in Entity and AlphaStrikeElement.

      Returns:
      The general name / chassis
    • specificName

      String specificName()
      Returns the specific name or type name of this unit/object. For standard individual units, this is the model. For other types of units or objects this can be a part of the designation, or empty.

      The specific name should not return null. Return the model in Entity and AlphaStrikeElement.

      Returns:
      The specific name / model
    • getFluffImage

      @Nullable default Image getFluffImage()
      Returns a fluff image for this unit or object to be shown e.g. in the unit summary.

      Important: This method returns only a fluff image that is stored in the object itself, e.g. if it was part of the unit's file or is created by the unit itself. It does not search for fluff images in the fluff images directories. For GUI, use FluffImageHelper.getFluffImage(BTObject) instead; that method will retrieve either a unit's own fluff image or an image from the fluff images directories (if there is one).

      The default implementation returns null. For canon units, this will return null, as they do not store fluff images in the unit files.

      Returns:
      A fluff image for this object/unit if it contains one as part of the object/unit
    • getIcon

      @Nullable default Image getIcon()
      Returns an icon for this unit or object for the game board. Note that this is the 84 x 72 standard size icon; icons for landed large craft are not handled by this method.

      Important: This method returns only an icon that is stored in the object itself, e.g. if it was part of the unit's file or is created by the unit itself. It does not search for the icon through the mekset.

      The default implementation returns null. For canon units, this will return null, as they do not store icon images in the unit files.

      Returns:
      An icon for this object/unit if it contains one as part of the object/unit