Class DockingCollar

java.lang.Object
megamek.common.DockingCollar
All Implemented Interfaces:
Serializable, Transporter

public class DockingCollar extends Object implements Transporter
Represents a Docking Collar (Docking Hardpoint, TO: AUE p.116) with which a JumpShip, WarShip, Space Station or Mobile Structure can carry one DropShip.
See Also:
  • Constructor Details

    • DockingCollar

      public DockingCollar(int collarId)
      Creates a JumpShip Docking Collar that can carry one dropship.
      Parameters:
      collarId - the Id of this collar, used for tracking in MHQ
  • Method Details

    • getType

      public String getType()
      Specified by:
      getType in interface Transporter
    • 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 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
    • recover

      public void recover(Entity unit) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • getLoadedUnits

      public 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 from the underlying data structure; modifying one does not affect the other.
    • getLaunchableUnits

      public List<Entity> getLaunchableUnits()
      DropShips launchable from this Docking Collar. This is different from loaded in that units in recovery cannot launch.
      Returns:
      A list of DropShips that can launch from this Docking Collar. The list may be empty but not null.
    • unload

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

      public boolean isWeaponBlockedAt(int loc, 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:
      loc - 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.
    • getExteriorUnitAt

      @Nullable public Entity getExteriorUnitAt(int loc, 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:
      loc - - 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
    • isDamaged

      public boolean isDamaged()
    • setDamaged

      public void setDamaged(boolean newStatus)
    • hardpointCost

      public int hardpointCost()
      Description copied from interface: Transporter
      Returns the number of Docking Collars (hardpoints) this transporter counts as toward the maximum that a JumpShip (or WS, SS) may carry. TO:AUE p.146
      Specified by:
      hardpointCost in interface Transporter
      Returns:
      The number of docking hardpoints this transporter counts as toward the limit.
    • setGame

      public void setGame(Game game)
      Specified by:
      setGame in interface 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
    • toString

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

      public int getCollarNumber()