Skip to main content

Ladder

A Types.Pathfinder made of other pathfinders, tried in order. The first path wins; when every rung fails the reasons are joined, each prefixed with the rung's Name or its index: Straight: blocked by Workspace.Wall; Navmesh: NoPath.

Name is "Ladder", so ladders nest. Make one per agent when a rung is: a Navmesh holds a Path of its own and its Destroy releases it, so a ladder shared by two agents dies with the first. Keep the rungs' AgentRadius and AgentHeight in step with each other, since each rung measures the body on its own.

Blocked fires when the rung that produced the last path fires its own Blocked; other rungs' signals are ignored.

Functions​

new​

Ladder.new(
pathfinders: {Pathfinder}--

Tried in this order. The list is copied.

) → Ladder

Errors

TypeDescription
"needs at least one pathfinder"

FindPath​

This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts. Yields
Ladder.FindPath(
self: Ladder,
from: Vector3,
to: Vector3,
agent: Agent
) → (
Path?,--

The first rung's path that is not nil or empty.

string?--

Every rung's reason, <name>: <reason> joined with ; .

)

Yields whenever a rung does; rungs are tried one after another, never at once.

Close​

Ladder.Close(
self: Ladder,
step: Step,
seconds: number
) → ()

Passes the closure to every rung that has Close, since any of them might plan through the same door next time.

Destroy​

Ladder.Destroy(self: Ladder) → ()

Calls Destroy on every rung that has one, in order, then drops the Blocked signal.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "",
            "params": [
                {
                    "name": "pathfinders",
                    "desc": "Tried in this order. The list is copied.",
                    "lua_type": "{ Pathfinder }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Ladder"
                }
            ],
            "function_type": "static",
            "errors": [
                {
                    "lua_type": "\"needs at least one pathfinder\"",
                    "desc": ""
                }
            ],
            "source": {
                "line": 58,
                "path": "lib/Pathfinders/Ladder.luau"
            }
        },
        {
            "name": "FindPath",
            "desc": "Yields whenever a rung does; rungs are tried one after another, never at once.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Ladder"
                },
                {
                    "name": "from",
                    "desc": "",
                    "lua_type": "Vector3"
                },
                {
                    "name": "to",
                    "desc": "",
                    "lua_type": "Vector3"
                },
                {
                    "name": "agent",
                    "desc": "",
                    "lua_type": "Agent"
                }
            ],
            "returns": [
                {
                    "desc": "The first rung's path that is not `nil` or empty.",
                    "lua_type": "Path?"
                },
                {
                    "desc": "Every rung's reason, `<name>: <reason>` joined with `; `.",
                    "lua_type": "string?"
                }
            ],
            "function_type": "static",
            "yields": true,
            "source": {
                "line": 115,
                "path": "lib/Pathfinders/Ladder.luau"
            }
        },
        {
            "name": "Close",
            "desc": "Passes the closure to every rung that has `Close`, since any of them might plan through\nthe same door next time.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Ladder"
                },
                {
                    "name": "step",
                    "desc": "",
                    "lua_type": "Step"
                },
                {
                    "name": "seconds",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 142,
                "path": "lib/Pathfinders/Ladder.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Calls `Destroy` on every rung that has one, in order, then drops the `Blocked` signal.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Ladder"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 156,
                "path": "lib/Pathfinders/Ladder.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Ladder",
    "desc": "A [Types.Pathfinder] made of other pathfinders, tried in order. The first path wins; when every\nrung fails the reasons are joined, each prefixed with the rung's `Name` or its index:\n`Straight: blocked by Workspace.Wall; Navmesh: NoPath`.\n\n`Name` is `\"Ladder\"`, so ladders nest. Make one per agent when a rung is: a [Navmesh] holds a\n`Path` of its own and its `Destroy` releases it, so a ladder shared by two agents dies with the\nfirst. Keep the rungs' `AgentRadius` and `AgentHeight` in step with each other, since each rung\nmeasures the body on its own.\n\n`Blocked` fires when the rung that produced the last path fires its own `Blocked`; other\nrungs' signals are ignored.",
    "source": {
        "line": 51,
        "path": "lib/Pathfinders/Ladder.luau"
    }
}