Record Class AllowedDeploymentHelper

java.lang.Object
java.lang.Record
megamek.common.board.AllowedDeploymentHelper

public record AllowedDeploymentHelper(Entity entity, Coords coords, Board board, Hex hex, Game game) extends Record
  • Constructor Details

    • AllowedDeploymentHelper

      public AllowedDeploymentHelper(Entity entity, Coords coords, Board board, Hex hex, Game game)
      Creates an instance of a AllowedDeploymentHelper record class.
      Parameters:
      entity - the value for the entity record component
      coords - the value for the coords record component
      board - the value for the board record component
      hex - the value for the hex record component
      game - the value for the game record component
  • Method Details

    • findAllowedElevations

      public List<ElevationOption> findAllowedElevations()
      Returns a list of elevations/altitudes that the given entity can deploy to at the given coords. This can be anything from the seafloor, swimming, ice, water surface, ground, up to elevations and altitudes. For VTOLs, elevations up to 10 are always included individually if available. Above that and above all terrain features of the hex, only a single elevation is reported using the ELEVATIONS_ABOVE marker, meaning that any elevation above the reported value is also available. Altitudes are always reported individually (0 to 10).
      Returns:
      All legal deployment elevations/altitudes
    • findAllowedElevations

      public List<ElevationOption> findAllowedElevations(@Nullable DeploymentElevationType limitToType)
      Returns a list of elevations/altitudes that the given entity can deploy to at the given coords that are of the given type. This can be anything from the seafloor, swimming, ice, water surface, ground, up to elevations and altitudes. For VTOLs, elevations up to 10 are always included individually if available. Above that and above all terrain features of the hex, only a single elevation is reported using the ELEVATIONS_ABOVE marker, meaning that any elevation above the reported value is also available. Altitudes are always reported individually (0 to 10).
      Returns:
      All legal deployment elevations/altitudes of the given type
    • findAllowedFacings

      public FacingOption findAllowedFacings(int elevation)
      Returns a FacingOption that indicates which facings are valid for deploying this entity at the given coordinates and elevation. For facing-independent entities (single-hex or symmetrical multi-hex), all facings (0-5) will be valid. For facing-dependent entities (like non-symmetrical BuildingEntity), only facings where all secondary hexes are valid will be included.
      Parameters:
      elevation - The elevation/altitude to check
      Returns:
      FacingOption containing all valid facings, or null if no facings are valid
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • entity

      public Entity entity()
      Returns the value of the entity record component.
      Returns:
      the value of the entity record component
    • coords

      public Coords coords()
      Returns the value of the coords record component.
      Returns:
      the value of the coords record component
    • board

      public Board board()
      Returns the value of the board record component.
      Returns:
      the value of the board record component
    • hex

      public Hex hex()
      Returns the value of the hex record component.
      Returns:
      the value of the hex record component
    • game

      public Game game()
      Returns the value of the game record component.
      Returns:
      the value of the game record component