Package megamek.common.equipment
Class GroundObject
java.lang.Object
megamek.common.equipment.GroundObject
- All Implemented Interfaces:
Serializable,ICarryable,InGameObject,BTObject
Abstract class for objects that can be placed on the ground but are not entities.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface megamek.common.equipment.ICarryable
ICarryable.CarriedObjectDamageAllocation -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandamage(double amount) Damages this carryable object by the given amount of damage.Returns the general name or type name of this unit/object.intgetId()Returns this InGameObject's id.intReturns the unique id of this InGameObject's owning player.intReturns the current (remaining) battle strength of this unit or object.doublebooleanReturns true if this carryable object should never take damage nor be destroyed, false otherwise.voidprocessPickupStep(MoveStep step, Integer cargoPickupLocation, TWGameManager gameManager, Entity entityPickingUpTarget, EntityMovementType overallMoveType) voidsetId(int newId) Sets this InGameObject's id.voidsetInvulnerable(boolean value) voidvoidsetOwnerId(int newOwnerId) Sets the unique id of this InGameObject's owning player.voidsetTonnage(double value) Returns the specific name or type name of this unit/object.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface megamek.common.units.BTObject
getFluffImage, getIcon, hasAerodyneSpheroidDistinction, isAero, isAerodyne, isAerospace, isAerospaceFighter, isAerospaceSV, isBattleArmor, isBattlefieldSupportAsset, isBattleMek, isCombatVehicle, isConventionalFighter, isConventionalInfantry, isDropShip, isFighter, isFixedWingSupport, isGround, isHandheldWeapon, isIndustrialMek, isInfantry, isJumpShip, isLargeAerospace, isMek, isObjectiveMarker, isProtoMek, isQuadMek, isSingleUnit, isSmallCraft, isSpaceStation, isSpheroid, isSupportVehicle, isTripodMek, isUnitGroup, isVehicle, isWarShipMethods inherited from interface megamek.common.equipment.ICarryable
canBePickedUp, isCarryableObject, targetForArmHitToHitCarriedObjectMethods inherited from interface megamek.common.game.InGameObject
countForStrengthSum, hasOwner
-
Constructor Details
-
GroundObject
public GroundObject()
-
-
Method Details
-
damage
public boolean damage(double amount) Description copied from interface:ICarryableDamages this carryable object by the given amount of damage. Returns true if the cargo is considered destroyed by applying the damage. Note: This method does *not* check if the object is invulnerable; it is up to the caller to do that. Calling this method on an invulnerable carryable object behaves exactly like calling it on a vulnerable one.- Specified by:
damagein interfaceICarryable- Parameters:
amount- The damage- Returns:
- True if the cargo is destroyed by the damage, false otherwise
- See Also:
-
setTonnage
public void setTonnage(double value) -
getTonnage
public double getTonnage()- Specified by:
getTonnagein interfaceICarryable- Returns:
- The weight of the carryable object in units of tons.
-
isInvulnerable
public boolean isInvulnerable()Description copied from interface:ICarryableReturns true if this carryable object should never take damage nor be destroyed, false otherwise. Note that the carryable object does *not* itself enforce this; it is up to the caller ofICarryable.damage(double)to test it.- Specified by:
isInvulnerablein interfaceICarryable- Returns:
- True if this carryable object cannot be damaged
-
setInvulnerable
public void setInvulnerable(boolean value) -
setName
-
generalName
Description copied from interface:BTObjectReturns the general name or type name of this unit/object. For standard individual units, this is the chassis. For other types of units or objects this can be the full designation or a general part of the designation. Much like the chassis, this can be much more narrow than the general type of unit ("Mek").The general name should not be empty and not return null. Return the chassis in Entity and AlphaStrikeElement.
- Specified by:
generalNamein interfaceBTObject- Returns:
- The general name / chassis
-
specificName
Description copied from interface:BTObjectReturns the specific name or type name of this unit/object. For standard individual units, this is the model. For other types of units or objects this can be a part of the designation, or empty.The specific name should not return null. Return the model in Entity and AlphaStrikeElement.
- Specified by:
specificNamein interfaceBTObject- Returns:
- The specific name / model
-
toString
-
getId
public int getId()Description copied from interface:InGameObjectReturns this InGameObject's id. The id must be unique to this InGameObject within the current game. equals() must return true for two InGameObject objects with the same id.- Specified by:
getIdin interfaceInGameObject- Returns:
- The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
-
setId
public void setId(int newId) Description copied from interface:InGameObjectSets this InGameObject's id. The id must be unique to this InGameObject within the current game. equals() must return true for two InGameObject objects with the same id.- Specified by:
setIdin interfaceInGameObject- Parameters:
newId- The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
-
getOwnerId
public int getOwnerId()Description copied from interface:InGameObjectReturns the unique id of this InGameObject's owning player. This id may be Player.NONE.- Specified by:
getOwnerIdin interfaceInGameObject- Returns:
- The player id of the owner of this InGameObject.
-
setOwnerId
public void setOwnerId(int newOwnerId) Description copied from interface:InGameObjectSets the unique id of this InGameObject's owning player. This id may be Player.NONE.- Specified by:
setOwnerIdin interfaceInGameObject- Parameters:
newOwnerId- The player id of the owner of this InGameObject.
-
getStrength
public int getStrength()Description copied from interface:InGameObjectReturns the current (remaining) battle strength of this unit or object. For combat units, this is the battle value (BV) or the point value (PV).- Specified by:
getStrengthin interfaceInGameObject- Returns:
- The current battle strength (BV/PV)
-
getCarriedObjectDamageAllocation
- Specified by:
getCarriedObjectDamageAllocationin interfaceICarryable
-
processPickupStep
public void processPickupStep(MoveStep step, Integer cargoPickupLocation, TWGameManager gameManager, Entity entityPickingUpTarget, EntityMovementType overallMoveType) - Specified by:
processPickupStepin interfaceICarryable
-