Package megamek.common.equipment
Class DockingCollar
java.lang.Object
megamek.common.equipment.DockingCollar
- All Implemented Interfaces:
Serializable,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 Summary
ConstructorsConstructorDescriptionDockingCollar(int collarId) Creates a JumpShip Docking Collar that can carry one dropship. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if this object can accept the given unit.intgetCargoMpReduction(Entity carrier) intgetExteriorUnitAt(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.DropShips launchable from this Docking Collar.Get aVectorof the units currently loaded into this payload.doubleReturn a string that identifies the unused capacity of this transporter.intReturns the number of Docking Collars (hardpoints) this transporter counts as toward the maximum that a JumpShip (or WS, SS) may carry.booleanbooleanisWeaponBlockedAt(int loc, boolean isRear) Determine if transported units prevent a weapon in the given location from firing.voidLoad the given unit.voidvoidclear out all troops listed in the transporter.voidsetDamaged(boolean newStatus) voidtoString()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, setEntity
-
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
-
getTransporterType
- Specified by:
getTransporterTypein interfaceTransporter
-
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
-
recover
- Throws:
IllegalArgumentException
-
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.
-
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
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.
-
isWeaponBlockedAt
public boolean isWeaponBlockedAt(int loc, boolean isRear) Description copied from interface:TransporterDetermine if transported units prevent a weapon in the given location from firing.- Specified by:
isWeaponBlockedAtin interfaceTransporter- 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
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:
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
- 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
-
isDamaged
public boolean isDamaged() -
setDamaged
public void setDamaged(boolean newStatus) -
hardpointCost
public int hardpointCost()Description copied from interface:TransporterReturns 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:
hardpointCostin interfaceTransporter- Returns:
- The number of docking hardpoints this transporter counts as toward the limit.
-
setGame
- Specified by:
setGamein interfaceTransporter
-
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
-
toString
-
getCollarNumber
public int getCollarNumber()
-