Package megamek.common.equipment
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
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
Modifier and TypeMethodDescriptiondefault booleanReturns true if the transporter damages its cargo if the transport is hit, otherwise false.booleanDetermines if this object can accept the given unit.default booleanReturns true if the transporter can pick up ground objectsdefault booleanDetermines if this transporter can tow the given unit.intgetCargoMpReduction(Entity carrier) default List<ICarryable> Retrieves a list of allICarryableobjects currently carried by this transporter.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.Get aVectorof the units currently loaded into this payload.default Stringdefault intDeprecated, for removal: This API element is subject to removal in a future version.default intReturns the number of units loaded on to this transporter this turn.default StringdoubleReturn a string that identifies the unused capacity of this transporter.default intReturns the number of Docking Collars (hardpoints) this transporter counts as toward the maximum that a JumpShip (or WS, SS) may carry.booleanisWeaponBlockedAt(int loc, boolean isRear) Determine if transported units prevent a weapon in the given location from firing.voidLoad the given unit.voidclear out all troops listed in the transporter.default voidSets the specified entity to the transporter.voidbooleanUnload the given unit.
-
Method Details
-
canLoad
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- - theEntityto be loaded.- Returns:
trueif the unit can be loaded,falseotherwise.
-
canTow
Determines if this transporter can tow the given unit. By default, no. -
load
Load the given unit.- Parameters:
unit- theEntityto be loaded.- Throws:
IllegalArgumentException- If the unit can't be loaded
-
getLoadedUnits
Get aVectorof the units currently loaded into this payload.- Returns:
- A
Listof loadedEntityunits. This list will never benull, but it may be empty. The returnedListis independent of the underlying data structure; modifying one does not affect the other.
-
unload
Unload the given unit.- Parameters:
unit- - theEntityto be unloaded.- Returns:
trueif the unit was contained in this space,falseotherwise.
-
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
Stringmeant 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
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- - theintlocation hit by attack.isRear- - abooleanvalue stating if the given location is rear facing; iffalse, the location is front facing.- Returns:
- The
Entitybeing transported on the outside at that location. This value will benullif no unit is transported on the outside at that location.
-
getExternalUnits
- Returns:
- list of all units carried externally by this transporter
-
getCargoMpReduction
- Returns:
- the MP reduction due to cargo carried by this transporter
-
setGame
-
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, 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
-
getNameForRecordSheets
-
setEntity
Sets the specified entity to the transporter. Not implemented by default, only implemented for Transporters that need it (likeExternalCargo)- Parameters:
entity- theEntityto 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
Retrieves a list of allICarryableobjects 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
ICarryableobjects currently carried. Never null, but may be empty.
-