megamek.common
Interface Transporter

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
Aero, ArmlessMech, ASFBay, BattleArmor, BattleArmorBay, BattleArmorHandles, BattleArmorHandlesTank, Bay, BipedMech, CargoBay, ClampMountMech, ClampMountTank, ConvFighter, DockingCollar, Dropship, Entity, FighterSquadron, GunEmplacement, HeavyVehicleBay, Infantry, InfantryBay, Jumpship, LandAirMech, LargeSupportTank, LightVehicleBay, Mech, MechBay, MechWarrior, Protomech, QuadMech, SmallCraft, SmallCraftBay, SpaceStation, SupportTank, SupportVTOL, Tank, TeleMissile, TroopSpace, VTOL, Warship

public interface Transporter
extends java.io.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 Summary
 boolean canLoad(Entity unit)
          Determines if this object can accept the given unit.
 int getCargoMpReduction()
           
 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.
 java.util.List<Entity> getExternalUnits()
           
 java.util.List<Entity> getLoadedUnits()
          Get a Vector of the units currently loaded into this payload.
 java.lang.String getUnusedString()
          Return a string that identifies the unused capacity of this transporter.
 boolean isWeaponBlockedAt(int loc, boolean isRear)
          Determine if transported units prevent a weapon in the given location from firing.
 void load(Entity unit)
          Load the given unit.
 boolean unload(Entity unit)
          Unload the given unit.
 

Method Detail

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.

load

void load(Entity unit)
          throws java.lang.IllegalArgumentException
Load the given unit.

Parameters:
unit - - the Entity to be loaded.
Throws:
- - If the unit can't be loaded, an IllegalArgumentException exception will be thrown.
java.lang.IllegalArgumentException

getLoadedUnits

java.util.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 independant from the under- lying 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.

getUnusedString

java.lang.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 int location attempting to fire.
isRear - - a boolean value stating if the given location is rear facing; if false, the location is front facing.
Returns:
true if a transported unit is in the way, false if the weapon can fire.

getExteriorUnitAt

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

java.util.List<Entity> getExternalUnits()
Returns:
list of all units carried externally by this transporter

getCargoMpReduction

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