Class UnlockableContent

All Implemented Interfaces:
Comparable<Content>
Direct Known Subclasses:
Block, Item, Liquid, Planet, SectorPreset, StatusEffect, TeamEntry, UnitType, Weather

public abstract class UnlockableContent extends MappableContent
Base interface for an unlockable content type.
  • Field Details

    • stats

      public Stats stats
      Stat storage for this content. Initialized on demand.
    • localizedName

      public String localizedName
      Localized, formal name. Never null. Set to internal name if not found in bundle.
    • description

      @Nullable public String description
      Localized description & details. May be null.
    • details

      @Nullable public String details
      Localized description & details. May be null.
    • alwaysUnlocked

      public boolean alwaysUnlocked
      Whether this content is always unlocked in the tech tree.
    • inlineDescription

      public boolean inlineDescription
      Whether to show the description in the research dialog preview.
    • hideDetails

      public boolean hideDetails
      Whether details of blocks are hidden in custom games if they haven't been unlocked in campaign mode.
    • generateIcons

      public boolean generateIcons
      If false, all icon generation is disabled for this content; createIcons is not called.
    • iconId

      public int iconId
      Special logic icon ID.
    • selectionSize

      public float selectionSize
      How big the content appears in certain selection menus
    • uiIcon

      public TextureRegion uiIcon
      Icon of the content to use in UI.
    • fullIcon

      public TextureRegion fullIcon
      Icon of the full content. Unscaled.
    • techNode

      @Nullable public TechTree.TechNode techNode
      The tech tree node for this content, if applicable. Null if not part of a tech tree.
    • techNodes

      public Seq<TechTree.TechNode> techNodes
      Tech nodes for all trees that this content is part of.
    • unlocked

      protected boolean unlocked
      Unlock state. Loaded from settings. Do not modify outside of the constructor.
  • Constructor Details

    • UnlockableContent

      public UnlockableContent(String name)
  • Method Details

    • loadIcon

      public void loadIcon()
      Description copied from class: Content
      Called right before load().
      Overrides:
      loadIcon in class Content
    • getLogicId

      public int getLogicId()
    • displayDescription

      public String displayDescription()
    • checkStats

      public void checkStats()
      Checks stat initialization state. Call before displaying stats.
    • setStats

      public void setStats()
      Initializes stats on demand. Should only be called once. Only called before something is displayed.
    • displayExtra

      public void displayExtra(Table table)
      Display any extra info after details.
    • createIcons

      public void createIcons(MultiPacker packer)
      Generate any special icons for this content. Called synchronously. No regions are loaded at this point; grab pixmaps from the packer.
    • makeOutline

      protected void makeOutline(MultiPacker.PageType page, MultiPacker packer, TextureRegion region, boolean makeNew, Color outlineColor, int outlineRadius)
    • makeOutline

      protected void makeOutline(MultiPacker packer, TextureRegion region, String name, Color outlineColor, int outlineRadius)
    • makeOutline

      protected void makeOutline(MultiPacker packer, TextureRegion region, String name, Color outlineColor)
    • researchRequirements

      public ItemStack[] researchRequirements()
      Returns:
      items needed to research this content
    • emoji

      public String emoji()
    • hasEmoji

      public boolean hasEmoji()
    • getDependencies

      public void getDependencies(Cons<UnlockableContent> cons)
      Iterates through any implicit dependencies of this content. For blocks, this would be the items required to build it.
    • onUnlock

      public void onUnlock()
      Called when this content is unlocked. Use this to unlock other related content.
    • isHidden

      public boolean isHidden()
      Whether this content is always hidden in the content database dialog.
    • showUnlock

      public boolean showUnlock()
      Returns:
      whether to show a notification toast when this is unlocked
    • logicVisible

      public boolean logicVisible()
    • unlock

      public void unlock()
      Makes this piece of content unlocked; if it already unlocked, nothing happens.
    • quietUnlock

      public void quietUnlock()
      Unlocks this content, but does not fire any events.
    • unlockedNowHost

      public boolean unlockedNowHost()
    • unlocked

      public boolean unlocked()
    • clearUnlock

      public void clearUnlock()
      Locks this content again.
    • unlockedNow

      public boolean unlockedNow()
      Returns:
      whether this content is unlocked, or the player is in a custom (non-campaign) game.
    • locked

      public boolean locked()