Package megamek.common.equipment
Class Mounted<T extends EquipmentType>
java.lang.Object
megamek.common.equipment.Mounted<T>
- All Implemented Interfaces:
Serializable,PhaseUpdated,RoundUpdated
- Direct Known Subclasses:
AmmoMounted,MiscMounted,WeaponMounted
public class Mounted<T extends EquipmentType>
extends Object
implements Serializable, RoundUpdated, PhaseUpdated
This describes equipment mounted on a Mek.
- Since:
- April 1, 2002, 1:29 PM
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected intstatic final StringDedicated logger name for equipment activation/deactivation diagnostics ([EquipOff] tag): mode-change reception and application, and rejected deactivations.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final StringInternal name of the sentinel mode reported when equipment has no current or pending mode set.static final StringInternal (non-localized) name of the "switched off" equipment mode.static final StringInternal (non-localized) name of the generic "switched on" equipment mode used by equipment that can be activated and deactivated (activation/deactivation rules): active probes, C3 computers, heat sinks, improved heavy lasers and similar.protected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadaptToGameOptions(IGameOptions options) Fetches all locations that contain this equipment.booleancanFire()Confirm that the given entity can fire the indicated equipment.booleancanFire(boolean isStrafing, boolean evenIfAlreadyFired) booleancanInstantSwitch(int newMode) Can the switch from the current mode to the new mode happen instantly?intCount all the weapon quirks for this Mounted.static Mounted<?> createMounted(Entity entity, EquipmentType type) curMode()Builds a detailed one-line diagnostic of this weapon's Directional Torso Mount state (BMM p.83) for troubleshooting from the log.intintintprotected StringintThe number of shots of ammunition currently stored in this Mounted regardless of its operational status.Gets the charge state of the weapon.doublegetCost()Mounted<?> intreturns the heat for this weapon taking account of rapid-fire weapon statusgetDesc()intintintintintintConvenience method returning the number of shots of ammunition in this Mounted that may be affected by a critical hit.Mounted<?> Mounted<?> intReturns the location this equipment is mounted in, such asTank.LOC_FRONT.protected EquipmentModegetMode(int mode) intgetName()Shortcut to type.getName()intstatic intgetNumShots(WeaponType weaponType, EquipmentMode mode, boolean ignoreMode) Returns how many shots a weapon type would use.intintgetQuirkList(String sep) Returns a string of all the quirk "codes" for this entity, using sep as the separatorRetrieves the quirks object for mounted.intdoublegetSize()Used for equipment that can vary in size.intdoubledoublegetTonnage(RoundWeight defaultRounding) getType()intConvenience method returning the number of shots of ammunition in this Mounted that can actually be used as ammunition.intReturns 1 or 2 if this Mounted has a linked and charged (= set to charge in an earlier turn) PPC Capacitor.intReturns 1 or 2 if this Mounted has a linked and charged (= set to charge in an earlier turn) or charging (= set to charge this turn) PPC Capacitor.booleanbooleanbooleanhasModes()booleanhasModeType(String mode) booleanbooleanbooleanReturns true if this Mounted's EquipmentType is that identified by the given typeInternalName String.booleanReturns false if this ammo should not be loaded.booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanDetermines whether this weapon should be considered crippled for damage level purposes.booleanbooleanbooleanbooleanbooleanbooleanbooleanisFired()booleanbooleanisHit()booleanReturns true if this Mounted is ammunition in homing mode.booleanChecks to see if the current ammo for this weapon is hotLoadedbooleanbooleanReturns true when this Mounted destroyed or located in a blown-off or breached location.booleanConvenience method to determine if a bomb munition is mounted Externally (reduces MP) or Internally (no MP reduction).booleanbooleanisJammed()booleanbooleanbooleanisMissingForTrooper(int trooper) booleanbooleanReturns whether the player has deactivated this equipment.booleanbooleanbooleanChecks whether this mount is either one a one-shot weapon or ammo for a one-shot weapon.booleanbooleanReturns true when this Mounted is not destroyed nor located in a blown-off or breached location.booleanbooleanbooleanbooleanisReady()booleanisReady(boolean isStrafing, boolean evenIfAlreadyFired) booleanbooleanbooleanisSplit()booleanbooleanbooleanbooleanbooleanisTurret()booleanbooleanbooleanvoidvoidnewRound(int roundNumber) booleanvoidresetJam()Clear all jam statuses - used by MHQ, because phase resetting doesn't workvoidrestore()Restores the equipment from the namevoidsetAMSused(boolean usedAMS) voidsetAPMMounted(boolean apmMounted) voidsetArmored(boolean armored) Sets the Mounted to be an armored component, TO:AUE p.95.voidsetArmorValue(int armorValue) voidsetAutocannonHit(boolean acHit) voidsetBaMountLoc(int baMountLoc) voidsetBombMounted(boolean b) voidsetBreached(boolean breached) voidsetByShot(boolean b) voidsetChargeState(ChargeLevel setLevel) Set the charge state of the weapon.voidsetCrossLinked(Mounted<?> linked) voidsetDestroyed(boolean destroyed) Set this Mounted's destroyed status NOTE: only set this if this Mounted cannot be used in the current phase anymore.voidsetDirectionalMountFacing(int facing) Sets the Directional Torso Mount's facing offset (0-5 from the unit's facing).voidsetDirectionalMountLocked(boolean locked) Marks the Directional Torso Mount's rotation mechanism as destroyed, locking the weapon in its current arc.voidsetDirectionalMountRear(boolean rear) Convenience setter for a 2-point Directional Torso Mount: points it to the rear (offset 3) or front (offset 0).voidsetDumping(boolean b) voidsetDWPMounted(boolean dwpMounted) Sets this mounted to be attached to a BA Detachable Weapon Pack, TO:AUE p.99.voidsetFacing(int facing) voidsetFired(boolean val) voidsetFoundCrits(int n) voidsetHit(boolean hit) set that this mounted was or was not hit with a crit this phase Note: stuff that was hit in a phase can still be used in that phase, if that's not desired, use setDestroyed insteadvoidsetHotLoad(boolean hotLoad) Sets the hot loading parameter for this weapons ammo.voidsetInternalBomb(boolean internal) voidsetJammed(boolean j) voidLink this Mounted equipment to the given other equipment (or remove the link, if that other is null).voidsetLocation(int location) voidsetLocation(int location, boolean rearMounted) voidsetMekTurretMounted(boolean turret) voidsetMissing(boolean missing) voidsetMissingForTrooper(int trooper, boolean b) booleansetMode(int newMode) Sets the equipment mode to the mode denoted by the given mode number TODO: Refactor so the equipment knows the phase they can be armed/disarmedintSets the equipment mode to the mode denoted by the given mode nameintsetModeImmediately(String newMode) Sets the equipment mode at once, without the queued switch thatsetMode(String)uses for equipment whose mode changes only take effect at the start of the next round.voidMethod that adds/removes available capital missile modes as we move between space and atmospheric maps Called by Entity.setGameOptions(), which is in turn called during a mode change by server.voidsetModeSwitchable(boolean b) voidsetNWeapons(int i) voidsetOmniPodMounted(boolean omniPodMounted) voidsetOriginalShots(int shots) voidsetPendingDump(boolean b) voidsetPintleTurretMounted(boolean turret) voidsetQuirks(WeaponQuirks quirks) voidsetRapidFire(boolean rapidFire) voidsetRepairable(boolean repair) voidsetSecondLocation(int location) voidsetSecondLocation(int location, boolean rearMounted) voidsetShotsLeft(int shotsLeft) voidsetSize(double size) Sets the size of variable-sized equipment.voidsetSplit(boolean b) voidsetSponsonTurretMounted(boolean turret) voidsetSquadSupportWeapon(boolean squadSupportWeapon) voidsetSwitchedReason(int reason) voidsetTSEMPDowntime(boolean val) protected voidvoidsetUsedThisRound(boolean usedThisRound) voidsetWeaponGroup(boolean b) intintswitchMode(boolean forward) Switches the equipment mode to the next or previous available.toString()
-
Field Details
-
MINE_NONE
public static final int MINE_NONE- See Also:
-
MINE_CONVENTIONAL
public static final int MINE_CONVENTIONAL- See Also:
-
MINE_VIBRABOMB
public static final int MINE_VIBRABOMB- See Also:
-
MINE_ACTIVE
public static final int MINE_ACTIVE- See Also:
-
MINE_INFERNO
public static final int MINE_INFERNO- See Also:
-
MINE_EMP
public static final int MINE_EMP- See Also:
-
MINE_COMMAND_DETONATED
public static final int MINE_COMMAND_DETONATED- See Also:
-
MODE_ON
Internal (non-localized) name of the generic "switched on" equipment mode used by equipment that can be activated and deactivated (activation/deactivation rules): active probes, C3 computers, heat sinks, improved heavy lasers and similar. Mode comparisons (EquipmentMode.equals(String)) always test this internal name; the localized text shown in the GUI comes fromEquipmentMode.getDisplayableName().- See Also:
-
MODE_OFF
Internal (non-localized) name of the "switched off" equipment mode. Equipment in this mode provides none of its game effects until reactivated.- See Also:
-
MODE_NONE
Internal name of the sentinel mode reported when equipment has no current or pending mode set.- See Also:
-
baseDamageAbsorptionRate
protected int baseDamageAbsorptionRate -
baseDamageCapacity
protected int baseDamageCapacity -
damageTaken
protected int damageTaken -
switchedReason
protected int switchedReason -
EQUIP_OFF_DIAGNOSTIC_LOGGER
Dedicated logger name for equipment activation/deactivation diagnostics ([EquipOff] tag): mode-change reception and application, and rejected deactivations. A feature logger rather than a host-class logger so it can be enabled in log4j2.xml without the host classes' debug noise.- See Also:
-
-
Constructor Details
-
Mounted
Creates new Mounted
-
-
Method Details
-
createMounted
-
restore
public void restore()Restores the equipment from the name -
getType
- Returns:
- the equipment type of this mount, or
nullif it cannot be resolved - the mount was restored (from a save or over the network) with an equipment name unknown to this version of MegaMek
-
setType
-
getModesCount
public int getModesCount() -
getMode
-
hasModes
public boolean hasModes() -
hasModeType
-
adaptToGameOptions
-
curMode
- Returns:
- the current mode of the equipment, or
nullif it's not available.
-
isModeTurnedOff
public boolean isModeTurnedOff()Returns whether the player has deactivated this equipment. Equipment that can be switched off (active probes, ECM suites, C3 computers, heat sinks, and similar items with anMODE_OFFmode per the activation/deactivation rules) provides none of its game effects while deactivated, but is otherwise undamaged and can be reactivated.- Returns:
trueif this equipment has modes and its current mode isMODE_OFF
-
modeNextRound
- Returns:
- the mode this equipment will be in next round: the pending mode if a switch is queued, otherwise the current mode
-
isModeTurnedOffNextRound
public boolean isModeTurnedOffNextRound()Returns whether this equipment will be deactivated next round - either a pending switch toMODE_OFF, or alreadyMODE_OFFwith no pending switch away from it. Used to validate declarations that depend on other equipment operating next round (e.g. engaging stealth armor requires an ECM suite that will be running).- Returns:
trueif this equipment has modes and its next-round mode isMODE_OFF
-
pendingMode
- Returns:
- the pending mode of the equipment.
-
switchMode
public int switchMode(boolean forward) Switches the equipment mode to the next or previous available.- Parameters:
forward- Flag that determines whether the mode should be advanced forward or backwards.- Returns:
- new mode number, or
-1if it's not available.
-
switchChargeLevel
public int switchChargeLevel() -
setMode
Sets the equipment mode to the mode denoted by the given mode name- Parameters:
newMode- the name of the desired new mode- Returns:
- new mode number on success,
-1otherwise.
-
setModeImmediately
Sets the equipment mode at once, without the queued switch thatsetMode(String)uses for equipment whose mode changes only take effect at the start of the next round.This is for setting up equipment rather than for changing it in play: loading a unit, or deriving the mode of a built-in system from the game options. In those cases there is no turn boundary for a pending switch to cross, so queueing one would leave the equipment reporting the wrong mode until a round happened to tick over. A mode the player chooses during a game must still go through
setMode(String)so the delay the rules call for is applied.- Parameters:
newMode- the name of the desired new mode- Returns:
- the new mode number on success,
-1if this equipment has no mode of that name
-
setMode
public boolean setMode(int newMode) Sets the equipment mode to the mode denoted by the given mode number TODO: Refactor so the equipment knows the phase they can be armed/disarmed- Parameters:
newMode- the number of the desired new mode
-
canInstantSwitch
public boolean canInstantSwitch(int newMode) Can the switch from the current mode to the new mode happen instantly?- Parameters:
newMode- - integer that represents the new mode- Returns:
- true if the new mode can be switched instantly
-
newRound
public void newRound(int roundNumber) - Specified by:
newRoundin interfaceRoundUpdated
-
newPhase
- Specified by:
newPhasein interfacePhaseUpdated
-
getName
Shortcut to type.getName() -
getShortName
-
getBaseDesc
-
getDesc
-
getTonnage
public double getTonnage()- Returns:
- The weight of the equipment in this mount, using the default rounding method for the
Entity.
-
getTonnage
- Parameters:
defaultRounding- The method to use in rounding the weight- Returns:
- The weight of the equipment in this mount
-
getNumCriticalSlots
public int getNumCriticalSlots() -
getCost
public double getCost()- Returns:
- The cost of the mounted equipment
-
isReady
public boolean isReady() -
isReady
public boolean isReady(boolean isStrafing, boolean evenIfAlreadyFired) -
isUsedThisRound
public boolean isUsedThisRound() -
setUsedThisRound
public void setUsedThisRound(boolean usedThisRound) -
isAMSused
public boolean isAMSused() -
setAMSused
public void setAMSused(boolean usedAMS) -
usedInPhase
-
isBreached
public boolean isBreached() -
setBreached
public void setBreached(boolean breached) -
isDestroyed
public boolean isDestroyed() -
setDestroyed
public void setDestroyed(boolean destroyed) Set this Mounted's destroyed status NOTE: only set this if this Mounted cannot be used in the current phase anymore. If it still can, use setHit instead- Parameters:
destroyed- set this object as destroyed- See Also:
-
isOperable
public boolean isOperable()Returns true when this Mounted is not destroyed nor located in a blown-off or breached location. Does not check any other conditions such as DWP mounting or prior use. Also does not check if this mounted has been hit in this phase. This is equivalent to !isInoperable().- Returns:
- True when this Mounted is operable
-
isInoperable
public boolean isInoperable()Returns true when this Mounted destroyed or located in a blown-off or breached location. Does not check any other conditions such as DWP mounting or prior use. Also does not check if this mounted has been hit in this phase. Equivalent to !isOperable().- Returns:
- True when this Mounted is operable
-
is
Returns true if this Mounted's EquipmentType is that identified by the given typeInternalName String. The given typeInternalName is compared to the internal name of the EquipmentType of this Mounted, not the (display) name! Best use the constants defined in EquipmentTypeLookup.- Parameters:
typeInternalName- An Equipment internal name to check- Returns:
- true if the internalName of this equipment matches the given type
-
isHit
public boolean isHit() -
setHit
public void setHit(boolean hit) set that this mounted was or was not hit with a crit this phase Note: stuff that was hit in a phase can still be used in that phase, if that's not desired, use setDestroyed instead- Parameters:
hit- sets the object as hit- See Also:
-
isMissing
public boolean isMissing() -
setMissing
public void setMissing(boolean missing) -
isJammed
public boolean isJammed() -
setJammed
public void setJammed(boolean j) -
jammedThisPhase
public boolean jammedThisPhase() -
resetJam
public void resetJam()Clear all jam statuses - used by MHQ, because phase resetting doesn't work -
getBaseShotsLeft
public int getBaseShotsLeft()The number of shots of ammunition currently stored in this Mounted regardless of its operational status. Or in other words, the straight value last set bysetShotsLeft(int), even if this ammo slot is no longer functional or indeed notionally no longer part of the unit formerly carrying it. This is the 'general' base value that should be used for display, reporting, entity encoding and salvage purposes.- Returns:
- The base 'true' number of shots in this slot.
- See Also:
-
getHittableShotsLeft
public int getHittableShotsLeft()Convenience method returning the number of shots of ammunition in this Mounted that may be affected by a critical hit. This method returns 0 if this Mounted is marked as destroyed or missing and the same value asgetBaseShotsLeft()otherwise.- Returns:
- The number of 'hittable' shots in this slot.
- See Also:
-
getUsableShotsLeft
public int getUsableShotsLeft()Convenience method returning the number of shots of ammunition in this Mounted that can actually be used as ammunition. This method returns 0 if this Mounted is marked as destroyed, missing, or breached and thus nonfunctional and the same value asgetBaseShotsLeft()otherwise.- Returns:
- The number of usable shots in this slot.
- See Also:
-
hasUsableShotsLeft
public boolean hasUsableShotsLeft()- Returns:
- True when this ammunition Mounted has shots left and is operable.
- See Also:
-
setShotsLeft
public void setShotsLeft(int shotsLeft) -
getNumShots
Returns how many shots a weapon type would use. This can be used without an instantiation of Mounted, which is useful for computing Aero heat. If ignoreMode is true, then mode can be null. -
isPendingDump
public boolean isPendingDump() -
setPendingDump
public void setPendingDump(boolean b) -
isDumping
public boolean isDumping() -
setDumping
public void setDumping(boolean b) -
getSize
public double getSize()Used for equipment that can vary in size. This is not used for equipment for which size is computed by outside factors such as unit weight or targeting computer-linked weapons, but for equipment that comes in various weights, lengths, or capacities. The meaning of the size varies according to the equipment. For robotic control systems, this is the number of drones that can be controlled. For ladders this is the length in meters. For most other variable equipment this is the weight in tons. Non-variable equipment should return 1.0.- Returns:
- The size of the mounted equipment
-
setSize
public void setSize(double size) Sets the size of variable-sized equipment.- Parameters:
size- of the equipment- See Also:
-
isRapidFire
public boolean isRapidFire() -
setRapidFire
public void setRapidFire(boolean rapidFire) -
isHotLoaded
public boolean isHotLoaded()Checks to see if the current ammo for this weapon is hotLoaded- Returns:
trueif ammo is hotLoaded orfalseif not
-
setHotLoad
public void setHotLoad(boolean hotLoad) Sets the hot loading parameter for this weapons ammo.- Parameters:
hotLoad- set the ammo loaded as hotLoaded or not
-
hasChargedCapacitor
public int hasChargedCapacitor()Returns 1 or 2 if this Mounted has a linked and charged (= set to charge in an earlier turn) PPC Capacitor. -
hasChargedOrChargingCapacitor
public int hasChargedOrChargingCapacitor()Returns 1 or 2 if this Mounted has a linked and charged (= set to charge in an earlier turn) or charging (= set to charge this turn) PPC Capacitor. Used to determine heat. -
getLocation
public int getLocation()Returns the location this equipment is mounted in, such asTank.LOC_FRONT. May also returnEntity.LOC_NONEfor unallocated equipment and some special equipment. For BattleArmor, will return one of the trooper locations, such asBattleArmor.LOC_TROOPER_1. To get the equipment location on BA, usegetBaMountLoc().- Returns:
- The location of this equipment on its unit
-
getSecondLocation
public int getSecondLocation() -
isRearMounted
public boolean isRearMounted() -
setLocation
public void setLocation(int location) -
setSecondLocation
public void setSecondLocation(int location) -
setLocation
public void setLocation(int location, boolean rearMounted) -
setSecondLocation
public void setSecondLocation(int location, boolean rearMounted) -
allLocations
Fetches all locations that contain this equipment. This is primarily for spreadable equipment, can be placed in locations other than the primary or secondary, but will also work for non-spreadable equipment.- Returns:
- A list of indices for all locations that contain this equipment.
- See Also:
-
getLinked
-
getLinkedBy
-
getCrossLinkedBy
-
setLinked
Link this Mounted equipment to the given other equipment (or remove the link, if that other is null). When the other is not null, that equipment's linkedBy is set to the present Mounted. Typically, weapons link to their ammo; mounts (turrets, DWP etc) link to attached weapons. The other direction uses linkedBy.- Parameters:
linked- The equipment to link to- See Also:
-
setCrossLinked
-
getFoundCrits
public int getFoundCrits() -
setFoundCrits
public void setFoundCrits(int n) -
isSplit
public boolean isSplit() -
isSplitable
public boolean isSplitable() -
setSplit
public void setSplit(boolean b) -
getExplosionDamage
public int getExplosionDamage() -
isFired
public boolean isFired() -
setFired
public void setFired(boolean val) -
isTSEMPDowntime
public boolean isTSEMPDowntime() -
setTSEMPDowntime
public void setTSEMPDowntime(boolean val) -
canFire
public boolean canFire()Confirm that the given entity can fire the indicated equipment.- Returns:
trueif the equipment can be fired by the entity;falseotherwise.
-
canFire
public boolean canFire(boolean isStrafing, boolean evenIfAlreadyFired) -
isCrippled
public boolean isCrippled()Determines whether this weapon should be considered crippled for damage level purposes.- Returns:
trueif the weapon is at least one of: destroyed, missing, breached, jammed, a detachable weapon no longer attached to its original battle armor, or simply out of ammo (includes discharged one-shot weapons),falseotherwise. A weapon bay is crippled only when every weapon it contains is crippled.
-
getEquipmentNum
public int getEquipmentNum()- Returns:
- The index of this mount in the entity's equipment list.
-
isAmmoUsable
public boolean isAmmoUsable()Returns false if this ammo should not be loaded. Checks if the ammo is already destroyed or missing, is being dumped, has been breached, is already used up, or is location less (one shot ammo). -
setByShot
public void setByShot(boolean b) -
isBombMounted
public boolean isBombMounted() -
setBombMounted
public void setBombMounted(boolean b) -
isGroundBomb
public boolean isGroundBomb()- Returns:
- True if this Mounted is a bomb capable of striking ground targets.
-
setInternalBomb
public void setInternalBomb(boolean internal) -
isInternalBomb
public boolean isInternalBomb()Convenience method to determine if a bomb munition is mounted Externally (reduces MP) or Internally (no MP reduction).- Returns:
- True if
-
getCurrentHeat
public int getCurrentHeat()returns the heat for this weapon taking account of rapid-fire weapon status -
isBodyMounted
public boolean isBodyMounted() -
isDWPMounted
public boolean isDWPMounted()- Returns:
- True if this equipment is mounted on a BA Detachable Weapon Pack, TO:AUE p.99. Note that when it is, the BA mount location (arm, body etc) is set to LOC_NONE. The location must be found via the DWP. The DWP can be obtained using getLinkedBy.
-
setDWPMounted
public void setDWPMounted(boolean dwpMounted) Sets this mounted to be attached to a BA Detachable Weapon Pack, TO:AUE p.99. Note that when it is, the BA mount location (arm, body etc) must not be set or this equipment will also register as being normally allocated in that location (visible in MML). The location must be found via the DWP. The DWP should be set as linkedBy for this Mounted, and the DWP itself should have this mounted set as linked.- Parameters:
dwpMounted- True if this equipment is mounted in a DWP
-
isAPMMounted
public boolean isAPMMounted() -
setAPMMounted
public void setAPMMounted(boolean apmMounted) -
isOmniPodMounted
public boolean isOmniPodMounted() -
setOmniPodMounted
public void setOmniPodMounted(boolean omniPodMounted) -
isWeaponGroup
public boolean isWeaponGroup() -
setWeaponGroup
public void setWeaponGroup(boolean b) -
getNWeapons
public int getNWeapons() -
setNWeapons
public void setNWeapons(int i) -
setArmored
public void setArmored(boolean armored) Sets the Mounted to be an armored component, TO:AUE p.95. This method checks if the EquipmentType allows armoring at all and sets the armored status to false if it doesn't.- Parameters:
armored- The armored status to be set
-
isArmored
public boolean isArmored()- Returns:
- True if this Mounted is an armored component, TO:AUE p.95
-
setQuirks
-
getQuirks
Retrieves the quirks object for mounted. DO NOT USE this to check boolean options, as it will not check game options for quirks. Use Mounted#hasQuirk instead- Returns:
- the list of quirks
-
hasQuirk
-
countQuirks
public int countQuirks()Count all the weapon quirks for this Mounted. Returns 0 when this Mounted is tied to an Entity and this Entity's game does not use quirks! In all other cases (e.g. outside of games), returns the quirk count of this Mounted.- Returns:
- The number of active weapon quirks for this Mounted unless the game does not use quirks
-
getQuirkList
Returns a string of all the quirk "codes" for this entity, using sep as the separator -
getCalledShot
-
setRepairable
public void setRepairable(boolean repair) -
isRepairable
public boolean isRepairable() -
setAutocannonHit
public void setAutocannonHit(boolean acHit) -
isAutocannonHit
public boolean isAutocannonHit() -
getEntity
-
isMekTurretMounted
public boolean isMekTurretMounted() -
setMekTurretMounted
public void setMekTurretMounted(boolean turret) -
setSponsonTurretMounted
public void setSponsonTurretMounted(boolean turret) -
isSponsonTurretMounted
public boolean isSponsonTurretMounted() -
setPintleTurretMounted
public void setPintleTurretMounted(boolean turret) -
isPintleTurretMounted
public boolean isPintleTurretMounted() -
setFacing
public void setFacing(int facing) -
getFacing
public int getFacing() -
hasDirectionalTorsoMount
public boolean hasDirectionalTorsoMount()- Returns:
trueif this weapon is in a Directional Torso Mount of either type (the 2-point front/rear version or the 3-point quad 360-degree version), per BMM p.83. This is true when the weapon carries a Directional Torso Mount weapon quirk directly, or when its unit carries the chassis-widedirectional_torso_mountquirk and this weapon is in its scope (seeisInUnitTorsoMountSet(String)). A weapon that is physically split across two locations can never ride the single-location mount, regardless of quirk source. Respects the quirks game option (seehasQuirk(String)).
-
hasDirectional360TorsoMount
public boolean hasDirectional360TorsoMount()- Returns:
trueif this weapon is in the 3-point Directional Torso Mount, which operates as a full 360-degree turret. This version is available only to quad Meks (BMM p.83) - enforced here as well as during construction so the 360-degree arc can never be granted to a biped. It is in effect when the weapon carries the 360 weapon quirk, or its unit's 360 chassis quirk lists this weapon's location.
-
directionalMountDebug
Builds a detailed one-line diagnostic of this weapon's Directional Torso Mount state (BMM p.83) for troubleshooting from the log. Reports every quirk source and the computed flags, so a playtest log can show why a weapon is (or is not) a flippable directional mount. Intended for log statements only, not the hot path.- Returns:
- a human-readable description of the mount's quirk sources, flags and computed arc state
-
getDirectionalMountFacing
public int getDirectionalMountFacing()- Returns:
- the Directional Torso Mount's current facing, as an offset (0-5) from the unit's (secondary) facing: 0 = forward, 3 = rear (BMM p.83). The 2-point version uses only 0 or 3; the 3-point quad turret may use any of the six. Persists across rounds (unlike a torso twist).
-
setDirectionalMountFacing
public void setDirectionalMountFacing(int facing) Sets the Directional Torso Mount's facing offset (0-5 from the unit's facing). Has no effect once the mount is locked (seeisDirectionalMountLocked()) or once its facing was already changed in an earlier attack phase this turn (seeisDirectionalMountAlreadyFlipped()- the once-per-turn rule, modeled on torso twists). The caller is responsible for restricting the value to the legal facings for the mount type (front/rear for 2-point, any for the 3-point quad turret).- Parameters:
facing- the facing offset; normalized into the range 0-5
-
isDirectionalMountAlreadyFlipped
public boolean isDirectionalMountAlreadyFlipped()- Returns:
trueif this Directional Torso Mount's facing was already changed in an earlier phase of the current turn. A mount's facing may be changed only once per turn - at the same time torso twists are made (BMM p.83) - so a mount flipped in the targeting/TAG phase cannot flip again in the weapon attack phase. Within the phase it was changed in, the facing remains freely adjustable (like a torso twist). Cleared at the start of each round.
-
isDirectionalMountRear
public boolean isDirectionalMountRear()- Returns:
trueif this weapon's Directional Torso Mount currently points to the rear arc (facing offset 3). Convenience for the 2-point front/rear case.
-
setDirectionalMountRear
public void setDirectionalMountRear(boolean rear) Convenience setter for a 2-point Directional Torso Mount: points it to the rear (offset 3) or front (offset 0).- Parameters:
rear-trueto point the mount to the rear arc,falsefor the front arc
-
isDirectionalMountLocked
public boolean isDirectionalMountLocked()- Returns:
trueif the Directional Torso Mount's rotation mechanism has been destroyed (2D6 9+ on a hit to its location, BMM p.83). The weapon still fires, but its arc can no longer be changed.
-
setDirectionalMountLocked
public void setDirectionalMountLocked(boolean locked) Marks the Directional Torso Mount's rotation mechanism as destroyed, locking the weapon in its current arc. The weapon remains able to fire.- Parameters:
locked-trueto lock the mount in its current arc
-
getOriginalShots
public int getOriginalShots() -
setOriginalShots
public void setOriginalShots(int shots) -
isModeSwitchable
public boolean isModeSwitchable() -
setModeSwitchable
public void setModeSwitchable(boolean b) -
isInBearingsOnlyMode
public boolean isInBearingsOnlyMode()- Returns:
- True if our capital missile bay is in bearings-only mode Only available in space games
-
isInWaypointLaunchMode
public boolean isInWaypointLaunchMode()- Returns:
- True if our capital missile bay is in waypoint launch mode Only available in space games
-
setModesForMapType
public void setModesForMapType()Method that adds/removes available capital missile modes as we move between space and atmospheric maps Called by Entity.setGameOptions(), which is in turn called during a mode change by server. -
getBaMountLoc
public int getBaMountLoc()- Returns:
- For BattleArmor, returns the location where a piece of equipment is mounted, e.g.
BattleArmor.MOUNT_LOC_LEFT_ARM.
-
setBaMountLoc
public void setBaMountLoc(int baMountLoc) -
isOneShot
public boolean isOneShot()Checks whether this mount is either one a one-shot weapon or ammo for a one-shot weapon.- Returns:
- Whether the equipment is one-shot
-
isOneShotAmmo
public boolean isOneShotAmmo() -
isSquadSupportWeapon
public boolean isSquadSupportWeapon() -
setSquadSupportWeapon
public void setSquadSupportWeapon(boolean squadSupportWeapon) -
getArmorValue
public int getArmorValue() -
setArmorValue
public void setArmorValue(int armorValue) -
setMissingForTrooper
public void setMissingForTrooper(int trooper, boolean b) -
isMissingForTrooper
public boolean isMissingForTrooper(int trooper) -
isAnyMissingTroopers
public boolean isAnyMissingTroopers() -
getMissingTrooperString
-
isHomingAmmoInHomingMode
public boolean isHomingAmmoInHomingMode()Returns true if this Mounted is ammunition in homing mode. -
equipmentIndex
public int equipmentIndex() -
getSwitchedReason
public int getSwitchedReason() -
setSwitchedReason
public void setSwitchedReason(int reason) -
bayComponentsToString
-
isTurret
public boolean isTurret()- Returns:
- True when this Mounted is a head, quad, shoulder, pintle or sponson turret.
-
toString
-
relevantToTargetingComputer
public boolean relevantToTargetingComputer()- Returns:
- True if this equipment counts for the size and weight of a Targeting Computer, and benefits from it in case of weapons.
- See Also:
-
getChargeState
Gets the charge state of the weapon. This only currently applies to Bombast Lasers- Returns:
-
setChargeState
Set the charge state of the weapon. This only currently applies to the Bombast Laser- Parameters:
setLevel-
-