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
FieldsModifier and TypeFieldDescriptionboolean
If true, this content will appear in all database tabs.boolean
Whether this content is always unlocked in the tech tree.arc.struct.ObjectSet<UnlockableContent>
Content - usually a planet - that dictates which database tab(s) this content will appear in.Localized description & details.Localized description & details.arc.graphics.g2d.TextureRegion
Icon of the full content.Override for the full icon.boolean
If false, all icon generation is disabled for this content; createIcons is not called.boolean
Whether this is hidden from the Core Database.boolean
Whether details are hidden in custom games if this hasn't been unlocked in campaign mode.boolean
Whether to show the description in the research dialog preview.Localized, formal name.float
How big the content appears in certain selection menusarc.struct.ObjectSet<Planet>
Planets that this content is made for.Stat storage for this content.The tech tree node for this content, if applicable.arc.struct.Seq<TechTree.TechNode>
Tech nodes for all trees that this content is part of.arc.graphics.g2d.TextureRegion
Icon of the content to use in UI.protected boolean
Unlock state.Fields inherited from class mindustry.ctype.MappableContent
name
-
Constructor Summary
Constructors -
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
(arc.scene.ui.layout.Table table) Display any extra info after details.emoji()
int
void
getDependencies
(arc.func.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.boolean
isOnPlanet
(Planet planet) void
loadIcon()
Called right before load().boolean
locked()
boolean
protected void
makeOutline
(MultiPacker.PageType page, MultiPacker packer, arc.graphics.g2d.TextureRegion region, boolean makeNew, arc.graphics.Color outlineColor, int outlineRadius) protected void
makeOutline
(MultiPacker packer, arc.graphics.g2d.TextureRegion region, String name, arc.graphics.Color outlineColor) protected void
makeOutline
(MultiPacker packer, arc.graphics.g2d.TextureRegion region, String name, arc.graphics.Color outlineColor, int outlineRadius) void
onUnlock()
Called when this content is unlocked.void
postInit()
Called after init().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
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 are hidden in custom games if this hasn't been unlocked in campaign mode. -
hideDatabase
public boolean hideDatabaseWhether this is hidden from the Core Database. -
generateIcons
public boolean generateIconsIf false, all icon generation is disabled for this content; createIcons is not called. -
selectionSize
public float selectionSizeHow big the content appears in certain selection menus -
uiIcon
public arc.graphics.g2d.TextureRegion uiIconIcon of the content to use in UI. -
fullIcon
public arc.graphics.g2d.TextureRegion fullIconIcon of the full content. Unscaled. -
fullOverride
Override for the full icon. Useful for mod content with duplicate icons. Overrides any other full icon. -
allDatabaseTabs
public boolean allDatabaseTabsIf true, this content will appear in all database tabs. -
shownPlanets
Planets that this content is made for. If empty, a planet is decided based on item requirements. Currently, this is only meaningful for blocks. -
databaseTabs
Content - usually a planet - that dictates which database tab(s) this content will appear in. If nothing is defined, it will use the values in shownPlanets. If shownPlanets is also empty, it will use Serpulo as the "default" tab. -
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 the constructor.
-
-
Constructor Details
-
UnlockableContent
-
-
Method Details
-
postInit
public void postInit()Description copied from class:Content
Called after init(). -
loadIcon
public void loadIcon()Description copied from class:Content
Called right before load(). -
isOnPlanet
-
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
public void displayExtra(arc.scene.ui.layout.Table table) 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, arc.graphics.g2d.TextureRegion region, boolean makeNew, arc.graphics.Color outlineColor, int outlineRadius) -
makeOutline
protected void makeOutline(MultiPacker packer, arc.graphics.g2d.TextureRegion region, String name, arc.graphics.Color outlineColor, int outlineRadius) -
makeOutline
protected void makeOutline(MultiPacker packer, arc.graphics.g2d.TextureRegion region, String name, arc.graphics.Color outlineColor) -
researchRequirements
- Returns:
- items needed to research this content
-
emoji
-
emojiChar
public int emojiChar() -
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() -
unlockedHost
public boolean unlockedHost()- Returns:
- in multiplayer, whether this is unlocked for the host player, otherwise, whether it is unlocked for the local player (same as unlocked())
-
unlockedNow
public boolean unlockedNow()- Returns:
- whether this content is unlocked, or the player is in a custom (non-campaign) game.
-
unlocked
public boolean unlocked() -
clearUnlock
public void clearUnlock()Locks this content again. -
locked
public boolean locked()
-