Package megamek.common
Class ArtilleryTracker
java.lang.Object
megamek.common.ArtilleryTracker
- All Implemented Interfaces:
Serializable
ArtilleryTracker - one held by every entity, it holds a list of the artillery weapons an entity controls, and the
mods they get to hit certain hexes.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds new weaponbooleanammoTypeInList(AmmoType.AmmoTypeEnum ammoType) Deprecated, for removal: This API element is subject to removal in a future version.voidRemoves all fire adjustment and auto hit mods and the spotter flags, keeping the tracked weapons.voidRemove all auto hit mods from hexes that were hit previously; used when artillery unit moves.intgetModifier(Mounted<?> weapon, Coords coords) protected ArtilleryModifiergetModifierByCoords(Vector<ArtilleryModifier> modifiers, Coords coords) Search the given vector of modifiers for the modifier which coords equals to the given coordsintgetSize()booleanbooleangetWeaponModifiers(Mounted<?> mounted) voidremoveWeapon(Mounted<?> mounted) Deprecated, for removal: This API element is subject to removal in a future version.voidsetModifier(int modifier, Coords coords) Sets the modifier for artillery weapons on this unit.voidsetSpotterHasCommImplant(boolean hasCommImplant) voidsetSpotterHasForwardObs(boolean forwardObserver) booleanweaponInList(Mounted<?> mounted) Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
ArtilleryTracker
public ArtilleryTracker()Creates new instance of the tracker
-
-
Method Details
-
addWeapon
Adds new weapon- Parameters:
mounted- new weapon
-
removeWeapon
Deprecated, for removal: This API element is subject to removal in a future version.Removes a weapon - needed when capital missile bays change modes- Parameters:
mounted- existing weapon
-
getSize
public int getSize()- Returns:
- the size of the weapons hashtable
-
clearHitHexMods
public void clearHitHexMods()Remove all auto hit mods from hexes that were hit previously; used when artillery unit moves. This _should_ be thread-safe. Only auto hit mods are lost when an artillery unit spends MPs (TO:AR pg. 150) -
clearAllModifiers
public void clearAllModifiers()Removes all fire adjustment and auto hit mods and the spotter flags, keeping the tracked weapons. Used when an entity is carried over into a new game (e.g. by MekHQ), as otherwise the previous game's target hexes remain valid and visible. The weapons must be kept, assetModifier(int, Coords)only adds mods for them. -
weaponInList
Deprecated, for removal: This API element is subject to removal in a future version. -
ammoTypeInList
@Deprecated(since="0.51.0", forRemoval=true) public boolean ammoTypeInList(AmmoType.AmmoTypeEnum ammoType) Deprecated, for removal: This API element is subject to removal in a future version. -
setModifier
Sets the modifier for artillery weapons on this unit. All weapons use the same modifier due to artillery fire adjustment being handled on a per-unit basis. -
getModifier
- Parameters:
weapon- weapon to get modifier for- Returns:
- the modifier for the given weapon
-
getWeaponModifiers
- Parameters:
mounted- weapon to get modifiers for- Returns:
- the
Vectorof the modifiers for the given weapon
-
getModifierByCoords
Search the given vector of modifiers for the modifier which coords equals to the given coords- Parameters:
modifiers-Vectorof the modifiers to processcoords- coordinates of the modifier looked for- Returns:
- modifier with coords equals to the given on
nullif not found
-
getSpotterHasForwardObs
public boolean getSpotterHasForwardObs() -
setSpotterHasForwardObs
public void setSpotterHasForwardObs(boolean forwardObserver) -
getSpotterHasCommImplant
public boolean getSpotterHasCommImplant() -
setSpotterHasCommImplant
public void setSpotterHasCommImplant(boolean hasCommImplant)
-