Skip to main content

LiquidData

A class in Root.Township, Alta.Liquid.

Describes a liquid: its colour and visual, the alchemy effects it applies, and any chunk visuals. Liquid containers hold it, save it and sync it.

Constructors​

MemberWhat it is
LiquidData(LiquidVisualData liquidVisual, EffectDefinitionApplication[] effects, CookableItem[] cookablesUsed, LiquidVisualChunkDefinition[] chunkVisuals, Color colorTint)Creates a LiquidData with default values.
LiquidData()Creates a LiquidData with default values.

Fields​

MemberWhat it is
const int MaxNumberOfEffectsUpper bound for the number of effects. The network code allows up to 1023.
8 private and internal fields
MemberWhat it is
private LiquidVisualChunkDefinition[] chunkVisualsBacking field for ChunkVisuals: floating chunk visuals (such as food bits) shown in the liquid.
private Color colorTintBacking field for ColorTint. Multiplied by the visual's colour for TintedLiquidColor.
private CookableItem[] cookablesUsedBacking field for CookablesUsed, the cooked items that went into this liquid. Not saved or synced here.
private EffectDefinitionApplication[] effectsBacking field for Effects, the effects Apply runs on whoever drinks or is splashed.
private bool isConsumableThroughSkinBacking field for IsConsumableThroughSkin. Splash liquids (such as the teleport potion) apply on particle contact.
private LiquidVisualData liquidVisualBacking field for LiquidVisual, the liquid's look and base colour.
private static Logger loggerNLog logger for this class.
private float splashParticlesStrengthBacking field for SplashParticlesStrength: effect strength when applied by splash particles. 1 by default.

Properties​

MemberWhat it is
IEnumerable<LiquidVisualChunkDefinition> ChunkVisuals { get; }Visuals for solid chunks floating in the liquid.
Color ColorTint { get; }Tint applied over the visual's colour.
CookableItem[] CookablesUsed { get; }Cookable ingredients that went into the liquid. Not saved or synced.
IEnumerable<EffectDefinitionApplication> Effects { get; }Effects applied when the liquid is consumed or splashed.
bool IsConsumableThroughSkin { get; }True for splash liquids (such as the teleport potion) that work on contact.
LiquidVisualData LiquidVisual { get; }Base visual data for the liquid.
float SplashParticlesStrength { get; }Strength for splash particles when consumable through skin.
Color TintedLiquidColor { get; }The visual's colour times the tint.

Methods​

MemberWhat it is
void Apply(EffectHandler target, float strength)Server: applies all its effects to a target at the given strength. Logs an error on a client.
override bool Equals(object obj)True if colour, visual, skin flag, effects and chunk visuals all match (effects and chunks in any order).
override int GetHashCode()Hash of the colour, visual, skin flag and the effect and chunk arrays.
LiquidContainerSaveData.CustomData GetSave()Builds save data with the colour, skin flag, visual, effects and chunks.
void Load(LiquidContainerSaveData.CustomData data)Fills the liquid from save data.
static bool op_Equality(LiquidData a, LiquidData b)Compares with Equals; two nulls are equal.
static bool op_Inequality(LiquidData a, LiquidData b)Opposite of ==.
void Serialize(Stream stream)Reads or writes the colour, skin flag, visual, effects and chunk visuals on a network stream.
2 private and internal methods
MemberWhat it is
private void SerializeChunksArray(Stream stream)Reads or writes the chunk visuals as a count and their hashes.
private void SerializeEffectsArray(Stream stream)Reads or writes the effect applications as a count and each entry.

Used in​

Members of other types that take, return or hold a LiquidData: