Skip to content

Game.Net.WaterPipeConnection

Assembly: Assembly-CSharp.dll
Namespace: Game.Net

Type: struct

Base: Implements IComponentData, IQueryTypeParameter, ISerializable

Summary:
Represents the capacity information for a water pipe connection in the game's ECS (Entity Component System). The struct stores integer capacities for three categories of water flow: fresh water, sewage, and storm water. It implements Colossal's ISerializable to support save/load, and can be used as a component (IComponentData) in Unity.Entities queries. During deserialization it handles compatibility with older save versions by providing a default storm water capacity when the saved version predates the stormWater feature.


Fields

  • public int m_FreshCapacity Stores the capacity for fresh (potable) water flow for this pipe connection. Serialized first in Save data.

  • public int m_SewageCapacity Stores the capacity for sewage flow for this pipe connection. Serialized second in Save data.

  • public int m_StormCapacity Stores the capacity for storm water flow for this pipe connection. Serialized third. When deserializing from a save with a version older than Version.stormWater, this field is initialized to 5000 to maintain compatibility.

Properties

  • None. (This type exposes plain public fields rather than properties.)

Constructors

  • Default value-type constructor (implicit) As a struct there is no explicit constructor defined. When created with the default constructor, integer fields are zero-initialized (except when deserialized from older data where m_StormCapacity is set to 5000 by the Deserialize logic).

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the three capacity fields to the writer in order: m_FreshCapacity, m_SewageCapacity, m_StormCapacity. This method implements ISerializable.Serialize and must match the read order in Deserialize.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads values back into the fields in the same order. For compatibility, it checks reader.context.version: if the save version is older than Version.stormWater, m_StormCapacity is not read from the stream and is instead set to 5000; otherwise it reads m_StormCapacity from the reader.

Usage Example

// Create and populate the component, then add to an entity via the EntityManager
var connection = new Game.Net.WaterPipeConnection
{
    m_FreshCapacity = 12000,
    m_SewageCapacity = 9000,
    m_StormCapacity = 6000
};

entityManager.AddComponentData(someEntity, connection);

// When implementing serialization handlers, the struct's Serialize/Deserialize will be used
// automatically by the Colossal serialization infrastructure because it implements ISerializable.