Record Class QuirkPlaceholder

java.lang.Object
java.lang.Record
megamek.common.options.QuirkPlaceholder
Record Components:
key - a stable lower_snake_case key, chosen to match the natural option name a future implementation would use
groupKey - the quirk group the placeholder belongs in, either Quirks.POS_QUIRKS or Quirks.NEG_QUIRKS; the UI lists it in that column
rulesBook - the abbreviated rule book the quirk is printed in (e.g. "CO")
rulesPage - the page in that book, as printed

public record QuirkPlaceholder(String key, String groupKey, String rulesBook, String rulesPage) extends Record
A quirk that exists in the rule books but has no MegaMek option at all.

Unlike a QuirkCatalogEntry, a placeholder has no IOption behind it: it cannot be set on a unit, never serializes into a saved game or MUL file, and never reaches MekHQ. It exists so the quirks UI can list the book quirk as a grayed-out, searchable row - telling the player the quirk is missing rather than leaving them to wonder where it went.

Keeping placeholders out of Quirks and WeaponQuirks is what makes them free of side effects. Do not "promote" one by adding it here and to the option list; when a quirk is implemented, delete its placeholder and give the new option a .working resource entry instead.

  • Constructor Details

    • QuirkPlaceholder

      public QuirkPlaceholder(String key, String groupKey, String rulesBook, String rulesPage)
      Creates an instance of a QuirkPlaceholder record class.
      Parameters:
      key - the value for the key record component
      groupKey - the value for the groupKey record component
      rulesBook - the value for the rulesBook record component
      rulesPage - the value for the rulesPage record component
  • Method Details

    • getDisplayableName

      public String getDisplayableName()
      Returns:
      the localized display name of the missing quirk
    • getDescription

      public String getDescription()
      Returns:
      the localized one-line summary of the quirk's book effect
    • getRulesReference

      public String getRulesReference()
      Returns:
      the localized "Book p.Page" citation for this quirk
    • 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.
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • groupKey

      public String groupKey()
      Returns the value of the groupKey record component.
      Returns:
      the value of the groupKey record component
    • rulesBook

      public String rulesBook()
      Returns the value of the rulesBook record component.
      Returns:
      the value of the rulesBook record component
    • rulesPage

      public String rulesPage()
      Returns the value of the rulesPage record component.
      Returns:
      the value of the rulesPage record component