Game.Prefabs.PostFacilityData
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType, IComponentData, IQueryTypeParameter, ICombineData
Summary:
PostFacilityData is an ECS component representing the configuration/capacities of a postal facility (post vans, post trucks, mail capacity and sorting rate). It is used in the game's entity-component system to store per-facility numeric capacities and supports combining and (de)serialization for save/load and entity queries.
Fields
-
public int m_PostVanCapacity
Represents the capacity (number of items/volume) handled by post vans for this facility. Default is 0. When combining components, values are added. -
public int m_PostTruckCapacity
Represents the capacity handled by post trucks for this facility. Default is 0. Combined by summation. -
public int m_MailCapacity
Represents the total mail capacity of the facility. Default is 0. Combined by summation. -
public int m_SortingRate
Represents the facility's sorting throughput/rate (units per tick/second depending on simulation context). Default is 0. Combined by summation.
Properties
- None (the struct exposes public fields and no C# properties).
Constructors
public PostFacilityData()
Default (compiler-provided) struct constructor — initializes all integer fields to 0. No custom constructor is defined in the source.
Methods
-
public void Combine(PostFacilityData otherData)
Adds the corresponding fields from otherData into this instance (m_PostVanCapacity, m_PostTruckCapacity, m_MailCapacity, m_SortingRate). Used by systems that aggregate component data (ICombineData). -
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the four integer fields to the provided writer in the following order: m_PostVanCapacity, m_PostTruckCapacity, m_MailCapacity, m_SortingRate. The writer must implement the IWriter interface used by the game's serialization system. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads the four integer fields from the provided reader in the same order they were written, writing directly into the struct's fields via refs. The reader must implement the IReader interface used by the game's serialization system.
Notes: - Combine is a simple additive merge; no clamping or validation is performed by this method. - The generic Serialize/Deserialize methods rely on the game's IWriter/IReader implementations — these must match the serialized order and types. - Fields are public for direct read/write by game systems and mod code.
Usage Example
// Create and initialize two facility data instances
var a = new PostFacilityData
{
m_PostVanCapacity = 10,
m_PostTruckCapacity = 4,
m_MailCapacity = 200,
m_SortingRate = 50
};
var b = new PostFacilityData
{
m_PostVanCapacity = 5,
m_PostTruckCapacity = 2,
m_MailCapacity = 100,
m_SortingRate = 25
};
// Combine b into a (sums each field)
a.Combine(b);
// a now has m_PostVanCapacity=15, m_PostTruckCapacity=6, m_MailCapacity=300, m_SortingRate=75
// Serialize (example using a hypothetical writer)
using (var writer = /* obtain IWriter from serialization system */)
{
a.Serialize(writer);
}
// Deserialize (example using a hypothetical reader)
var loaded = new PostFacilityData();
using (var reader = /* obtain IReader from serialization system */)
{
loaded.Deserialize(reader);
}