Interface IWaypointController
The set of waypoints a character has discovered, keyed by scene, and the events the waypoint system raises around it.
public interface IWaypointController : ICharacterBehaviour
- Inherited Members
Remarks
Discovery is server-authoritative. The server unlocks a waypoint when the character interacts with it (or a designer grants it), persists the unlock, and tells the owner; the owner's copy exists so the world map can draw what it knows without asking. Nothing the client holds here is trusted for anything — a fast-travel request is re-checked against the server's copy.
The static events are the seams the rest of the game hangs off: the server's interactable system persists and broadcasts on OnWaypointUnlocked, the client map redraws on it, and the UI plays its sounds on the travel events. They are static because the controller lives on the character and the systems that care outlive any character.
Fields
OnWaypointMapRequested
Raised on the owner client when the server asks the map to open on a waypoint — the response to interacting with a waypoint the character had already discovered.
Parameters: the character, the scene name, the waypoint index.
public static Action<ICharacter, string, int> OnWaypointMapRequested
Field Value
OnWaypointTravelRefused
Raised on the owner client when the server declines a fast-travel request.
Parameters: the character, the scene name, the waypoint index, the reason.
public static Action<ICharacter, string, int, WaypointTravelRefusalReason> OnWaypointTravelRefused
Field Value
OnWaypointTravelled
Raised after a character has been moved to a waypoint. Server: from the travel routine. Owner client: when the server's confirmation arrives.
Parameters: the character, the scene name, the waypoint index.
public static Action<ICharacter, string, int> OnWaypointTravelled
Field Value
OnWaypointUnlocked
Raised when a waypoint becomes unlocked for a character. On the server this fires from the unlock itself; on the owner client it fires when the server's notification arrives.
Parameters: the character, the scene name, the waypoint index.
public static Action<ICharacter, string, int> OnWaypointUnlocked
Field Value
Properties
UnlockedScenes
Every scene the character has at least one unlocked waypoint in.
IReadOnlyCollection<string> UnlockedScenes { get; }
Property Value
Methods
CollectDirtyPages(List<WaypointPageSnapshot>)
The bits unlocked since the database last confirmed them, grouped per scene page, so the save path can write only what changed.
void CollectDirtyPages(List<WaypointPageSnapshot> results)
Parameters
resultsList<WaypointPageSnapshot>Receives one entry per page with unwritten bits.
IsUnlocked(string, int)
Whether the character has discovered a waypoint.
bool IsUnlocked(string sceneName, int waypointIndex)
Parameters
sceneNamestringThe scene the waypoint stands in.
waypointIndexintThe waypoint's authored index within that scene.
Returns
MarkPersisted(string, int, ulong)
Records that a page's bits reached the database, so they are no longer dirty.
void MarkPersisted(string sceneName, int page, ulong writtenMask)
Parameters
sceneNamestringThe scene the page belongs to.
pageintWhich page.
writtenMaskulongThe bits the database confirmed.
Remarks
The bits are OR-ed into the confirmed set rather than replacing it. The database write is itself an OR-merge, so any bit that was written is durable regardless of what else was unlocked while the write was in flight — those later bits stay dirty on their own and go out with the next save. No version counter is needed for that; the mask is its own version.
Restore(string, int, ulong)
Installs a persisted page of unlock bits without raising events or dirtying anything. The load path, and the owner client's spawn payload.
void Restore(string sceneName, int page, ulong mask)
Parameters
sceneNamestringThe scene the page belongs to.
pageintWhich 64-waypoint page of the scene.
maskulongThe unlocked bits of that page.
Unlock(string, int)
Marks a waypoint as discovered and raises OnWaypointUnlocked when it was not already.
bool Unlock(string sceneName, int waypointIndex)
Parameters
sceneNamestringThe scene the waypoint stands in.
waypointIndexintThe waypoint's authored index within that scene.
Returns
- bool
True when the waypoint was newly unlocked; false when it already was, or the arguments were invalid.