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.
| Property | Meaning |
|---|---|
StackSize | Positive byte. Defaults to 50. |
Mass | Finite nonnegative mass up to 1,000,000. Defaults to zero. |
Phase, FluidColorRgb | Optional fluid phase and tint as 0xRRGGBB. Default tint is 0x68B1D6. |
Icon | An optional AssetReference to a PNG or JPEG. |
NameKey, DescriptionKey, Description | Localisation keys and literal description. |
Metadata | Optional 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:
| Constant | ID | Constant | ID |
|---|---|---|---|
RecyclerTool | 1 | MiningLaser | 2 |
PaintTool | 3 | Biofuel | 100 |
Iron | 101 | Glass | 102 |
StellarShard | 103 | Aluminum | 104 |
Water | 105 | Hydrogen | 106 |
CarbonDioxide | 107 | Oxygen | 108 |
Ice | 109 | Wood | 110 |
Ethanol | 111 | Copper | 112 |
For fluid components, use a native fluid ID or one of the shared StellarWorks gases.