Table of Contents

Class WaypointTravel

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Moves a player character to a waypoint, after every check the move depends on.

public static class WaypointTravel
Inheritance
WaypointTravel
Inherited Members

Remarks

One routine for every caller — the map request handler and the ECA teleport action — so the rules cannot drift between them. The rules themselves are in Decide(bool, bool, bool, bool, bool, in WaypointTravelOptions), a pure function over the answers, so the truth table is testable without a scene.

Server only. The position write is the same primitive respawn and cross-scene arrival use (KinematicCharacterMotor.SetPositionAndRotationAndVelocity); the owner's client learns of it through the next reconcile, exactly as it does for a respawn.

Methods

Decide(bool, bool, bool, bool, bool, in WaypointTravelOptions)

The rules, as a pure function of the facts.

public static WaypointTravelRefusalReason Decide(bool canAct, bool inCombat, bool sameScene, bool unlocked, bool conditionsMet, in WaypointTravelOptions options)

Parameters

canAct bool

Whether the traveller may act at all (alive, loaded, not mid-transfer, not incapacitated).

inCombat bool

Whether the traveller is flagged in combat.

sameScene bool

Whether the waypoint stands in the traveller's own scene instance.

unlocked bool

Whether the traveller has discovered the waypoint.

conditionsMet bool

Whether the waypoint's travel conditions pass for the traveller.

options WaypointTravelOptions

Which rules apply.

Returns

WaypointTravelRefusalReason

None when travel is permitted, else why not.

TryTravel(IPlayerCharacter, IWaypoint, in WaypointTravelOptions, out WaypointTravelRefusalReason)

Checks and, if permitted, performs the move.

public static bool TryTravel(IPlayerCharacter player, IWaypoint waypoint, in WaypointTravelOptions options, out WaypointTravelRefusalReason reason)

Parameters

player IPlayerCharacter

The traveller.

waypoint IWaypoint

The destination, resolved by the caller from the live registry.

options WaypointTravelOptions

Which rules apply.

reason WaypointTravelRefusalReason

Why travel was refused, or None.

Returns

bool

True when the character was moved.