Struct PathOptions
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
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
CostCalculator
Cost calculator for terrain/ownership-based costs. If null, uses UniformCostCalculator (all costs = 1).
public IMovementCostCalculator CostCalculator
Field Value
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
Methods
ForUnit(ushort, ushort)
Create options for a specific unit.
public static PathOptions ForUnit(ushort ownerCountryId, ushort unitTypeId = 0)
Parameters
ownerCountryIdushortunitTypeIdushort
Returns
GetEffectiveCostCalculator()
Get the effective cost calculator (default if null).
public IMovementCostCalculator GetEffectiveCostCalculator()
Returns
WithCostCalculator(IMovementCostCalculator)
Create options with a specific cost calculator.
public static PathOptions WithCostCalculator(IMovementCostCalculator calculator)
Parameters
calculatorIMovementCostCalculator
Returns
WithForbidden(HashSet<ushort>)
Create options with forbidden provinces.
public static PathOptions WithForbidden(HashSet<ushort> forbidden)
Parameters
forbiddenHashSet<ushort>