Class BattleArmorHandles

java.lang.Object
megamek.common.battleArmor.BattleArmorHandles
All Implemented Interfaces:
Serializable, Transporter
Direct Known Subclasses:
BattleArmorHandlesTank, ClampMountMek, ProtoMekClampMount

public class BattleArmorHandles extends Object implements Transporter
Represents a set of handles on an OmniMek used by Battle Armor units equipped with Boarding Claws to attach themselves for transport. This is standard equipment on OmniMeks.
See Also:
  • Field Details

    • carriedUnit

      protected int carriedUnit
      The troopers being carried.
  • Constructor Details

    • BattleArmorHandles

      public BattleArmorHandles()
  • Method Details

    • canLoad

      public boolean canLoad(Entity unit)
      Description copied from interface: Transporter
      Determines if this object can accept the given unit. The unit may not be of the appropriate type or there may be no room for the unit.
      Specified by:
      canLoad in interface Transporter
      Parameters:
      unit - - the Entity to be loaded.
      Returns:
      true if the unit can be loaded, false otherwise.
    • load

      public final void load(Entity unit) throws IllegalArgumentException
      Description copied from interface: Transporter
      Load the given unit.
      Specified by:
      load in interface Transporter
      Parameters:
      unit - the Entity to be loaded.
      Throws:
      IllegalArgumentException - If the unit can't be loaded
    • getLoadedUnits

      public final List<Entity> getLoadedUnits()
      Description copied from interface: Transporter
      Get a Vector of the units currently loaded into this payload.
      Specified by:
      getLoadedUnits in interface Transporter
      Returns:
      A List of loaded Entity units. This list will never be null, but it may be empty. The returned List is independent of the underlying data structure; modifying one does not affect the other.
    • unload

      public final boolean unload(Entity unit)
      Description copied from interface: Transporter
      Unload the given unit.
      Specified by:
      unload in interface Transporter
      Parameters:
      unit - - the Entity to be unloaded.
      Returns:
      true if the unit was contained in this space, false otherwise.
    • getUnusedString

      public String getUnusedString()
      Description copied from interface: Transporter
      Return a string that identifies the unused capacity of this transporter.
      Specified by:
      getUnusedString in interface Transporter
      Returns:
      A String meant for a human.
    • getUnused

      public double getUnused()
      Specified by:
      getUnused in interface Transporter
      Returns:
      the number of unused spaces in this transporter.
    • resetTransporter

      public void resetTransporter()
      Description copied from interface: Transporter
      clear out all troops listed in the transporter. Used by MHQ to reset units after game
      Specified by:
      resetTransporter in interface Transporter
    • isWeaponBlockedAt

      public boolean isWeaponBlockedAt(int location, boolean isRear)
      Description copied from interface: Transporter
      Determine if transported units prevent a weapon in the given location from firing.
      Specified by:
      isWeaponBlockedAt in interface Transporter
      Parameters:
      location - the location attempting to fire.
      isRear - true if the weapon is rear-facing
      Returns:
      True if a transported unit is in the way, false if the weapon can fire.
    • hasActiveTrooper

      protected static boolean hasActiveTrooper(Entity carriedBattleArmor, int trooperLocation)
      Parameters:
      carriedBattleArmor - the battle armor unit carried by these handles
      trooperLocation - the trooper location to check
      Returns:
      true if the carried battle armor has the given trooper location and that trooper still has internal structure remaining
    • getExteriorUnitAt

      @Nullable public final Entity getExteriorUnitAt(int location, boolean isRear)
      Description copied from interface: Transporter
      If a unit is being transported on the outside of the transporter, it can suffer damage when the transporter is hit by an attack. Currently, no more than one unit can be at any single location; that same unit can be "spread" over multiple locations.
      Specified by:
      getExteriorUnitAt in interface Transporter
      Parameters:
      location - - the int location hit by attack.
      isRear - - a boolean value stating if the given location is rear facing; if false, the location is front facing.
      Returns:
      The Entity being transported on the outside at that location. This value will be null if no unit is transported on the outside at that location.
    • getExternalUnits

      public final List<Entity> getExternalUnits()
      Specified by:
      getExternalUnits in interface Transporter
      Returns:
      list of all units carried externally by this transporter
    • getCargoMpReduction

      public int getCargoMpReduction(Entity carrier)
      Specified by:
      getCargoMpReduction in interface Transporter
      Returns:
      the MP reduction due to cargo carried by this transporter
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setGame

      public void setGame(Game game)
      Specified by:
      setGame in interface Transporter