Game.Vehicles.GarbageTruckFlags
Assembly: Assembly-CSharp (game)
Namespace: Game.Vehicles
Type: public enum (flags)
Base: System.Enum (underlying type: System.UInt32)
Summary:
Flags describing state and behavioral bits for garbage truck vehicles in Cities: Skylines 2. The enum is decorated with [Flags], so values are intended to be combined using bitwise operations. Typical uses include checking whether a truck is returning, unloading, restricted to industrial waste, disabled, estimated full, or whether a "clear checked" marker has been set.
Fields
-
Returning = 1u
Indicates the truck is returning (for example, heading back to depot or origin). -
IndustrialWasteOnly = 2u
Mark the truck to handle only industrial waste. Use to restrict collection behavior. -
Unloading = 4u
Indicates the truck is currently unloading its cargo. -
Disabled = 8u
Marks the truck as disabled (out of service / not operational). -
EstimatedFull = 0x10u
Indicates the truck is estimated to be full (used for routing/dispatch decisions). -
ClearChecked = 0x20u
A marker bit used by logic that checks/clears some condition (implementation detail in vehicle management code).
Properties
- None (enum type — no instance properties).
Use System.Enum helper methods or bitwise operators to inspect/combine values (e.g., HasFlag, bitwise &).
Constructors
- The enum has the implicit underlying value constructor provided by .NET; there are no explicit constructors to call in typical usage. Enums are value types and are constructed by assignment.
Methods
- None defined on the enum type itself. Use:
- instance.ToString() to get the name(s),
- Enum.HasFlag(Enum) (or bitwise checks) to test flags,
- casting to/from the underlying uint for storage or interop.
Usage Example
// Set flags
GarbageTruckFlags flags = GarbageTruckFlags.Returning | GarbageTruckFlags.EstimatedFull;
// Check if a flag is set (recommended: bitwise check for performance in tight loops)
bool isReturning = (flags & GarbageTruckFlags.Returning) != 0;
// Alternatively, using HasFlag (slightly slower)
bool isEstimatedFull = flags.HasFlag(GarbageTruckFlags.EstimatedFull);
// Add a flag
flags |= GarbageTruckFlags.Unloading;
// Remove a flag
flags &= ~GarbageTruckFlags.Returning;
// Toggle a flag
flags ^= GarbageTruckFlags.Disabled;
// Casting to/from underlying uint (for serialization or native interop)
uint raw = (uint)flags;
flags = (GarbageTruckFlags)raw;
Additional notes: - Because this enum is marked with [Flags], ensure each new flag uses a unique power-of-two value (0x40, 0x80, etc.) to avoid collisions. - Prefer bitwise checks ((flags & X) != 0) in performance-sensitive code (like per-vehicle update loops) rather than Enum.HasFlag. - Be mindful of the underlying type (uint). When interoperating with code expecting int or other sizes, cast explicitly to avoid sign/size mistakes.