Package mindustry.ctype
Class UnlockableContent
java.lang.Object
mindustry.ctype.Content
mindustry.ctype.MappableContent
mindustry.ctype.UnlockableContent
- All Implemented Interfaces:
Comparable<Content>
- Direct Known Subclasses:
Block
,Item
,Liquid
,Planet
,SectorPreset
,StatusEffect
,TeamEntry
,UnitType
,Weather
Base interface for an unlockable content type.
-
Nested Class Summary
Nested classes/interfaces inherited from class mindustry.ctype.Content
Content.ModContentInfo
-
Field Summary
Modifier and TypeFieldDescriptionboolean
Whether this content is always unlocked in the tech tree.Localized description & details.Localized description & details.Icon of the full content.boolean
If false, all icon generation is disabled for this content; createIcons is not called.boolean
Whether details of blocks are hidden in custom games if they haven't been unlocked in campaign mode.int
Special logic icon ID.boolean
Whether to show the description in the research dialog preview.Localized, formal name.float
How big the content appears in certain selection menusStat storage for this content.The tech tree node for this content, if applicable.Tech nodes for all trees that this content is part of.Icon of the content to use in UI.protected boolean
Unlock state.Fields inherited from class mindustry.ctype.MappableContent
name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks stat initialization state.void
Locks this content again.void
createIcons
(MultiPacker packer) Generate any special icons for this content.void
displayExtra
(Table table) Display any extra info after details.emoji()
void
getDependencies
(Cons<UnlockableContent> cons) Iterates through any implicit dependencies of this content.int
boolean
hasEmoji()
boolean
isHidden()
Whether this content is always hidden in the content database dialog.void
loadIcon()
Called right before load().boolean
locked()
boolean
protected void
makeOutline
(MultiPacker.PageType page, MultiPacker packer, TextureRegion region, boolean makeNew, Color outlineColor, int outlineRadius) protected void
makeOutline
(MultiPacker packer, TextureRegion region, String name, Color outlineColor) protected void
makeOutline
(MultiPacker packer, TextureRegion region, String name, Color outlineColor, int outlineRadius) void
onUnlock()
Called when this content is unlocked.void
Unlocks this content, but does not fire any events.void
setStats()
Initializes stats on demand.boolean
void
unlock()
Makes this piece of content unlocked; if it already unlocked, nothing happens.boolean
unlocked()
boolean
boolean
Methods inherited from class mindustry.ctype.MappableContent
toString
Methods inherited from class mindustry.ctype.Content
compareTo, getContentType, hasErrored, init, isModded, isVanilla, load
-
Field Details
-
stats
Stat storage for this content. Initialized on demand. -
localizedName
Localized, formal name. Never null. Set to internal name if not found in bundle. -
description
Localized description & details. May be null. -
details
Localized description & details. May be null. -
alwaysUnlocked
public boolean alwaysUnlockedWhether this content is always unlocked in the tech tree. -
inlineDescription
public boolean inlineDescriptionWhether to show the description in the research dialog preview. -
hideDetails
public boolean hideDetailsWhether details of blocks are hidden in custom games if they haven't been unlocked in campaign mode. -
generateIcons
public boolean generateIconsIf false, all icon generation is disabled for this content; createIcons is not called. -
iconId
public int iconIdSpecial logic icon ID. -
selectionSize
public float selectionSizeHow big the content appears in certain selection menus -
uiIcon
Icon of the content to use in UI. -
fullIcon
Icon of the full content. Unscaled. -
techNode
The tech tree node for this content, if applicable. Null if not part of a tech tree. -
techNodes
Tech nodes for all trees that this content is part of. -
unlocked
protected boolean unlockedUnlock state. Loaded from settings. Do not modify outside of the constructor.
-
-
Constructor Details
-
UnlockableContent
-
-
Method Details
-
loadIcon
public void loadIcon()Description copied from class:Content
Called right before load(). -
getLogicId
public int getLogicId() -
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
Display any extra info after details. -
createIcons
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
- Returns:
- items needed to research this content
-
emoji
-
hasEmoji
public boolean hasEmoji() -
getDependencies
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()
-