Interface Transporter

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractBuildingEntity, AbstractSmallCraftASFBay, Aero, AeroSpaceFighter, ASFBay, BattleArmor, BattleArmorBay, BattleArmorHandles, BattleArmorHandlesTank, BattlefieldSupportAsset, Bay, BipedMek, BuildingEntity, CargoBay, ClampMountMek, ClampMountTank, CombatVehicleEscapePod, ConvFighter, ConvInfantry, CrewQuartersCargoBay, DockingCollar, Dropship, DropShuttleBay, EjectedCrew, EjectionSeatCargoBay, Entity, EscapePods, ExternalCargo, FighterSquadron, FirstClassQuartersCargoBay, FixedWingSupport, GunEmplacement, HandheldWeapon, HeavyVehicleBay, Infantry, InfantryBay, InfantryCompartment, InsulatedCargoBay, Jumpship, LandAirMek, LargeSupportTank, LiftHoist, LightVehicleBay, LiquidCargoBay, LivestockCargoBay, Mek, MekArms, MekBay, MekWarrior, MekWithArms, MobileStructure, NavalRepairFacility, PillionSeatCargoBay, ProtoMek, ProtoMekBay, ProtoMekClampMount, QuadMek, QuadVee, RefrigeratedCargoBay, ReinforcedRepairFacility, RoofRack, SecondClassQuartersCargoBay, SmallCraft, SmallCraftBay, SpaceStation, StandardSeatCargoBay, SteerageQuartersCargoBay, SuperHeavyTank, SuperHeavyVehicleBay, SupportTank, SupportVTOL, Tank, TankTrailerHitch, TeleMissile, TripodMek, UnitBay, VTOL, Warship

public interface Transporter extends Serializable
Classes that implement this interface have the ability to load, carry, and unload units in the game. It is anticipated that classes will exist for passenger compartments, battle armor steps, Mek bays, Aerospace hangers, and vehicle garages. Other possible classes include cargo bays and Dropship docks.
  • Method Details

    • canLoad

      boolean canLoad(Entity unit)
      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.
      Parameters:
      unit - - the Entity to be loaded.
      Returns:
      true if the unit can be loaded, false otherwise.
    • canTow

      default boolean canTow(Entity unit)
      Determines if this transporter can tow the given unit. By default, no.
    • load

      void load(Entity unit) throws IllegalArgumentException
      Load the given unit.
      Parameters:
      unit - the Entity to be loaded.
      Throws:
      IllegalArgumentException - If the unit can't be loaded
    • getLoadedUnits

      List<Entity> getLoadedUnits()
      Get a Vector of the units currently loaded into this payload.
      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

      boolean unload(Entity unit)
      Unload the given unit.
      Parameters:
      unit - - the Entity to be unloaded.
      Returns:
      true if the unit was contained in this space, false otherwise.
    • getUnused

      double getUnused()
      Returns:
      the number of unused spaces in this transporter.
    • getUnusedString

      String getUnusedString()
      Return a string that identifies the unused capacity of this transporter.
      Returns:
      A String meant for a human.
    • isWeaponBlockedAt

      boolean isWeaponBlockedAt(int loc, boolean isRear)
      Determine if transported units prevent a weapon in the given location from firing.
      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 Entity getExteriorUnitAt(int loc, boolean isRear)
      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.
      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

      List<Entity> getExternalUnits()
      Returns:
      list of all units carried externally by this transporter
    • getCargoMpReduction

      int getCargoMpReduction(Entity carrier)
      Returns:
      the MP reduction due to cargo carried by this transporter
    • setGame

      void setGame(Game game)
    • resetTransporter

      void resetTransporter()
      clear out all troops listed in the transporter. Used by MHQ to reset units after game
    • hardpointCost

      default int hardpointCost()
      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
      Returns:
      The number of docking hardpoints this transporter counts as toward the limit.
    • getNumberLoadedThisTurn

      @Deprecated(since="0.51.0", forRemoval=true) default int getNumberLoadedThisTurn()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the number of units loaded on to this transporter this turn. Used to determine loading eligibility
      Returns:
      the number of units loaded
    • getNumberUnloadedThisTurn

      default int getNumberUnloadedThisTurn()
      Returns the number of units loaded on to this transporter this turn. Used to determine loading eligibility
      Returns:
      the number of units loaded
    • getTransporterType

      default String getTransporterType()
    • getNameForRecordSheets

      default String getNameForRecordSheets()
    • setEntity

      default void setEntity(Entity entity)
      Sets the specified entity to the transporter. Not implemented by default, only implemented for Transporters that need it (like ExternalCargo)
      Parameters:
      entity - the Entity to be set for the transporter
    • canPickupGroundObject

      default boolean canPickupGroundObject()
      Returns true if the transporter can pick up ground objects
    • alwaysDamageCargoIfTransportHit

      default boolean alwaysDamageCargoIfTransportHit()
      Returns true if the transporter damages its cargo if the transport is hit, otherwise false.
    • getCarryables

      default List<ICarryable> getCarryables()
      Retrieves a list of all ICarryable objects currently carried by this transporter. If no objects are being carried, the returned list will be empty.

      The returned list is a separate instance and modifying it will not affect the underlying data structure of carried objects.

      Returns:
      a list of ICarryable objects currently carried. Never null, but may be empty.