Skip to content

Game.Prefabs.WaterPipeOutsideConnection

Assembly: Assembly-CSharp (inferred)
Namespace: Game.Prefabs

Type: class

Base: ComponentBase

Summary:
A prefab component used to mark and configure an outside water pipe connection when converting GameObjects into ECS entities. The class is annotated with a ComponentMenu attribute to appear under "Objects/" in the editor and is associated with StaticObjectPrefab and MarkerObjectPrefab types. It contributes archetype components for the ECS representation of an outside water pipe connection and provides an Initialize hook (which currently only calls the base implementation).


Fields

  • This class declares no private or public fields.
    {{ The class has no additional fields; behavior is implemented via overrides of ComponentBase methods and attributes on the class. }}

Properties

  • This class declares no properties.
    {{ There are no explicit properties; any data exposed is via added ECS components during archetype construction/initialization. }}

Constructors

  • public WaterPipeOutsideConnection()
    {{ Uses the implicit/default constructor. No custom construction logic is defined in this class. }}

Methods

  • public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    {{ This method is overridden but is empty in the provided implementation. Typically this method can be used to add components that should be present on the prefab (GameObject) level during conversion. Leaving it empty means no prefab-level component additions are performed by this class. }}

  • public override void GetArchetypeComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    {{ Adds the ECS component types required for this prefab's entity archetype:

  • ComponentType.ReadWrite()
  • ComponentType.ReadWrite() These ensure that when an entity is created from this prefab it will include the data components representing a water pipe outside connection and the generic outside connection data. Modders can extend this method to add more components required by their systems. }}

  • public override void Initialize(Unity.Entities.EntityManager entityManager, Unity.Entities.Entity entity)
    {{ Currently calls base.Initialize(entityManager, entity) and performs no additional initialization. This method is the place to set initial component data on the created entity (using entityManager.SetComponentData) or to add runtime-only components. }}

Usage Example

// Example: extend initialization to set initial component data for the outside connection.
[ComponentMenu("Objects/", new Type[] { typeof(StaticObjectPrefab), typeof(MarkerObjectPrefab) })]
public class WaterPipeOutsideConnection : ComponentBase
{
    public override void GetArchetypeComponents(HashSet<ComponentType> components)
    {
        components.Add(ComponentType.ReadWrite<Game.Objects.WaterPipeOutsideConnection>());
        components.Add(ComponentType.ReadWrite<Game.Objects.OutsideConnection>());
        // add custom component if needed:
        // components.Add(ComponentType.ReadWrite<MyMod.CustomConnectionData>());
    }

    public override void Initialize(EntityManager entityManager, Entity entity)
    {
        base.Initialize(entityManager, entity);

        // Example of setting default data (pseudo-fields shown)
        if (entityManager.HasComponent<Game.Objects.OutsideConnection>(entity))
        {
            var conn = new Game.Objects.OutsideConnection
            {
                // assign default values here
                // e.g., conn.capacity = 100;
            };
            entityManager.SetComponentData(entity, conn);
        }
    }
}

{{ Notes for modders: If you want additional runtime behavior, add component types in GetArchetypeComponents and set initial values in Initialize. If prefab-level components (for conversion or editor usage) are needed, populate GetPrefabComponents accordingly. }}