Game.Prefabs.SewageOutlet
Assembly: Assembly-CSharp (typical for game scripts)
Namespace: Game.Prefabs
Type: class SewageOutlet
Base: ComponentBase, IServiceUpgrade
Summary:
SewageOutlet is a prefab Component used by sewage outlet buildings (city service buildings / building extensions). It exposes configurable fields for capacity, purification rate and whether submerged placement is allowed. The prefab controls which ECS components are added to the entity archetype and initialises SewageOutletData on entity creation. It also participates in upgrade behaviour via the IServiceUpgrade interface.
Fields
-
public int m_Capacity = 75
Sets the base capacity of the sewage outlet (default 75). This value is written into the SewageOutletData component during Initialize and controls how much sewage the outlet can process. -
public float m_Purification
A float representing purification effectiveness (fraction or value depending on game logic). This value is written into SewageOutletData during Initialize and used by building logic to reduce pollution/contamination. -
public bool m_AllowSubmerged
If true, the prefab allows placement while submerged. Used by prefab placement/building rules (inspected by placement systems), not directly written into ECS data in this class.
Properties
- None declared on this prefab class.
Constructors
public SewageOutlet()
No explicit constructor defined in the source; a default parameterless constructor exists. Typical usage is to configure public fields in the Unity inspector or via code before entity creation.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the runtime data component used to store this prefab's configuration on created entities:-
Adds
ComponentType.ReadWrite<SewageOutletData>()
. This method is called by the prefab system to list components that the created entity should contain. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Adds components required by the entity archetype unless the prefab already contains a ServiceUpgrade component: - If
ServiceUpgrade
component is not present on the prefab, it addsComponentType.ReadWrite<Game.Buildings.SewageOutlet>()
. -
If
CityServiceBuilding
is present on the prefab, it also addsComponentType.ReadWrite<Efficiency>()
. This controls which runtime building components exist depending on whether the building supports upgrades and whether it is a city service building. -
public void GetUpgradeComponents(HashSet<ComponentType> components)
Implements IServiceUpgrade contract to declare which components apply when this prefab is used as an upgrade: -
Adds
ComponentType.ReadWrite<Game.Buildings.SewageOutlet>()
. -
public override void Initialize(EntityManager entityManager, Entity entity)
Called when the entity is created from this prefab. Writes SewageOutletData to the entity: - Sets
m_Capacity
andm_Purification
on the SewageOutletData component using the prefab's field values. This is where prefab configuration is transferred into ECS component data for runtime systems to use.
Usage Example
// Example: a mod script that modifies a SewageOutlet prefab instance before it's used.
// This runs in Unity editor / prefab setup code or a prefab-initialization hook.
public void ConfigureSewageOutlet(SewageOutlet prefab)
{
// Increase capacity and tune purification for a higher-tier outlet
prefab.m_Capacity = 150;
prefab.m_Purification = 0.85f;
prefab.m_AllowSubmerged = true;
}
Additional notes for modders: - The prefab is exposed in the component menu under "Buildings/CityServices/" and references types BuildingPrefab and BuildingExtensionPrefab — this makes it usable both as a standalone building and as a building extension. - The prefab writes a SewageOutletData component during initialization; you can inspect or modify that component in entity-based systems to change runtime behaviour. - GetArchetypeComponents conditionally adds the Game.Buildings.SewageOutlet and Efficiency components only when ServiceUpgrade is not present and CityServiceBuilding is present respectively — modify these checks if creating custom hybrid prefab behaviours. - To create upgrades, implement or attach a ServiceUpgrade component to control how GetUpgradeComponents is applied by the upgrade system.