Table of Contents

Struct PathOptions

Namespace
Core.Systems
Assembly
Core.dll

ENGINE: Options for pathfinding requests. Allows customization of cost calculation, forbidden zones, and preferences.

public struct PathOptions

Fields

AvoidPenalty

Penalty multiplier for avoided provinces. Default: 10 (avoided provinces cost 10x normal).

public FixedPoint64 AvoidPenalty

Field Value

FixedPoint64

AvoidProvinces

Provinces to avoid if possible (soft block). Will be used if no alternative exists, but with high penalty.

public HashSet<ushort> AvoidProvinces

Field Value

HashSet<ushort>

Context

Context for unit-specific pathfinding (owner, type, flags).

public PathContext Context

Field Value

PathContext

CostCalculator

Cost calculator for terrain/ownership-based costs. If null, uses UniformCostCalculator (all costs = 1).

public IMovementCostCalculator CostCalculator

Field Value

IMovementCostCalculator

ForbiddenProvinces

Provinces that cannot be traversed (hard block). Path will fail if no route exists without these provinces.

public HashSet<ushort> ForbiddenProvinces

Field Value

HashSet<ushort>

MaxPathLength

Maximum path length (provinces). 0 = no limit. Use to prevent extremely long paths.

public int MaxPathLength

Field Value

int

UseCache

Whether to use caching for this request. Disable for paths that change frequently.

public bool UseCache

Field Value

bool

Properties

Default

Default options (uniform cost, no restrictions).

public static PathOptions Default { get; }

Property Value

PathOptions

Methods

ForUnit(ushort, ushort)

Create options for a specific unit.

public static PathOptions ForUnit(ushort ownerCountryId, ushort unitTypeId = 0)

Parameters

ownerCountryId ushort
unitTypeId ushort

Returns

PathOptions

GetEffectiveCostCalculator()

Get the effective cost calculator (default if null).

public IMovementCostCalculator GetEffectiveCostCalculator()

Returns

IMovementCostCalculator

WithCostCalculator(IMovementCostCalculator)

Create options with a specific cost calculator.

public static PathOptions WithCostCalculator(IMovementCostCalculator calculator)

Parameters

calculator IMovementCostCalculator

Returns

PathOptions

WithForbidden(HashSet<ushort>)

Create options with forbidden provinces.

public static PathOptions WithForbidden(HashSet<ushort> forbidden)

Parameters

forbidden HashSet<ushort>

Returns

PathOptions