Game.Vehicles.CargoTransportFlags
Assembly:
Assembly-CSharp
Namespace:
Game.Vehicles
Type:
public enum CargoTransportFlags : uint (with [Flags] attribute)
Base:
System.Enum (underlying type: System.UInt32)
Summary:
Flags enum used to describe state and behavior bits for cargo vehicles/transport in Cities: Skylines 2. Each named value represents a single bit (or combination of bits when ORed) that the game can set on a cargo vehicle to indicate statuses such as movement, service needs, testing, or special handling (dummy/disabled). The [Flags] attribute allows combining multiple values with bitwise operations.
Fields
-
Returning = 1u
Indicates the vehicle is returning (typically to depot or origin). (0x1) -
EnRoute = 2u
Vehicle is currently en route to its destination. (0x2) -
Boarding = 4u
Vehicle is in the process of boarding/unloading cargo (loading/unloading at a stop). (0x4) -
Arriving = 8u
Vehicle is arriving at its destination or stop (near arrival state). (0x8) -
RequiresMaintenance = 0x10u
Vehicle requires maintenance/repairs. (0x10) -
Refueling = 0x20u
Vehicle is refueling. (0x20) -
AbandonRoute = 0x40u
Vehicle has abandoned its planned route (may be heading to an alternate action). (0x40) -
RouteSource = 0x80u
Marks the vehicle as a route source (used by route-generation/assignment logic). (0x80) -
Testing = 0x100u
Vehicle is in testing mode (used by game/system tests or debug flows). (0x100) -
RequireStop = 0x200u
Vehicle is required to stop at the next eligible stop (force-stop flag). (0x200) -
DummyTraffic = 0x400u
Vehicle is dummy/ghost traffic (non-active game logic traffic, e.g., for simulation density). (0x400) -
Disabled = 0x800u
Vehicle is disabled/inactive (should not perform normal operations). (0x800)
Properties
- This enum does not define properties. Use bitwise operations or Enum.HasFlag to inspect combined flag values.
Constructors
- Enums do not define explicit constructors in C#. The implicit default value is 0 (none of the flags set).
Methods
-
No custom methods are defined on this enum. Standard Enum methods apply (e.g., ToString(), HasFlag(System.Enum), and bitwise operators for combining/clearing flags).
-
Typical operations:
- Combine flags: flags |= CargoTransportFlags.EnRoute;
- Check flag: (flags & CargoTransportFlags.Returning) != 0 or flags.HasFlag(CargoTransportFlags.Returning);
- Clear flag: flags &= ~CargoTransportFlags.Refueling;
Usage Example
// Create a flags value marking a cargo vehicle as en route and requiring a stop
CargoTransportFlags flags = CargoTransportFlags.EnRoute | CargoTransportFlags.RequireStop;
// Check whether the vehicle needs maintenance
if ((flags & CargoTransportFlags.RequiresMaintenance) != 0)
{
// handle maintenance
}
// Mark the vehicle as returning and clear the en-route bit
flags |= CargoTransportFlags.Returning;
flags &= ~CargoTransportFlags.EnRoute;
// Use HasFlag for readability (slightly slower than bitwise check)
if (flags.HasFlag(CargoTransportFlags.Returning))
{
// handle returning behavior
}
// Remove the DummyTraffic bit if it was set
flags &= ~CargoTransportFlags.DummyTraffic;
Notes: - Because this enum uses the [Flags] attribute, values are intended to be combined with bitwise operators. - The underlying type is uint; when storing or transmitting values, be mindful of the 32-bit unsigned representation.