Game.Prefabs.TelecomFacilityData
Assembly:
Assembly-CSharp (game mod assembly — exact assembly name not specified in source file)
Namespace:
Game.Prefabs
Type:
struct TelecomFacilityData : IComponentData, IQueryTypeParameter, ICombineData
Base:
System.ValueType (struct)
Implements: IComponentData, IQueryTypeParameter, ICombineData
Summary:
Data component used by telecom facility prefabs. Stores runtime and serialized data for a telecom facility's coverage and capacity. It is intended for use in the game's ECS (Entity Component System) as a component on telecom-related entities. The struct supports combining with other TelecomFacilityData instances (useful when aggregating effects) and provides custom serialization/deserialization for saving/loading.
Fields
-
public float m_Range
Distance/coverage of the telecom facility. Typically interpreted in the game's world units (meters). Used to determine how far the facility's signal extends. -
public float m_NetworkCapacity
Capacity of the facility's network contribution. Represents how much network load/capacity this facility provides; units are game-specific. -
public bool m_PenetrateTerrain
If true, the facility's coverage ignores terrain occlusion. When false, terrain may block or reduce coverage.
Properties
- None. (All data members are public fields; there are no C# properties defined.)
Constructors
public TelecomFacilityData()
(implicit)
The struct has no explicit constructor in source; the default parameterless constructor (value-type default) will initialize numeric fields to 0 and the bool to false.
Methods
public void Combine(TelecomFacilityData otherData)
Merges another TelecomFacilityData into this one:- m_Range += otherData.m_Range
- m_NetworkCapacity += otherData.m_NetworkCapacity
-
m_PenetrateTerrain |= otherData.m_PenetrateTerrain
Use when aggregating the effects of stacked/combined facilities or when composing prefab data from multiple sources. -
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the struct fields to a writer for serialization. The implementation writes range, networkCapacity, then penetrateTerrain in that order. This method is used by the game's save/load or prefab serialization systems. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads the struct fields from a reader in the same order they were written (range, networkCapacity, penetrateTerrain). Uses ref locals to assign directly into the fields.
Notes: - The generic writer/reader types follow the game's Colossal.Serialization.Entities conventions. - The Combine method and the custom serialization ensure that multiple data sources can be composed and persisted correctly.
Usage Example
// Example: create two telecom data pieces, combine them, and prepare for serialization.
TelecomFacilityData baseData = new TelecomFacilityData
{
m_Range = 150f,
m_NetworkCapacity = 500f,
m_PenetrateTerrain = false
};
TelecomFacilityData upgradeData = new TelecomFacilityData
{
m_Range = 50f,
m_NetworkCapacity = 200f,
m_PenetrateTerrain = true
};
// Combine upgrade into base (adds range and capacity, ORs penetrate flag)
baseData.Combine(upgradeData);
// Serialization example (pseudocode — depends on the game's IWriter implementation)
using (var writer = GetWriter()) // GetWriter is placeholder
{
baseData.Serialize(writer);
}
// Deserialization example (pseudocode)
TelecomFacilityData loaded = new TelecomFacilityData();
using (var reader = GetReader()) // GetReader is placeholder
{
loaded.Deserialize(reader);
}