Class GroundObject

java.lang.Object
megamek.common.equipment.GroundObject
All Implemented Interfaces:
Serializable, ICarryable, InGameObject, BTObject
Direct Known Subclasses:
Briefcase, Cargo

public abstract class GroundObject extends Object implements ICarryable, Serializable
Abstract class for objects that can be placed on the ground but are not entities.
See Also:
  • Constructor Details

    • GroundObject

      public GroundObject()
  • Method Details

    • damage

      public boolean damage(double amount)
      Description copied from interface: ICarryable
      Damages 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:
      damage in interface ICarryable
      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:
      getTonnage in interface ICarryable
      Returns:
      The weight of the carryable object in units of tons.
    • isInvulnerable

      public boolean isInvulnerable()
      Description copied from interface: ICarryable
      Returns 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 of ICarryable.damage(double) to test it.
      Specified by:
      isInvulnerable in interface ICarryable
      Returns:
      True if this carryable object cannot be damaged
    • setInvulnerable

      public void setInvulnerable(boolean value)
    • setName

      public void setName(String value)
    • generalName

      public String generalName()
      Description copied from interface: BTObject
      Returns 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:
      generalName in interface BTObject
      Returns:
      The general name / chassis
    • specificName

      public String specificName()
      Description copied from interface: BTObject
      Returns 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:
      specificName in interface BTObject
      Returns:
      The specific name / model
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getId

      public int getId()
      Description copied from interface: InGameObject
      Returns 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:
      getId in interface InGameObject
      Returns:
      The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
    • setId

      public void setId(int newId)
      Description copied from interface: InGameObject
      Sets 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:
      setId in interface InGameObject
      Parameters:
      newId - The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
    • getOwnerId

      public int getOwnerId()
      Description copied from interface: InGameObject
      Returns the unique id of this InGameObject's owning player. This id may be Player.NONE.
      Specified by:
      getOwnerId in interface InGameObject
      Returns:
      The player id of the owner of this InGameObject.
    • setOwnerId

      public void setOwnerId(int newOwnerId)
      Description copied from interface: InGameObject
      Sets the unique id of this InGameObject's owning player. This id may be Player.NONE.
      Specified by:
      setOwnerId in interface InGameObject
      Parameters:
      newOwnerId - The player id of the owner of this InGameObject.
    • getStrength

      public int getStrength()
      Description copied from interface: InGameObject
      Returns 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:
      getStrength in interface InGameObject
      Returns:
      The current battle strength (BV/PV)
    • getCarriedObjectDamageAllocation

      public ICarryable.CarriedObjectDamageAllocation getCarriedObjectDamageAllocation()
      Specified by:
      getCarriedObjectDamageAllocation in interface ICarryable
    • processPickupStep

      public void processPickupStep(MoveStep step, Integer cargoPickupLocation, TWGameManager gameManager, Entity entityPickingUpTarget, EntityMovementType overallMoveType)
      Specified by:
      processPickupStep in interface ICarryable