Skip to main content

Proximity

A Types.Sense that writes who is within Range of the agent, nearest first, with no regard for sight. Writes NearbyTargets, NearestTarget and NearestDistance. Distances are math.huge when there is nothing to measure.

Types​

ProximityOptions​

interface ProximityOptions {
Range: number?--

Studs within which a target counts as nearby. Default 100.

Targets: ((agent: Agent) → {BasePart})?--

What to measure. Default Perception.AliveRoots, every alive player's root.

Prefix: string?--

Prepended to every key this sense writes, so two instances can coexist. Default "".

}

Functions​

new​

Proximity.new(options: ProximityOptions?) → Proximity

Errors

TypeDescription
"unknown option"A key not in `ProximityOptions`.
"Range must be zero or more"

Tick​

Proximity.Tick(
self: Proximity,
agent: Agent,
deltaTime: number
) → ()

Measures, and writes the keys listed above to agent.Blackboard.

Destroy​

Proximity.Destroy(self: Proximity) → ()

Nothing to release; present so the sense satisfies Types.Sense and any cleanup helper.

Configure​

Proximity.Configure(
self: Proximity,
patch: ProximityOptions--

The options to change; the rest keep their values.

) → ()

Changes options after construction, for difficulty and pacing: a director widening the cone or shortening the memory mid-round. The same rules as new apply.

Errors

TypeDescription
"unknown option"
Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "",
            "params": [
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "ProximityOptions?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Proximity"
                }
            ],
            "function_type": "static",
            "errors": [
                {
                    "lua_type": "\"unknown option\"",
                    "desc": "A key not in `ProximityOptions`."
                },
                {
                    "lua_type": "\"Range must be zero or more\"",
                    "desc": ""
                }
            ],
            "source": {
                "line": 77,
                "path": "lib/Senses/Proximity.luau"
            }
        },
        {
            "name": "Tick",
            "desc": "Measures, and writes the keys listed above to `agent.Blackboard`.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Proximity"
                },
                {
                    "name": "agent",
                    "desc": "",
                    "lua_type": "Agent"
                },
                {
                    "name": "deltaTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 99,
                "path": "lib/Senses/Proximity.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Nothing to release; present so the sense satisfies [Types.Sense] and any cleanup helper.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Proximity"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 126,
                "path": "lib/Senses/Proximity.luau"
            }
        },
        {
            "name": "Configure",
            "desc": "Changes options after construction, for difficulty and pacing: a director widening the cone\nor shortening the memory mid-round. The same rules as `new` apply.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Proximity"
                },
                {
                    "name": "patch",
                    "desc": "The options to change; the rest keep their values.",
                    "lua_type": "ProximityOptions"
                }
            ],
            "returns": [],
            "function_type": "static",
            "errors": [
                {
                    "lua_type": "\"unknown option\"",
                    "desc": ""
                }
            ],
            "source": {
                "line": 138,
                "path": "lib/Senses/Proximity.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "ProximityOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Range",
                    "lua_type": "number?",
                    "desc": "Studs within which a target counts as nearby. Default `100`."
                },
                {
                    "name": "Targets",
                    "lua_type": "((agent: Agent) -> { BasePart })?",
                    "desc": "What to measure. Default [Perception.AliveRoots], every alive player's root."
                },
                {
                    "name": "Prefix",
                    "lua_type": "string?",
                    "desc": "Prepended to every key this sense writes, so two instances can coexist. Default `\"\"`."
                }
            ],
            "source": {
                "line": 39,
                "path": "lib/Senses/Proximity.luau"
            }
        }
    ],
    "name": "Proximity",
    "desc": "A [Types.Sense] that writes who is within `Range` of the agent, nearest first, with no regard\nfor sight. Writes `NearbyTargets`, `NearestTarget` and `NearestDistance`. Distances are\n`math.huge` when there is nothing to measure.",
    "source": {
        "line": 69,
        "path": "lib/Senses/Proximity.luau"
    }
}