Pathfinding and navigation for Among Us mods. Version 1.7.0 · plugin id com.cyberjack.cyberapi · PC and Android.
CyberAPI builds a grid of the current map and answers one question: how does a player get from here to there? It knows about walls, shadows, doors, and every way across the map that is not walking:
You ask for a route (MapPathfinding), optionally walk it (PlayerNavigation), and choose per request which of those the route may use (PathOptions). The host sets server-wide defaults in the in-game Navigation page; every call that does not say otherwise starts from them.
PathfindingAPI calls (below) are unchanged and still work. Everything on this page is additive.CyberAPI.dll from your project.[BepInDependency("com.cyberjack.cyberapi")]
public class Plugin : BasePlugin { ... }
Namespaces: CyberAPI (the grid, PathfindingAPI), CyberAPI.Navigation (everything new).
Players need CyberAPI too: on Nebula, enable it for your server and it is delivered with your mod.
using CyberAPI.Navigation;
using Reactor.Utilities;
// Call this on the client that controls the player (the local player, or a dummy on the host).
Coroutines.Start(player.CoMoveTo(goal, result =>
{
if (result.Arrived) OnArrived();
else Log($"stopped: {result.Status} - {result.Message}");
}));
or the same thing already started: player.MoveTo(goal, done).
var options = PathOptions.Default // the host's panel defaults, as a fresh copy
.WithoutVents() // never through vents
.WithoutPlatforms() // not the Airship platform
.WithAutoOpenDoors(); // open doors a player can open by hand
player.MoveTo(goal, done, options);
var request = MapPathfinding.CreateRequest(start, goal, options);
// once per frame (a few milliseconds each, so the game keeps drawing):
request.Step();
if (request.Status == PathStatus.Found)
foreach (var point in request.Result.Points)
Log($"{point.Kind} -> {point.Position}");
What one route may use. PathOptions.Default returns a fresh copy of the host's panel defaults every time, so change it freely. Every With... call returns the same object, so calls chain.
| Property | Default | Meaning | Chain calls |
|---|---|---|---|
UseLadders | true | Walk through ladder shafts (carried out as a climb). Off blocks the shafts. | WithLadders(bool) / WithoutLadders() |
UseZiplines | true | Fungle ziplines. | WithZiplines / WithoutZiplines |
UseMovingPlatforms | true | The Airship moving platform. Only offered while it stands at the end you start from and is free. | WithPlatforms / WithoutPlatforms |
UseElevators | true | Submerged elevators (no effect elsewhere). | WithElevators / WithoutElevators |
UseDecontamination | true | Mira HQ decontamination chambers. | WithDecontamination / WithoutDecontamination |
UseVents | null | true always, false never, null: follow the player's role (only a player who may vent does; a search with no player never does). | WithVents(bool) / WithoutVents() |
WaitForDoors | false | Shut doors of any kind may be in the route; the walker waits for them to open on their own. | WithWaitForDoors() |
AutoOpenDoors | false | Shut doors a player can open by hand may be in the route; the walker opens them. Doors held shut by a sabotage or a timer stay walls. | WithAutoOpenDoors() |
AllowDiagonals | true | Corner cutting between grid cells. | |
WallCostScale | 1 | How much to dislike hugging walls: 0 ignore, 1 the grid's own tiers, 2 twice as strong. | |
DoorWaitCost | 10 | What waiting at a shut door adds to a route's cost (distance-like units). | |
DecontaminationCost | 22 | What a decontamination cycle adds. | |
MaxExpansions | 400000 | Safety stop: a search that expands this many cells gives up (NotFound). |
WithoutDoors() makes shut doors walls (WaitForDoors and AutoOpenDoors both off). PathOptions.WalkOnly is plain walking only: every crossing, vents and shut doors off. Clone() copies an options object.
AutoOpenDoors no longer implies waiting for every door. It opens the clickable ones only. Add WithWaitForDoors() too if you also want the walker to wait for doors that open by themselves.Route finding for the whole map. Static class, CyberAPI.Navigation.
| Member | What it does |
|---|---|
PathRequest CreateRequest(Vector2 start, Vector2 goal, PathOptions? options = null, PlayerControl? player = null) | Starts a search you step yourself. With no grid yet the request is already finished with NotFound and a message. player only matters for vents (UseVents = null). |
IEnumerator FindPath(start, goal, Action<PathResult> done, options = null, player = null) | A coroutine that searches over as many frames as it needs, then calls done. Start it with Coroutines.Start. |
PathResult FindPathNow(start, goal, options = null, player = null) | Searches right now in one go. Fine for a one-off; on a phone prefer the other two. |
bool IsReady | A grid exists and is built. |
| Member | What it does |
|---|---|
PathStatus Status | Searching, Found, NotFound, Cancelled. |
PathResult? Result | Set once the search ends. |
Vector2 Start, Goal; PathOptions Options | What was asked. |
bool Step(float budgetMilliseconds = 3) | Searches for up to that long. Returns true while more calls are needed. |
IEnumerator Run(float budgetMilliseconds = 3) | yield return request.Run() inside a coroutine. |
void Cancel() | Stops it; status becomes Cancelled. |
The search is a stepwise A* over the grid plus the map's crossings, so it can be spread over frames.
| PathResult | |
|---|---|
Status | PathStatus. |
Points | IReadOnlyList<PathPoint>, in order. Smoothed: straight stretches are single waypoints. |
Positions | Just the positions, as a List<Vector2>. |
UsesCrossings | True when any point is a crossing. |
AutoOpensDoors | True when it was planned with AutoOpenDoors. |
Cost, NodesExpanded, Message | Search details. Message explains a failure. |
| PathPoint | |
|---|---|
Position | Where this step ends (for a crossing: where the player arrives). |
From | For a crossing: where to stand to use it. For a plain step: the previous waypoint. |
Kind | PathStepKind, below. |
IsCrossing | True for anything but Walk, Door, Decontamination. |
CrossingReady | Can the crossing be used right now? Only the Airship platform ever says no: it carries from the end it stands at, and only while free. Code that moves a walker by itself should wait at From until this is true. |
| PathStepKind | How the walker gets there |
|---|---|
Walk | Straight line (already checked for walls). |
Door | A shut door the route goes through: open it (or wait), then walk on. |
Decontamination | A chamber door: call the chamber, wait for the cycle. |
Ladder | Climb: stand at From, arrive at Position. |
Zipline | Fungle zipline. |
MovingPlatform | Airship platform. |
Vent | One or more vent hops (merged into one point). |
Elevator | Submerged elevator. |
Custom | A crossing another mod registered. |
Extension methods on PlayerControl that walk a route: plan, follow, notice trouble (stuck, a door that closed, a crossing that failed) and plan again.
| Call | |
|---|---|
IEnumerator CoMoveTo(this PlayerControl player, Vector2 goal, Action<PathMovementResult> done, PathOptions? options = null, PathMovementSettings? settings = null) | Plans a route from where the player stands, then walks it. done runs exactly once. |
IEnumerator FollowPath(this PlayerControl player, PathResult path, Action<PathMovementResult> done, PathMovementSettings? settings = null) | Walks a route you already planned. Does not re-plan when blocked. |
void MoveTo(...), void Follow(...) | The same two, already started. |
Rules the walker follows:
player.AmOwner). Anything else ends at once with PlayerUnavailable.MaxReplans times (default 2) when blocked, a crossing fails, or a door will not open. Only CoMoveTo re-plans; FollowPath stops.| Member | |
|---|---|
Status | Arrived, Blocked (not at the goal and not moving), PathNotFound, CrossingFailed, DoorTimeout, TimedOut, Cancelled, PlayerUnavailable. |
Arrived | Shortcut for Status == Arrived. |
Path, StoppedAt, StoppedAtIndex, Message | The route used, where and at which waypoint it stopped, and why. |
PathMovementSettings.Default is a fresh copy of the host's walker defaults.
| Property | Default | |
|---|---|---|
WaypointTolerance | 0.2 | How close counts as being at a waypoint. |
FinalTolerance | 0.15 | How close counts as arrived. |
StuckSeconds | 2.5 | Seconds without progress before it nudges, then gives up or re-plans. |
StuckDistance | 0.06 | How far it must move within StuckSeconds to count as progress. |
DoorTimeoutSeconds | 15 | How long a shut door or decontamination cycle may take. |
CrossingTimeoutSeconds | 12 | How long a ladder, zipline, platform, vent hop or elevator may take. |
MaxSeconds | 180 | Hard limit for the whole movement (0 = none). |
MaxReplans | 2 | Re-plans when blocked. |
Teach routes about a crossing your mod adds (a teleporter, a trapdoor...). Routes then use it like any other.
NavLink link = NavLinks.Register(
from: pointA, to: pointB, cost: 6f,
traverse: player => MyCrossing(player), // a coroutine that carries the player from A to B
isAvailable: () => teleporterIsOn, // optional: when false, routes skip it
bothWays: false);
NavLinks.Remove(link); // when it goes away
Links are kept across grid rebuilds until removed. cost is distance-like (roughly: how many units of walking it is worth). The walker runs traverse when it reaches from. Such points have Kind == Custom.
| Call | |
|---|---|
MapPathfinding.ClosedDoorAhead(Vector2 from, Vector2 to, float lookAhead = 1.2f) | Is a shut door on the straight line, within the first lookAhead units? For walkers that moved on their own after planning. |
MapPathfinding.IsDoorClosedAt(Vector2 position) | Is the door covering this spot shut right now? |
MapPathfinding.OpenDoorAt(Vector2 position) | Asks the shut door at this spot to open, as a player click does. Only doors a player can open by hand react; returns whether a request was sent. |
MapPathfinding.CallDecontamination(Vector2 position) | Calls the nearest decontamination chamber the way its console does; works out outside vs inside from where you stand. |
MapPathfinding.NearestFloor(Vector2 position, int maxRadiusCells = 60) | The nearest ordinary floor (walkable, not in a ladder shaft, not in a shut door), or null. For putting a stuck walker back on its feet. |
The original, simpler calls keep working exactly as before:
| Call | |
|---|---|
List<Vector2>? FindPath(Vector2 start, Vector2 end, bool allowDiagonals = true) | A walking route (no crossings), or null. |
GetRandomCoordInMap(), GetRandomCoord(), GetRandomCoordNear(origin, radius), GetRandomCoordInMapNear(origin, radius), GetRandomCoordsInMap(count, minSeparation) | Random reachable spots. |
IsWalkable(Vector2) | Is this spot walkable right now? |
RebuildGrid(int mapId), ShowDebugOverlay(), HideDebugOverlay(), ToggleDebugOverlay() | Grid and overlay control. |
Use MapPathfinding when you want crossings, per-route options or door handling; use PathfindingAPI for a quick walking route.
Open the CyberAPI panel and press Navigation > in its header. These are the defaults every route starts from. Only the host can change them; everyone else sees them greyed out. Changes are sent to every player and applied at once; players joining later are brought up to date. The host's values are saved in navigation.txt next to CyberAPI's settings.txt (one Key=Value per line, hand-editable). Touch-friendly: switches and − / + buttons, no typing.
| Setting | Default | Range / values |
|---|---|---|
| Ladders | on | on / off |
| Ziplines | on | on / off |
| Decon Doors | on | on / off |
| Platform | on | on / off |
| Elevators | on | on / off |
| Wait for Doors | off | on / off |
| Auto-Open Doors | off | on / off (opens doors a player can open by hand) |
| Vents | Auto | Auto (follow the player's role) / Always / Never |
| Wall Avoidance | 1.00 | 0 – 3, step 0.25 |
| Waypoint Margin | 0.20 | 0.05 – 1, step 0.05 |
| Stuck Timeout | 2.5 s | 0.5 – 10 s, step 0.5 |
| Door Timeout | 15 s | 3 – 60 s, step 3 |
A mod can still override any of these for one request through PathOptions. Reset on the Navigation page (and the panel's main Reset) restores the defaults.
Press F7 (when the overlay is enabled in the panel) to see the grid. Crossings are painted as ordinary node squares, each kind in a colour used for nothing else, with a thin line between the two ends of a crossing:
| Colour | Means |
|---|---|
| purple | Ladder (cells, shaft, line) |
| brown | Fungle zipline |
| indigo | Airship moving platform |
| light pink | Decontamination door |
| white | Submerged elevator |
| salmon | Link registered by another mod |
| lime / silver box | Submerged upper / lower floor |
Normal doors keep their blue / red cells and green / magenta lines. Vents keep their yellow outline; vent hops are not drawn.
| Map | Crossings |
|---|---|
| The Skeld, MIRA HQ, Polus, Fungle, Airship, Submerged | Vents on every map (when allowed). Doors where the map has them. |
| Airship | Ladders, moving platform, openable doors. |
| Fungle | Ziplines. |
| Mira HQ | Decontamination chambers. |
| Submerged | Elevators (found by name, so a Submerged update can stop them working), and two floors. |
Step() runs a few milliseconds at a time), so a phone keeps drawing while it plans. Prefer CreateRequest/FindPath over FindPathNow there.DoorTimeout).MapPathfinding, PathRequest, PathOptions, PathResult/PathPoint, PlayerNavigation and PathMovementSettings.NavLinks.Register for your own.navigation.txt.PathOptions (WithoutVents(), WithAutoOpenDoors()...), and PathOptions.WalkOnly.ClosedDoorAhead, IsDoorClosedAt, OpenDoorAt), CallDecontamination, NearestFloor, PathPoint.CrossingReady.AutoOpenDoors opens only doors a player can open by hand and no longer implies WaitForDoors.PathfindingAPI call.