Package megamek.common
Class DockingCollar
java.lang.Object
megamek.common.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 TypeMethodDescriptionboolean
Determines if this object can accept the given unit.int
getCargoMpReduction
(Entity carrier) int
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.DropShips launchable from this Docking Collar.Get aVector
of the units currently loaded into this payload.getType()
double
Return a string that identifies the unused capacity of this transporter.int
Returns the number of Docking Collars (hardpoints) this transporter counts as toward the maximum that a JumpShip (or WS, SS) may carry.boolean
boolean
isWeaponBlockedAt
(int loc, boolean isRear) Determine if transported units prevent a weapon in the given location from firing.void
Load the given unit.void
void
clear out all troops listed in the transporter.void
setDamaged
(boolean newStatus) void
toString()
boolean
Unload the given unit.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface megamek.common.Transporter
canTow, getNumberLoadedThisTurn, getNumberUnloadedThisTurn
-
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
-
getType
- Specified by:
getType
in interfaceTransporter
-
canLoad
Description copied from interface:Transporter
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.- Specified by:
canLoad
in interfaceTransporter
- Parameters:
unit
- - theEntity
to be loaded.- Returns:
true
if the unit can be loaded,false
otherwise.
-
load
Description copied from interface:Transporter
Load the given unit.- Specified by:
load
in interfaceTransporter
- Parameters:
unit
- theEntity
to be loaded.- Throws:
IllegalArgumentException
- If the unit can't be loaded
-
recover
- Throws:
IllegalArgumentException
-
getLoadedUnits
Description copied from interface:Transporter
Get aVector
of the units currently loaded into this payload.- Specified by:
getLoadedUnits
in interfaceTransporter
- Returns:
- A
List
of loadedEntity
units. This list will never benull
, but it may be empty. The returnedList
is independent from 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:Transporter
Unload the given unit.- Specified by:
unload
in interfaceTransporter
- Parameters:
unit
- - theEntity
to be unloaded.- Returns:
true
if the unit was contained in this space,false
otherwise.
-
getUnusedString
Description copied from interface:Transporter
Return a string that identifies the unused capacity of this transporter.- Specified by:
getUnusedString
in interfaceTransporter
- Returns:
- A
String
meant for a human.
-
getUnused
public double getUnused()- Specified by:
getUnused
in interfaceTransporter
- Returns:
- the number of unused spaces in this transporter.
-
isWeaponBlockedAt
public boolean isWeaponBlockedAt(int loc, boolean isRear) Description copied from interface:Transporter
Determine if transported units prevent a weapon in the given location from firing.- Specified by:
isWeaponBlockedAt
in 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:Transporter
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.- Specified by:
getExteriorUnitAt
in interfaceTransporter
- Parameters:
loc
- - theint
location hit by attack.isRear
- - aboolean
value stating if the given location is rear facing; iffalse
, the location is front facing.- Returns:
- The
Entity
being transported on the outside at that location. This value will benull
if no unit is transported on the outside at that location.
-
getExternalUnits
- Specified by:
getExternalUnits
in interfaceTransporter
- Returns:
- list of all units carried externally by this transporter
-
getCargoMpReduction
- Specified by:
getCargoMpReduction
in 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:Transporter
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- Specified by:
hardpointCost
in interfaceTransporter
- Returns:
- The number of docking hardpoints this transporter counts as toward the limit.
-
setGame
- Specified by:
setGame
in interfaceTransporter
-
resetTransporter
public void resetTransporter()Description copied from interface:Transporter
clear out all troops listed in the transporter. Used by MHQ to reset units after game- Specified by:
resetTransporter
in interfaceTransporter
-
toString
-
getCollarNumber
public int getCollarNumber()
-