Skip to content

Game.Buildings.TelecomFacility

Assembly:
Assembly-CSharp (game/mod assembly; actual assembly may vary)

Namespace:
Game.Buildings

Type:
struct

Base:
IComponentData, IQueryTypeParameter, ISerializable

Summary:
Component data struct used to attach telecom-specific flags to a building/entity. It stores a TelecomFacilityFlags value and implements simple byte-based serialization/deserialization through the ISerializable pattern used by the game's serialization system. This struct is intended to be used as an ECS component (IComponentData) and can be used in queries (IQueryTypeParameter).


Fields

  • public TelecomFacilityFlags m_Flags
    Holds the flags/state for the telecom facility. The underlying value is serialized as a single byte by Serialize/Deserialize. TelecomFacilityFlags is expected to be an enum (typically small enough to fit in a byte).

Properties

  • This type has no managed properties. It is a plain data struct with a single public field.

Constructors

  • public TelecomFacility()
    Structs have an implicit parameterless constructor that initializes m_Flags to its default value (usually 0). No explicit constructor is defined in the source.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the current m_Flags value to the provided writer as a single byte: writer.Write((byte)m_Flags). Used by the game's serialization pipeline to persist component state.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads a byte from the provided reader and assigns it to m_Flags by casting: reader.Read(out byte value); m_Flags = (TelecomFacilityFlags)value. Restores the saved flags value during deserialization.

Usage Example

// Example usage (pseudocode — concrete writer/reader types depend on the game's serialization API)
var telecom = new TelecomFacility();
telecom.m_Flags = TelecomFacilityFlags.Active | TelecomFacilityFlags.HasAntenna;

// Serialize
using (var writer = new SomeBinaryWriter())
{
    telecom.Serialize(writer);
    byte[] blob = writer.ToArray();
    // store blob...
}

// Deserialize
var restored = new TelecomFacility();
using (var reader = new SomeBinaryReader(existingBlob))
{
    restored.Deserialize(reader);
}
// restored.m_Flags now contains the previously saved flags

Notes: - TelecomFacilityFlags must fit in a byte for the serialization logic to be correct; confirm the enum's underlying type if modifying. - This struct is designed for use with Unity's ECS and the game's custom reader/writer abstractions (IReader/IWriter).