|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmegamek.common.TroopSpace
public final class TroopSpace
Represtents a volume of space set aside for carrying troops and their equipment under battle conditions. Typically, a component of an APC.
| Field Summary | |
|---|---|
(package private) double |
currentSpace
The current amount of space available for troops. |
(package private) double |
totalSpace
The total amount of space available for troops. |
(package private) java.util.Vector<Entity> |
troops
The troops being carried. |
| Constructor Summary | |
|---|---|
protected |
TroopSpace()
The default constructor is only for serialization. |
|
TroopSpace(double space)
Create a space for the given tonnage of troops. |
| 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.Vector<Entity> |
getLoadedUnits()
Get a List 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
java.util.Vector<Entity> troops
double totalSpace
double currentSpace
| Constructor Detail |
|---|
protected TroopSpace()
public TroopSpace(double space)
space - - The weight of troops (in tons) this space can carry.| Method Detail |
|---|
public boolean canLoad(Entity unit)
canLoad in interface Transporterunit - - the Entity to be loaded.
true if the unit can be loaded, false
otherwise.
public void load(Entity unit)
throws java.lang.IllegalArgumentException
load in interface Transporterunit - - the Entity to be loaded.
- - If the unit can't be loaded, an
IllegalArgumentException exception will be
thrown.
java.lang.IllegalArgumentExceptionpublic java.util.Vector<Entity> getLoadedUnits()
List of the units currently loaded into this
payload.
getLoadedUnits in interface TransporterList 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.public boolean unload(Entity unit)
unload in interface Transporterunit - - the Entity to be unloaded.
true if the unit was contained in this space,
false otherwise.public java.lang.String getUnusedString()
getUnusedString in interface TransporterString meant for a human.
public boolean isWeaponBlockedAt(int loc,
boolean isRear)
isWeaponBlockedAt in interface Transporterloc - - 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.
true if a transported unit is in the way,
false if the weapon can fire.
public Entity getExteriorUnitAt(int loc,
boolean isRear)
getExteriorUnitAt in interface Transporterloc - - 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.
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.public final java.util.List<Entity> getExternalUnits()
getExternalUnits in interface Transporterpublic int getCargoMpReduction()
getCargoMpReduction in interface Transporter
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||