Game.Prefabs.NetAreaFlags
Assembly:
Assembly-CSharp (game code / modding assemblies typically compile into Assembly-CSharp)
Namespace:
Game.Prefabs
Type:
public enum NetAreaFlags
Base:
System.Enum (underlying type: System.Int32)
Summary:
NetAreaFlags is a bitmask enum used by the game's net/area system to mark properties of a net area (road/terrain/segment area). The enum is flagged with [Flags], so values can be combined with bitwise operations to represent multiple boolean attributes at once. Typical uses in modding include checking whether an area is buildable, inverted, a hole (gap), or forbids bridges.
Fields
-
Buildable = 1
Marks the area as buildable. When set, the game considers the area available for building structures or placing net elements. -
Invert = 2
Indicates an inverted area. This can be used to represent inverted selection or exclusion zones depending on game logic. -
Hole = 4
Marks the area as a hole (a gap or void inside another area). Useful for representing cutouts or excluded sub-areas. -
NoBridge = 8
Specifies that bridges are not allowed over this area. Useful for enforcing construction restrictions.
(Note: because the enum has the [Flags] attribute, these values can be combined, e.g., Buildable | NoBridge.)
Properties
public System.Int32 value__ { get; }
All enums have an underlying integer value (value__). The underlying type here is System.Int32. Use the named fields above rather than raw integers for clarity.
Constructors
public NetAreaFlags()
Enums do not expose custom constructors; they are value types with implicit construction. The default value corresponds to 0 (no flags set).
Methods
- Inherited from System.Enum / System.ValueType / System.Object:
-
ToString(), HasFlag(Enum), Equals(object), GetHashCode(), etc.
-
Practical note for modders: prefer using bitwise operations (flag & NetAreaFlags.SomeFlag) != 0 for performance-critical code instead of Enum.HasFlag, which is slower due to boxing.
Usage Example
// Set flags: make an area buildable but disallow bridges
NetAreaFlags flags = NetAreaFlags.Buildable | NetAreaFlags.NoBridge;
// Check flags
bool isBuildable = (flags & NetAreaFlags.Buildable) != 0;
bool allowsBridge = (flags & NetAreaFlags.NoBridge) == 0;
// Toggle a flag
flags |= NetAreaFlags.Hole; // add Hole
flags &= ~NetAreaFlags.NoBridge; // remove NoBridge
// Avoid using Enum.HasFlag in hot paths; prefer bitwise checks:
if ((flags & NetAreaFlags.Invert) != 0) {
// handle inverted area
}
Additional modding notes: - When working with game data structures that store these flags, inspect and modify them using the bitmask approach shown above. - Be careful when combining flags to preserve existing bits if you intend to only set/clear specific attributes.