Skip to content

Game.Simulation.GoodsDeliveryFlags

Assembly: Assembly-CSharp
Namespace: Game.Simulation

Type: public enum (with [Flags] attribute)

Base: System.Enum (underlying type: System.UInt16 / ushort)

Summary:
A bitmask flags enum used by the simulation to indicate which kinds of goods delivery (or delivery-related targets) are permitted or applicable for a building/target. The [Flags] attribute allows combinations of these values to represent multiple allowed delivery types simultaneously. Values are stored in a 16-bit unsigned integer.


Fields

  • BuildingUpkeep = 1
    Indicates deliveries related to building upkeep (routine supply or maintenance deliveries).

  • CommercialAllowed = 2
    Marks that deliveries to commercial buildings are allowed/targeted.

  • IndustrialAllowed = 4
    Marks that deliveries to industrial buildings are allowed/targeted.

  • ImportAllowed = 8
    Flags that importing of goods is allowed for this target (i.e., goods can be brought in from outside the local economy).

  • ResourceExportTarget = 0x10
    Marks the target as a recipient for resource exports (value 16). Used for export routing/targeting logic.

Properties

  • None (this is a simple enum—no properties).

Constructors

  • None (enum types do not declare custom constructors; values are created by assigning enum members or bitwise combinations).

Methods

  • None declared on this enum. Use standard Enum APIs (e.g., Enum.HasFlag, casting, bitwise ops) to manipulate values.

Usage Example

// Combine flags: allow commercial deliveries and imports
GoodsDeliveryFlags flags = GoodsDeliveryFlags.CommercialAllowed | GoodsDeliveryFlags.ImportAllowed;

// Check with bitwise operation (preferred for performance)
bool allowsCommercial = (flags & GoodsDeliveryFlags.CommercialAllowed) != 0;

// Or using Enum.HasFlag (works but boxes the enum and is slower)
bool allowsImport = flags.HasFlag(GoodsDeliveryFlags.ImportAllowed);

// Add another flag
flags |= GoodsDeliveryFlags.BuildingUpkeep;

// Remove a flag
flags &= ~GoodsDeliveryFlags.ImportAllowed;

Notes and tips for modders: - Because the underlying type is ushort, if you store or serialize the value you may need to cast to/from ushort. - Use bitwise operations for performance-sensitive simulation code. HasFlag is convenient but slower due to boxing. - Combine flags to represent multiple delivery permissions (e.g., CommercialAllowed | IndustrialAllowed). - Understand how the simulation interprets each flag in routing and delivery systems before changing values in save data or runtime logic.