Package megamek.common.battleArmor
Class BattleArmorHandles
java.lang.Object
megamek.common.battleArmor.BattleArmorHandles
- All Implemented Interfaces:
Serializable,Transporter
- Direct Known Subclasses:
BattleArmorHandlesTank,ClampMountMek,ProtoMekClampMount
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if this object can accept the given unit.intgetCargoMpReduction(Entity carrier) final EntitygetExteriorUnitAt(int location, 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.doubleReturn a string that identifies the unused capacity of this transporter.protected static booleanhasActiveTrooper(Entity carriedBattleArmor, int trooperLocation) booleanisWeaponBlockedAt(int location, boolean isRear) Determine if transported units prevent a weapon in the given location from firing.final voidLoad the given unit.voidclear out all troops listed in the transporter.voidtoString()final booleanUnload the given unit.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface megamek.common.equipment.Transporter
alwaysDamageCargoIfTransportHit, canPickupGroundObject, canTow, getCarryables, getNameForRecordSheets, getNumberLoadedThisTurn, getNumberUnloadedThisTurn, getTransporterType, hardpointCost, setEntity
-
Field Details
-
carriedUnit
protected int carriedUnitThe troopers being carried.
-
-
Constructor Details
-
BattleArmorHandles
public BattleArmorHandles()
-
-
Method Details
-
canLoad
Description copied from interface:TransporterDetermines 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:
canLoadin interfaceTransporter- Parameters:
unit- - theEntityto be loaded.- Returns:
trueif the unit can be loaded,falseotherwise.
-
load
Description copied from interface:TransporterLoad the given unit.- Specified by:
loadin interfaceTransporter- Parameters:
unit- theEntityto be loaded.- Throws:
IllegalArgumentException- If the unit can't be loaded
-
getLoadedUnits
Description copied from interface:TransporterGet aVectorof the units currently loaded into this payload.- Specified by:
getLoadedUnitsin interfaceTransporter- 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
Description copied from interface:TransporterUnload the given unit.- Specified by:
unloadin interfaceTransporter- Parameters:
unit- - theEntityto be unloaded.- Returns:
trueif the unit was contained in this space,falseotherwise.
-
getUnusedString
Description copied from interface:TransporterReturn a string that identifies the unused capacity of this transporter.- Specified by:
getUnusedStringin interfaceTransporter- Returns:
- A
Stringmeant for a human.
-
getUnused
public double getUnused()- Specified by:
getUnusedin interfaceTransporter- Returns:
- the number of unused spaces in this transporter.
-
resetTransporter
public void resetTransporter()Description copied from interface:Transporterclear out all troops listed in the transporter. Used by MHQ to reset units after game- Specified by:
resetTransporterin interfaceTransporter
-
isWeaponBlockedAt
public boolean isWeaponBlockedAt(int location, boolean isRear) Description copied from interface:TransporterDetermine if transported units prevent a weapon in the given location from firing.- Specified by:
isWeaponBlockedAtin interfaceTransporter- 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
- Parameters:
carriedBattleArmor- the battle armor unit carried by these handlestrooperLocation- the trooper location to check- Returns:
trueif the carried battle armor has the given trooper location and that trooper still has internal structure remaining
-
getExteriorUnitAt
Description copied from interface:TransporterIf 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:
getExteriorUnitAtin interfaceTransporter- Parameters:
location- - 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
- Specified by:
getExternalUnitsin interfaceTransporter- Returns:
- list of all units carried externally by this transporter
-
getCargoMpReduction
- Specified by:
getCargoMpReductionin interfaceTransporter- Returns:
- the MP reduction due to cargo carried by this transporter
-
toString
-
setGame
- Specified by:
setGamein interfaceTransporter
-