Skip to content

Content definitions ​

The content definitions in StellarWorks.Content describe game assets and research. Register them during initialisation through ModContext.

ItemDefinition ​

new ItemDefinition(ContentId id, string name) describes a solid item when Phase is unset or a fluid when it is FluidPhase.Liquid or FluidPhase.Gas. Register through mod.Items or mod.Fluids respectively.

PropertyMeaning
StackSizePositive byte. Defaults to 50.
MassFinite nonnegative mass up to 1,000,000. Defaults to zero.
Phase, FluidColorRgbOptional fluid phase and tint as 0xRRGGBB. Default tint is 0x68B1D6.
IconAn optional AssetReference to a PNG or JPEG.
NameKey, DescriptionKey, DescriptionLocalisation keys and literal description.
MetadataOptional structured values in a ComponentConfiguration.

Construction and research costs require solid items. new ItemCost(ContentId item, int quantity) takes a quantity from 1 to 255. Each item can occur once per cost list.

Categories and research ​

CategoryDefinition(ContentId id, string name) creates a build tab through mod.BuildCategories or a visible research group through mod.ResearchCategories. Order controls sort order and defaults to zero. Icon and NameKey supply presentation.

ResearchDefinition(ContentId id, string name) creates a technology. A Category must refer to a registered research category. Use Prerequisites for native or registered technologies, Costs for item costs, and UnlocksParts for registered parts. Prerequisite graphs must be acyclic. Unlocking a part this way adds the technology to its research requirements.

ResearchNodeStyle can override the background, border colour and width, and icon. Icon takes precedence over IconPart, which references a part thumbnail. PartBuilder.RequiresResearch(ContentId) can also add a prerequisite from the part side. Registration examples

Stock content ​

Use the game's native numeric IDs as ContentId values. Item.FromID(uint) creates native:<positive-item-id>. Item.Registered(modId, itemId) creates a reference to a mod item. Stock research prerequisites use new ContentId("native", "<positive-research-id>"), with the decimal research ID from the supported game build. A stock build tab uses WithCategory("native:<tab-index>"), with a zero-based index.

Named constants on Item.Native for StellarDrive Demo 0.8.3:

ConstantIDConstantID
RecyclerTool1MiningLaser2
PaintTool3Biofuel100
Iron101Glass102
StellarShard103Aluminum104
Water105Hydrogen106
CarbonDioxide107Oxygen108
Ice109Wood110
Ethanol111Copper112

For fluid components, use a native fluid ID or one of the shared StellarWorks gases.

StellarWorks documentation · Mods for StellarDrive