Game.Prefabs.WaterPipeConnection
Assembly:
Assembly-CSharp (inferred)
Namespace:
Game.Prefabs
Type:
class
Base:
ComponentBase
Summary:
Represents a prefab component used by the net/prefab system to configure water-pipe-related capacities and to inject the corresponding ECS components into prefabs/archetypes. Exposes three integer capacity fields for fresh water, sewage and stormwater and overrides methods that declare which ECS components should be added to prefabs and archetypes. This class is intended for use by the game's prefab pipeline and modders who need to influence how a water pipe connection is represented in the ECS world.
Fields
-
public int m_FreshCapacity = 1073741823
Large default capacity for fresh water. The value 1073741823 (2^30 - 1) is used as an effectively "unlimited" or very large capacity sentinel in the base game. Modders can change this value on the prefab to limit fresh-water throughput. -
public int m_SewageCapacity = 1073741823
Large default capacity for sewage, same sentinel value as m_FreshCapacity. Controls sewage throughput capacity for this pipe connection. -
public int m_StormCapacity
Stormwater capacity. Default is 0 (no explicit capacity set). Set on the prefab to control stormwater throughput. If left at 0, behavior depends on downstream systems that interpret the value.
Properties
- None. This class exposes only public fields and overrides; it does not declare properties.
Constructors
public WaterPipeConnection()
Implicit parameterless constructor (no explicit constructor defined in source). The component is intended to be created by the prefab system; initialization of field defaults is handled by the field initializers.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the runtime ECS component type(s) that should be present on the prefab. Implementation:-
Adds
ComponentType.ReadWrite<WaterPipeConnectionData>()
to the provided set. This tells the prefab creation pipeline that prefabs containing this component should include the WaterPipeConnectionData ECS component on the entity representing the prefab. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Conditionally adds archetype-level ECS component types. Implementation: - Checks if the provided set already contains
ComponentType.ReadWrite<Edge>()
. If so, it addsComponentType.ReadWrite<Game.Net.WaterPipeConnection>()
. This ensures the ECS archetype for net edges that represent water pipe connections contains the appropriate runtime connection component.
Notes:
- Both methods are part of the prefab-to-ECS mapping pipeline. GetPrefabComponents affects which components get baked into prefab entities; GetArchetypeComponents influences archetype construction when certain other components (like Edge) are present.
- The class uses concrete ComponentType.ReadWrite
Usage Example
// Example: customize a water pipe prefab in a mod or editor script
var wp = new WaterPipeConnection();
wp.m_FreshCapacity = 10000; // limit fresh water throughput
wp.m_SewageCapacity = 5000; // limit sewage throughput
wp.m_StormCapacity = 2000; // set stormwater capacity
// When the prefab pipeline runs, GetPrefabComponents and GetArchetypeComponents
// will ensure the corresponding ECS components are added to the prefab/archetype.
{{ Additional info: - Typical scenario: attach this ComponentBase-derived script to a net prefab (e.g., pipe segment) so the game knows to add WaterPipeConnectionData and, when the entity is an Edge, the Game.Net.WaterPipeConnection ECS component. - Changing the large default capacities to smaller values allows modders to implement capacity constraints without modifying downstream simulation systems. - Be aware of serialization/baking behavior: values set on the ComponentBase are expected to be baked into the corresponding ECS components during prefab conversion. }}