Skip to content

Game.Prefabs.TelecomFacility

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: class

Base: ComponentBase, IServiceUpgrade

Summary:
TelecomFacility is a prefab component used for telecom/city-service buildings. It exposes configuration values (range, network capacity and a flag for penetrating terrain), registers the ECS component types required for the prefab and archetype, and initializes entity component data when the prefab is instantiated. The component also conditionally adds an Efficiency component to the archetype when no ServiceUpgrade component is present but a CityServiceBuilding component is.


Fields

  • public float m_Range = 1000f
    This controls the coverage radius of the telecom facility (world units). It's written into the TelecomFacilityData component during initialization.

  • public float m_NetworkCapacity = 10000f
    Represents the facility's network capacity. It is copied into TelecomFacilityData on Initialize and used by the game's telecom systems.

  • public bool m_PenetrateTerrain
    If true, the facility's coverage may ignore terrain blocking logic. This boolean is stored into TelecomFacilityData at initialization.

Properties

  • (This class does not declare any properties beyond what it inherits.)
    The component exposes its configuration through public fields and pushes them into ECS component data during Initialize.

Constructors

  • public TelecomFacility()
    No explicit constructor is defined in the source file; the default parameterless constructor is used. Initialization of runtime ECS data occurs in the override of Initialize rather than in a constructor.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds the component types required on the prefab instance:
  • TelecomFacilityData (read/write)
  • UpdateFrameData (read/write)
    Use: ensures entities spawned from this prefab have these components so the runtime systems can read configuration and drive per-frame updates.

  • public override void GetArchetypeComponents(HashSet<ComponentType> components)
    Adds archetype-level components required for entities created from this prefab:

  • Game.Buildings.TelecomFacility (read/write)
    Additionally, if the prefab does not have a ServiceUpgrade component but does have a CityServiceBuilding component, an Efficiency (read/write) component is added to the archetype. This conditional ensures non-upgradeable city service buildings get the Efficiency component for performance calculations.

  • public void GetUpgradeComponents(HashSet<ComponentType> components)
    Adds components used when the prefab is treated as an upgrade variant:

  • Game.Buildings.TelecomFacility (read/write)
    Intended to be used by systems managing upgrades so the upgraded archetype carries the telecom building runtime data.

  • public override void Initialize(EntityManager entityManager, Entity entity)
    Writes the serialized prefab field values into the entity's ECS component instances:

  • Sets TelecomFacilityData with m_Range, m_NetworkCapacity and m_PenetrateTerrain.
  • Sets UpdateFrameData with a hard-coded update frame index of 13 (controls scheduling of update jobs/frames for the prefab).
    This is the entry point where MonoBehaviour-style prefab configuration is converted into runtime ECS component data.

Usage Example

// Example: manual initialization mimic (similar to what the prefab system calls)
var prefab = /* reference to TelecomFacility prefab instance */;
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = /* created entity for the prefab */;

// When creating the entity from the prefab, the prefab system calls:
prefab.Initialize(entityManager, entity);

// After this call, the entity will have TelecomFacilityData and UpdateFrameData set:
// TelecomFacilityData.m_Range == prefab.m_Range
// TelecomFacilityData.m_NetworkCapacity == prefab.m_NetworkCapacity
// TelecomFacilityData.m_PenetrateTerrain == prefab.m_PenetrateTerrain

Additional notes: - The ComponentMenu attribute places this prefab under "Buildings/CityServices/" in the editor and associates it with BuildingPrefab and BuildingExtensionPrefab usage. - The Initialize method writes UpdateFrameData(13) — 13 likely maps to a specific update bucket used by the game's update scheduling; consult existing UpdateFrameData usage to understand timing implications. - The class interacts with the ECS component types TelecomFacilityData, UpdateFrameData and Game.Buildings.TelecomFacility; ensure those component definitions are present and have the expected fields when creating mods that rely on or extend telecom behavior.