Package megamek.common.units
Class BaConstructionUtil
java.lang.Object
megamek.common.units.BaConstructionUtil
Helper methods for constructing/changing Battle Armor units. This happens mostly in MML but some units have modular
equipment which MM must be able to switch out and the code for this is involved and should be unified as much as
possible.
This is the MM extension of BattleArmorUtil.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidemptyDwpApm(Mounted<?> mount) Empties the given APM (including armored glove) or DWP, removing any weapon or other equipment attached to it.static booleanisFilledApm(Mounted<?> mounted) static booleanisFilledArmoredGlove(Mounted<?> mounted) static booleanisFilledDwp(Mounted<?> mounted) static voidmountOnApm(Mounted<?> weapon, Mounted<?> apm) Mounts the given weapon on the given Anti-Personnel Weapon Mount, which may be either the misc item or an armored glove.static voidunallocateMounted(BattleArmor battleArmor, Mounted<?> mounted) Unallocates (removes from arm/body etc to the unallocated equipment list) the given mounted.
-
Constructor Details
-
BaConstructionUtil
public BaConstructionUtil()
-
-
Method Details
-
unallocateMounted
Unallocates (removes from arm/body etc to the unallocated equipment list) the given mounted. For special mounts for other equipment (DWP etc), that other equipment is removed from this mount first, emptying the given mounted. This method will unallocate regardless of the type of equipment, i.e., it does not check if this equipment should ever go unallocated (e.g. fixed location equipment). It is therefore up to the caller to select equipment to unallocate.- Parameters:
mounted- The equipment to unallocate
-
isFilledDwp
- Returns:
- True when the given mounted is a Detachable Weapon Pack and it has a weapon allocated to it.
-
isFilledApm
- Returns:
- True when the given mounted is an Anti-Personnel weapon mount (only the misc item, not an armored glove!) and it has a weapon allocated to it.
-
isFilledArmoredGlove
- Returns:
- True when the given mounted is an Armored Glove manipulator and it has an AP weapon allocated to it.
-
emptyDwpApm
Empties the given APM (including armored glove) or DWP, removing any weapon or other equipment attached to it. Can be safely called (does nothing) when there is no equipment on the given mount or the given mount is neither an APM nor DWP (in this case, logs a warning).- Parameters:
mount- The APM/DWP to empty
-
mountOnApm
Mounts the given weapon on the given Anti-Personnel Weapon Mount, which may be either the misc item or an armored glove. Any previously mounted weapon is removed from it, becoming unallocated. Does nothing and logs a warning when the given apm Mounted is not a suitable AP mount or the given weapon may not be mounted on an APM.- Parameters:
weapon- The weapon to mount on the APMapm- The APM to receive the weapon
-