Game.Vehicles.SizeClass
Assembly: Assembly-CSharp (game runtime assembly)
Namespace: Game.Vehicles
Type: enum
Base: System.Enum (underlying type: byte)
Summary:
Represents size classifications for vehicles used by the game's vehicle system. This enum is used by vehicle logic, AI, and rendering/placement code to distinguish small, medium and large vehicle types. The underlying storage is a byte, so it can be cast to/from byte values when reading/writing binary data or interfacing with low-level systems. Avoid changing the existing order or values if maintaining savegame compatibility.
Fields
-
Small
Represents small vehicles (e.g., cars, motorcycles, small service vehicles). Typically used for vehicle types that require minimal road space and parking. -
Medium
Represents medium-sized vehicles (e.g., buses, delivery trucks, larger service vehicles). Used by systems that handle vehicle spacing, lane usage, or collision sizes differently than small vehicles. -
Large
Represents large vehicles (e.g., heavy trucks, large buses, trailers). Generally treated as the largest category for routing, clearance and rendering considerations. -
Undefined
Fallback/default value used when a size has not been set or cannot be determined. Handlers should treat this as an unknown size and apply safe defaults (usually conservative behavior as for Medium/Large).
Properties
- None. (This is a simple enum with no properties.)
Constructors
- None. (Enums do not define constructors in C#.)
Methods
- None. (No methods are defined on this enum.)
Usage Example
using Game.Vehicles;
public class VehicleSizeHelper
{
public static SizeClass GetSizeByLength(float lengthMeters)
{
if (lengthMeters <= 4.5f)
return SizeClass.Small;
if (lengthMeters <= 9.0f)
return SizeClass.Medium;
return SizeClass.Large;
}
public void ExampleUsage()
{
float vehicleLength = 5.2f; // example value
SizeClass size = GetSizeByLength(vehicleLength);
switch (size)
{
case SizeClass.Small:
// handle small vehicle
break;
case SizeClass.Medium:
// handle medium vehicle
break;
case SizeClass.Large:
// handle large vehicle
break;
case SizeClass.Undefined:
default:
// fallback behavior
break;
}
// Cast to byte when storing in compact structures or binary formats:
byte raw = (byte)size;
// Restore:
SizeClass restored = (SizeClass)raw;
}
}
Additional notes for modders: - The enum's underlying type is byte. When storing or reading values in packed data structures, cast explicitly to/from byte. - Do not change the numeric order or remove existing members in released mods if you need compatibility with saved games or other mods; prefer adding new entries at the end. - Use the Undefined value as a safe initial/default state if the actual size cannot be determined.