Skip to content

Game.UndergroundMesh

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: class

Base: ComponentBase

Summary:
UndergroundMesh is a Unity/ECSS component used by the game's prefab system to mark prefabs that represent underground geometry (tunnels, pipelines, sub-pipelines). It exposes three boolean flags (m_IsTunnel, m_IsPipeline, m_IsSubPipeline) that indicate which kind of underground mesh this prefab represents. The class overrides two methods (GetArchetypeComponents and GetPrefabComponents) that are intended to populate a HashSet of Unity.Entities.ComponentType entries so the prefab/archetype gets the required ECS components at load/authoring time. In the provided source these methods are empty—modders should add the appropriate ComponentType entries there to integrate the prefab with the game's ECS systems.


Fields

  • public bool m_IsTunnel
    Indicates that the prefab is a tunnel-type underground mesh. When true, the prefab should be given the ECS components (tags/data) required for tunnel processing/rendering.

  • public bool m_IsPipeline
    Indicates that the prefab is a pipeline-type underground mesh. When true, the prefab should be given the ECS components required for pipeline processing/rendering.

  • public bool m_IsSubPipeline
    Indicates that the prefab is a sub-pipeline (a smaller or secondary pipeline) underground mesh. When true, the prefab should be given the ECS components required for sub-pipeline processing/rendering.

Properties

  • This class defines no public properties.

Constructors

  • public UndergroundMesh()
    No explicit constructor is declared in source; the class uses the default parameterless constructor provided by C#. Initialization of fields will use their default values (false).

Methods

  • public override void GetArchetypeComponents(HashSet<ComponentType> components)
    Called when building an ECS archetype for this prefab type. Implementors should add ComponentType entries (ComponentType.ReadOnly() or ComponentType.ReadWrite()) to the supplied HashSet to ensure the runtime archetype includes the required components for systems that operate on underground meshes. Keep entries idempotent (HashSet prevents duplicates). If your base class offers behavior, optionally call base.GetArchetypeComponents(components).

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Called when preparing prefab entity templates. Implementors should add ComponentType entries required by the prefab (render tags, mesh data, pipeline/tunnel tags, custom data components, etc.). Use this method to ensure created prefab entities include the components your runtime systems expect.

Notes: - The source leaves these methods empty; without adding ComponentType entries, prefab entities produced from this prefab may lack the ECS data needed by game systems. - Use ComponentType.ReadOnly() for marker/tags or data components that systems only read, and ComponentType.ReadWrite() for components systems will write to. - Typical entries to add depend on the mod / game internals (examples: RenderMesh/RenderBounds tags, a TunnelTag component, PipelineTag component, or custom data components used by city systems).

Usage Example

// Example implementation: add tag components to prefabs based on flags.
// Replace TunnelTag / PipelineTag / UndergroundSharedData with actual game component types.
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
    base.GetPrefabComponents(components); // call if base implements behavior

    // Common components for all underground prefabs (example)
    components.Add(ComponentType.ReadOnly<RenderPrefab>());

    if (m_IsTunnel)
        components.Add(ComponentType.ReadOnly<TunnelTag>());

    if (m_IsPipeline)
        components.Add(ComponentType.ReadOnly<PipelineTag>());

    if (m_IsSubPipeline)
        components.Add(ComponentType.ReadOnly<SubPipelineTag>());

    // Add shared data component for underground meshes (example)
    components.Add(ComponentType.ReadWrite<UndergroundSharedData>());
}

Replace the example component types (TunnelTag, PipelineTag, SubPipelineTag, UndergroundSharedData) with the actual ECS component types used by the mod or the game. The methods are the correct places to ensure prefab entities get the components your systems rely on.