Game.Routes.TakeoffLocation
Assembly:
Assembly-CSharp (typical game assembly; exact assembly name not present in source file)
Namespace:
Game.Routes
Type:
struct TakeoffLocation : IComponentData, IQueryTypeParameter, ISerializable
Base:
Implements:
- Unity.Entities.IComponentData
- Unity.Entities.IQueryTypeParameter
- Colossal.Serialization.Entities.ISerializable
Summary:
Represents a takeoff location component used by the routing/pathfinding system. It stores an Entity reference used for access restrictions and a set of flags (TakeoffLocationFlags) describing properties/behavior of the takeoff location. The struct implements the game's serialization interfaces so it can be written to/read from the game save/stream with version checks for backward compatibility.
Fields
-
public Unity.Entities.Entity m_AccessRestriction
Holds an Entity reference that represents an access restriction object associated with the takeoff location. This will be written/read during serialization and is used by systems that enforce or query access rules for routing. -
public TakeoffLocationFlags m_Flags
A flags enum (bitmask) describing properties of the takeoff location. The flags are serialized as a uint. The flags are only read from the stream when the reader context version is at or above Version.pathfindRestrictions.
Properties
- This type defines no managed properties; it exposes two public fields (m_AccessRestriction and m_Flags).
Constructors
public TakeoffLocation()
No explicit constructor is defined in source — the default parameterless constructor for the struct initializes fields to default values (Entity = default/Null, m_Flags = default).
Methods
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the component data to the provided writer. Serialization order:- Writes the m_AccessRestriction Entity.
- Writes m_Flags as a uint.
This method uses the generic writer interface from Colossal.Serialization.Entities, enabling save/stream serialization of ECS components.
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads the component data from the provided reader. Deserialization behavior:- Reads m_AccessRestriction (into the struct's field).
- If reader.context.version >= Version.pathfindRestrictions, reads a uint and casts it to TakeoffLocationFlags to populate m_Flags.
Note: The conditional read ensures backward compatibility with older save versions that predate the pathfindRestrictions version.
Usage Example
// Create and assign the component data
var takeoff = new TakeoffLocation {
m_AccessRestriction = someRestrictionEntity,
m_Flags = TakeoffLocationFlags.None // or appropriate flag combination
};
// Add to an entity via EntityManager (example)
entityManager.AddComponentData(entity, takeoff);
// During serialization the component will be written by its Serialize<TWriter> implementation.
// During deserialization the Deserialize<TReader> implementation will populate the fields,
// honoring version checks (Version.pathfindRestrictions) before reading flags.
{{ Additional notes: - Implements IComponentData so it can be attached to ECS entities and queried by systems. - Implements IQueryTypeParameter to allow use in entity queries (type parameter optimization). - The Version.pathfindRestrictions check implies that TakeoffLocationFlags were introduced in a specific game version; older saves will not include them. - TakeoffLocationFlags should be consulted to understand available flag values and semantics (not shown in this file). }}