Skip to content

Game.Prefabs.ExtractorFacilityData

Assembly: Assembly-CSharp (game code / modding assembly)

Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter, ISerializable

Summary:
Represents per-prefab configuration data for extractor-type facilities (e.g., mines, resource extractors). Contains a rotation range and a height-offset range used by the prefab placement/visuals and a flags field that encodes extractor-specific requirements. Implements custom binary serialization (ISerializable) so the data can be written to and read from the game's serialization streams in a compact, fixed order.


Fields

  • public Bounds1 m_RotationRange
    Specifies the allowed rotation interval for the extractor prefab. Bounds1 exposes min and max floats. The values are stored as raw floats; interpret units according to the surrounding codebase (commonly radians in many systems, but check calling code or editor for exact units).

  • public Bounds1 m_HeightOffset
    Specifies the allowed vertical offset interval (min/max) applied to the prefab during placement or rendering. Stored as two floats (min and max).

  • public ExtractorRequirementFlags m_Requirements
    Bitmask flags describing requirements for the extractor (for example required resources, terrain conditions or other constraints). Use the ExtractorRequirementFlags enum to set or query specific requirement bits.

Properties

  • None. This type exposes only public fields and does not declare properties.

Constructors

  • public ExtractorFacilityData()
    No explicit constructors are defined in source — this is a plain value-type (struct). Fields will be default-initialized if not explicitly assigned.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the data into the provided writer in a fixed order:
  • m_RotationRange.min (float)
  • m_RotationRange.max (float)
  • m_HeightOffset.min (float)
  • m_HeightOffset.max (float)
    Note: m_Requirements is not serialized by this method in the provided source; if requirements must be persisted, verify whether they are handled elsewhere or intentionally omitted.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads the same sequence of floats back into the struct by reference:

  • m_RotationRange.min
  • m_RotationRange.max
  • m_HeightOffset.min
  • m_HeightOffset.max
    The method expects the same ordering as Serialize. If data layout changes in future versions, add versioning or compatibility handling.

Usage Example

// Example usage: construct, serialize, and deserialize an ExtractorFacilityData.
// Note: IWriter/IReader implementations are provided by the game's serialization system.
// This is illustrative pseudocode for modders.

var data = new ExtractorFacilityData
{
    m_RotationRange = new Bounds1 { min = -1.5708f, max = 1.5708f }, // ±90 degrees (radians)
    m_HeightOffset = new Bounds1 { min = 0f, max = 2f },
    m_Requirements = ExtractorRequirementFlags.None
};

// Serialize (pseudo)
using (var stream = new MemoryStream())
{
    // Assume GameWriter implements IWriter and wraps a BinaryWriter
    var writer = new GameWriter(stream); // placeholder for actual IWriter implementation
    data.Serialize(writer);

    // Later: read it back
    stream.Position = 0;
    var reader = new GameReader(stream); // placeholder for actual IReader implementation
    var loaded = new ExtractorFacilityData();
    loaded.Deserialize(reader);

    // loaded now contains the same rotation and height ranges as `data`.
}

{{ Notes: Ensure you use the game's concrete IWriter/IReader implementations when serializing/deserializing. The m_Requirements field is not serialized by the shown methods — check the broader prefab serialization pipeline to confirm how/where requirements are persisted. }}