grid-engine
    Preparing search index...

    Interface MoveToConfig

    interface MoveToConfig {
        algorithm?: ShortestPathAlgorithmType;
        alternativeTargets?: LayerPosition[];
        considerCosts?: boolean;
        ignoredChars?: string[];
        ignoreLayers?: boolean;
        isPositionAllowedFn?: IsPositionAllowedFn;
        maxPathLength?: number;
        noPathFoundAlternativeTargetsFallbackStrategy?: NoPathFoundStrategy;
        noPathFoundMaxRetries?: number;
        noPathFoundRetryBackoffMs?: number;
        noPathFoundStrategy?: NoPathFoundStrategy;
        pathBlockedMaxRetries?: number;
        pathBlockedRetryBackoffMs?: number;
        pathBlockedStrategy?: PathBlockedStrategy;
        pathBlockedWaitTimeoutMs?: number;
        targetLayer?: string;
    }
    Index

    Properties

    Algorithm to use for pathfinding.

    alternativeTargets?: LayerPosition[]

    Only relevant if MoveToConfig.noPathFoundStrategy is set to NoPathFoundStrategy.ALTERNATIVE_TARGETS.

    It provides a list of alternative targets that are considered if the main target is not reachable. That list is processed in order.

    considerCosts?: boolean

    Only considered by A* algorithm. If set to true, pathfinding will consider costs. Costs are set via tile properties.

    false
    
    ignoredChars?: string[]

    Set of characters to ignore at collision checking.

    ignoreLayers?: boolean

    If set to true, pathfinding will only be performed on the char layer of the start position. If you don't use char layers, activating this setting can improve pathfinding performance.

    false
    
    isPositionAllowedFn?: IsPositionAllowedFn

    Function to specify whether a certain position is allowed for pathfinding. If the function returns false, the tile will be consindered as blocked.

    It can be used to restrict pathfinding to specific regions.

    Beware that this method can become a performance bottleneck easily. So be careful and keep it as efficient as possible. An asymptotic runtime complexity of O(1) is recommended.

    maxPathLength?: number

    If this is set, the algorithm will stop once it reaches a path length of this value. This is useful to avoid running out of memory on large or infinite maps.

    noPathFoundAlternativeTargetsFallbackStrategy?: NoPathFoundStrategy

    Only relevant if MoveToConfig.noPathFoundStrategy is set to NoPathFoundStrategy.ALTERNATIVE_TARGETS.

    In case all these targets are blocked this is the fallback strategy.

    noPathFoundMaxRetries?: number

    Only relevant if noPathFoundStrategy is set to NoPathFoundStrategy.RETRY.

    It sets the maximum amount of retries before giving up.

    noPathFoundRetryBackoffMs?: number

    Only relevant if noPathFoundStrategy is set to NoPathFoundStrategy.RETRY.

    It sets the time in milliseconds that the pathfinding algorithm will wait until the next retry.

    noPathFoundStrategy?: NoPathFoundStrategy

    Determines what happens if no path could be found. For the different strategies see NoPathFoundStrategy.

    pathBlockedMaxRetries?: number

    Only relevant if MoveToConfig.pathBlockedStrategy is set to PathBlockedStrategy.RETRY.

    It sets the maximum amount of retries before giving up.

    pathBlockedRetryBackoffMs?: number

    Only relevant if MoveToConfig.pathBlockedStrategy is set to PathBlockedStrategy.RETRY.

    It sets the time in milliseconds that the pathfinding algorithm will wait until the next retry.

    pathBlockedStrategy?: PathBlockedStrategy

    Determines what happens if a previously calculated path is suddenly blocked. This can happen if a path existed and while the character was moving along that path, it got suddenly blocked.

    For the different strategies see PathBlockedStrategy.

    pathBlockedWaitTimeoutMs?: number

    Only relevant if MoveToConfig.pathBlockedStrategy is set to PathBlockedStrategy.WAIT.

    It sets the number of milliseconds that the pathfinding algorithm will wait for the path to become unblocked again before stopping the movement.

    targetLayer?: string

    Char layer of the movement target. If there is no targetLayer provided, the current char layer of the moving character is used.