Class WaypointTravel
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
canActboolWhether the traveller may act at all (alive, loaded, not mid-transfer, not incapacitated).
inCombatboolWhether the traveller is flagged in combat.
sameSceneboolWhether the waypoint stands in the traveller's own scene instance.
unlockedboolWhether the traveller has discovered the waypoint.
conditionsMetboolWhether the waypoint's travel conditions pass for the traveller.
optionsWaypointTravelOptionsWhich 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
playerIPlayerCharacterThe traveller.
waypointIWaypointThe destination, resolved by the caller from the live registry.
optionsWaypointTravelOptionsWhich rules apply.
reasonWaypointTravelRefusalReasonWhy travel was refused, or None.
Returns
- bool
True when the character was moved.