SprayCan¶
Vanilla game class representing a spray-paint can consumable. The game ships one SprayCan prefab per color.
Declaration¶
public class SprayCan : Consumable, ISprayer, IUsedAmount, IUsed
{
[Header("Spray Can")]
public Material PaintMaterial;
private static readonly GasMixture PollutionMixture = new GasMixture(new Mole(Chemistry.GasType.Pollutant, new MoleQuantity(0.009999999776482582), new MoleEnergy(73.0)));
public override int ConstructingSoundHash => Animator.StringToHash("SprayPaintLong");
public override int FinishedConstructingSoundHash => Animator.StringToHash("SprayPaintFinished");
public float TimeToUse() => 0.5f;
public Material GetPaintMaterial() => PaintMaterial;
public override bool UseDefaultUiUsingSounds() => false;
public override bool OnUseItem(float quantity, Thing onUseThing)
{
base.Quantity -= quantity;
AtmosphericEventInstance.CloneGlobalAddGasMix(base.WorldGrid, PollutionMixture);
return true;
}
}
OnUseItem is the whole of the can's per-use behavior: decrement quantity, emit one PollutionMixture (0.01 mol Pollutant at 73 J) into the can's WorldGrid. It always returns true.
Fields¶
Source: F0015, re-confirmed against 0.2.6403.27689.
PaintMaterial/PaintableMaterial: TheMaterialrepresenting the can's current color. The game has oneSprayCanprefab per color.GameManager.GetColorSwatch(Material)is the game's own reverse lookup from this material to theColorSwatch, used byISprayer.DoSpray.Thumbnail: TheSpriteshown in the inventory slot. Tied to the prefab, so switching color requires updating it manually.Quantity: Decremented on each use. Setting it to 0 before vanilla runs effectively makes the can infinite.DLCType(inherited fromThing,[SerializeField] private DLCType _dlcTypewith a getter-onlypublic DLCType DLCType): the entitlement required to obtain this can.DLCType.Noneon the twelve vanilla cans;DLCType.MetallicPaintson the four metallic cans. This is the ONLY place a paint color's DLC requirement is recorded, becauseColorSwatchhas noDLCTypefield. See../GameSystems/DLCGating.md.
One prefab per color, and the metallic set¶
rocketstation_Data/StreamingAssets/Data/paints.xml lists a Tool Manufactory recipe per can. Sixteen cans ship at 0.2.6403.27689: twelve vanilla plus four from the Metallic Paints DLC.
Vanilla twelve: ItemSprayCanBlack, ItemSprayCanBlue, ItemSprayCanBrown, ItemSprayCanGreen, ItemSprayCanGrey, ItemSprayCanKhaki, ItemSprayCanOrange, ItemSprayCanPink, ItemSprayCanPurple, ItemSprayCanRed, ItemSprayCanWhite, ItemSprayCanYellow.
Metallic four: ItemSprayCanMetallicBronze, ItemSprayCanMetallicGold, ItemSprayCanMetallicObsidian, ItemSprayCanMetallicSilver.
Every recipe, vanilla and metallic alike, is Time 5, Energy 500, Iron 1. The recipes ship to all players; the DLC gate in the fabricator path is what stops a non-owner producing the metallic four.
Note the prefab name uses Grey while the swatch name is ColorGray (see ./ColorSwatch.md). Do not derive one from the other by string manipulation.
Runtime enumeration on 2026-07-25 in game version 0.2.6403.27689 confirmed all 16 prefabs are present in Prefab.AllPrefabs regardless of entitlement, each with a non-null PaintMaterial, each resolving to exactly one CustomColors swatch by material reference, with the twelve vanilla cans carrying DLCType.None and the four metallic cans DLCType.MetallicPaints. The full index map is on ./ColorSwatch.md under "Metallic swatch addition"; the method and its threading caveats are recorded there too.
Because SprayCan prefabs are the only carrier of the color-to-DLC mapping, walking Prefab.AllPrefabs for SprayCan instances is how a mod resolves which CustomColors entries are entitlement-gated:
foreach (Thing thing in Prefab.AllPrefabs)
{
if (thing is SprayCan prefabCan && prefabCan.PaintMaterial != null)
{
// prefabCan.PaintMaterial identifies the swatch, prefabCan.DLCType is the gate
}
}
Verification history¶
- 2026-04-20: page created from the Research migration; verbatim content lifted from F0015. No conflicts.
- 2026-07-25: re-read against 0.2.6403.27689. Added the verbatim class declaration, the
PollutionMixtureconstants, and the inheritedDLCTypefield. Added "One prefab per color, and the metallic set" listing all sixteen prefab names frompaints.xmland the identical recipe cost. Addedrelatedlinks and the cross-reference to the new../GameSystems/DLCGating.md. No existing claim was contradicted; all prior content was additive-confirmed.
Open questions¶
None. The distinct-material question raised at page revision time was resolved the same day by runtime enumeration: all 16 cans map one-to-one onto 16 distinct swatch materials. See ./ColorSwatch.md.