Skip to content

Game.Net.ParkingLane

Assembly: Assembly-CSharp.dll
Namespace: Game.Net

Type: public struct

Base: System.ValueType (struct); implements IComponentData, IQueryTypeParameter, ISerializable

Summary: ParkingLane is an ECS component used by the game's net/road system to represent parking-lane specific data on a lane. It stores references for access restrictions and pathfinding, flags describing lane behaviour, free-space available, parking/taxi fees and availability, and implements custom binary (de)serialization with compatibility checks against game save/version constants.


Fields

  • public Entity m_AccessRestriction
    Reference to an Entity that defines access restrictions for this parking lane (written/read only when the save version supports pathfind access restriction).

  • public PathNode m_SecondaryStartNode
    A PathNode used as a secondary start for pathfinding related to this parking lane. Present/read when the save version is at or above Version.parkingLaneImprovement.

  • public ParkingLaneFlags m_Flags
    Bitmask flags (ParkingLaneFlags) describing properties/behaviour of the parking lane. Serialized as a uint.

  • public float m_FreeSpace
    Amount of free space available in this parking lane (float). Always serialized/deserialized after the flags value.

  • public ushort m_ParkingFee
    Parking fee value (ushort). Present/read when the save version is at or above Version.parkingLaneImprovement2.

  • public ushort m_ComfortFactor
    Comfort factor for parking in this lane (ushort). Present/read when the save version is at or above Version.parkingLaneImprovement2.

  • public ushort m_TaxiAvailability
    Taxi availability setting for this parking lane (ushort). Present/read when the save version is at or above Version.taxiDispatchCenter.

  • public ushort m_TaxiFee
    Taxi fee for this lane (ushort). Present/read when the save version is at or above Version.taxiFee.

Properties

  • This type exposes no public properties beyond its public fields and implemented interfaces.

Constructors

  • public ParkingLane()
    Implicit default constructor for the struct. All fields are initialized to their default values (Entity = default, numeric fields = 0, enums = 0).

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Serializes the ParkingLane fields to the provided writer in the following order:
  • m_AccessRestriction (Entity)
  • m_SecondaryStartNode (PathNode)
  • m_Flags written as a uint
  • m_FreeSpace (float)
  • m_ParkingFee (ushort)
  • m_ComfortFactor (ushort)
  • m_TaxiAvailability (ushort)
  • m_TaxiFee (ushort)

Note: Serialize writes all fields unconditionally; compatibility is handled during deserialization based on reader.context.version.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Deserializes fields from the provided reader. The method performs version checks against reader.context.version and reads fields conditionally:
  • If version >= Version.pathfindAccessRestriction: reads m_AccessRestriction (Entity).
  • If version >= Version.parkingLaneImprovement: reads m_SecondaryStartNode (PathNode).
  • Always reads a uint into a local value (this is the serialized flags value).
  • Always reads m_FreeSpace (float).
  • If version >= Version.parkingLaneImprovement2: reads m_ParkingFee and m_ComfortFactor (ushort each).
  • If version >= Version.taxiDispatchCenter: reads m_TaxiAvailability (ushort).
  • If version >= Version.taxiFee: reads m_TaxiFee (ushort).
  • Finally assigns m_Flags = (ParkingLaneFlags)value.

This ordering and conditional reading ensures backward/forward compatibility with different game save format versions.

Usage Example

// Example: creating and serializing a ParkingLane instance
var lane = new Game.Net.ParkingLane();
lane.m_AccessRestriction = someAccessEntity;
lane.m_SecondaryStartNode = somePathNode;
lane.m_Flags = ParkingLaneFlags.Enabled | ParkingLaneFlags.AllowTaxi; // example flags
lane.m_FreeSpace = 12.5f;
lane.m_ParkingFee = 50;
lane.m_ComfortFactor = 75;
lane.m_TaxiAvailability = 1; // 0 = none, 1 = available, for example
lane.m_TaxiFee = 100;

// Serialize using an IWriter implementation
writer.Write(lane.m_AccessRestriction);
writer.Write(lane.m_SecondaryStartNode);
writer.Write((uint)lane.m_Flags);
writer.Write(lane.m_FreeSpace);
writer.Write(lane.m_ParkingFee);
writer.Write(lane.m_ComfortFactor);
writer.Write(lane.m_TaxiAvailability);
writer.Write(lane.m_TaxiFee);

// Deserialization is handled via reader with version checks in the struct's Deserialize method:
Game.Net.ParkingLane loaded;
loaded.Deserialize(reader);