Struct WaypointTravelPolicy
The game-wide rule for where a player may fast travel from: when RequireNearbyWaypoint is on, only from within NearbyRange of a waypoint they have discovered in the same scene instance (issue #253). Off, the map's travel button works from anywhere.
public readonly struct WaypointTravelPolicy
- Inherited Members
Remarks
Where it is set. The server's InteractableSystem asset owns the values and
installs them in Server when it initialises; the travel request reads them from
there. The owner client is told the server's values in the WaypointController
spawn payload, so the map can grey out its button and say why rather than send a request
that will be refused. The client's copy is a hint only — the server re-checks every request.
What counts as the origin. Any live waypoint in the traveller's scene instance, including the destination itself, measured from the waypoint's own transform (the position the map cache bakes). It must be one the traveller has discovered whenever the request also requires the destination to be discovered: a player standing at a stone they never activated has not "used" it. Interacting with a waypoint discovers it, so in play this costs nothing.
Who it binds. The player's own map request. Designer-authored moves (TeleportToWaypointAction — a town-portal item, a quest return) are exempt: being usable away from a waypoint is their point.
Constructors
WaypointTravelPolicy(bool, float)
public WaypointTravelPolicy(bool requireNearbyWaypoint, float nearbyRange)
Parameters
Fields
Default
The rule as shipped.
public static readonly WaypointTravelPolicy Default
Field Value
DefaultNearbyRange
The shipped origin radius, in metres. A waypoint's interaction range is 3.5 m and using the waypoint is how the travel map opens; the remainder is room to step back from the stone, and for the server's copy of the character lagging the client's.
public const float DefaultNearbyRange = 10
Field Value
DefaultRequireNearbyWaypoint
The shipped default: fast travel only from a waypoint.
public const bool DefaultRequireNearbyWaypoint = true
Field Value
MaximumNearbyRange
The ceiling for a configured radius. Past this the rule is no longer "at a waypoint"; turn it off instead.
public const float MaximumNearbyRange = 500
Field Value
MinimumNearbyRange
The floor for a configured radius. Below a character's own width nothing would ever qualify.
public const float MinimumNearbyRange = 1
Field Value
NearbyRange
How near, in metres. Clamped to [MinimumNearbyRange, MaximumNearbyRange].
public readonly float NearbyRange
Field Value
RequireNearbyWaypoint
Refuse a player's travel request unless they stand near a discovered waypoint.
public readonly bool RequireNearbyWaypoint
Field Value
Properties
Server
The rule this server process enforces. Installed by the interactable system at initialisation and restored to Default when it shuts down. Server only; a client reads TravelPolicy instead.
public static WaypointTravelPolicy Server { get; set; }
Property Value
Methods
ClampRange(float)
Brings a configured radius into range. NaN and infinities, which a hand-edited asset or a corrupt payload can carry, become the default rather than a comparison that is always false.
public static float ClampRange(float range)
Parameters
rangefloat
Returns
IsSatisfiedBy(WorldSceneDetails, string, IWaypointController, Vector3)
The client's form of the check: whether traveller stands near a
waypoint of the map cache's scene that controller has discovered.
Always true when the rule is off.
public bool IsSatisfiedBy(WorldSceneDetails details, string sceneName, IWaypointController controller, Vector3 traveller)
Parameters
detailsWorldSceneDetailsThe cached scene the character is in.
sceneNamestringThe instance-aware scene name the record is keyed by.
controllerIWaypointControllerThe traveller's discovery record.
travellerVector3The traveller's position.
Returns
IsWithinRange(Vector3, Vector3)
True when waypoint is within NearbyRange of traveller. Inclusive.
public bool IsWithinRange(Vector3 traveller, Vector3 waypoint)
Parameters
travellerVector3waypointVector3