Table of Contents

Class WaypointController

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Holds the waypoints a character has discovered, per scene, and moves them between the server and the owner client.

public class WaypointController : CharacterBehaviour, IWaypointController, ICharacterBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
NetworkBehaviour
WaypointController
Implements
Inherited Members
NetworkBehaviour.IsSpawned
NetworkBehaviour.ComponentIndex
NetworkBehaviour.NetworkObject
NetworkBehaviour.MAXIMUM_NETWORKBEHAVIOURS
NetworkBehaviour.UNSET_NETWORKBEHAVIOUR_ID
NetworkBehaviour.ToString()
NetworkBehaviour.Reset()
NetworkBehaviour.OnValidate()
NetworkBehaviour.IsBehaviourReconciling
NetworkBehaviour.ClearReplicateCache()
NetworkBehaviour.CreateReconcile()
NetworkBehaviour.Reconcile_Reader<T>(PooledReader, ref T)
NetworkBehaviour.OnStartServerCalled
NetworkBehaviour.OnStartClientCalled
NetworkBehaviour.OnStartNetwork()
NetworkBehaviour.OnStopNetwork()
NetworkBehaviour.OnStartServer()
NetworkBehaviour.OnStopServer()
NetworkBehaviour.OnOwnershipServer(NetworkConnection)
NetworkBehaviour.OnSpawnServer(NetworkConnection)
NetworkBehaviour.OnDespawnServer(NetworkConnection)
NetworkBehaviour.OnStartClient()
NetworkBehaviour.OnStopClient()
NetworkBehaviour.OnOwnershipClient(NetworkConnection)
NetworkBehaviour.ClearBuffedRpcs()
NetworkBehaviour.ExcludeOwnerFromUnbufferedObserversRpcs
NetworkBehaviour.IsClientOnly
NetworkBehaviour.IsServerOnly
NetworkBehaviour.IsHost
NetworkBehaviour.IsClient
NetworkBehaviour.IsServer
NetworkBehaviour.IsDeinitializing
NetworkBehaviour.NetworkManager
NetworkBehaviour.ServerManager
NetworkBehaviour.ClientManager
NetworkBehaviour.ObserverManager
NetworkBehaviour.TransportManager
NetworkBehaviour.TimeManager
NetworkBehaviour.SceneManager
NetworkBehaviour.PredictionManager
NetworkBehaviour.RollbackManager
NetworkBehaviour.NetworkObserver
NetworkBehaviour.IsClientInitialized
NetworkBehaviour.IsClientStarted
NetworkBehaviour.IsClientOnlyInitialized
NetworkBehaviour.IsClientOnlyStarted
NetworkBehaviour.IsServerInitialized
NetworkBehaviour.IsServerStarted
NetworkBehaviour.IsServerOnlyInitialized
NetworkBehaviour.IsServerOnlyStarted
NetworkBehaviour.IsHostInitialized
NetworkBehaviour.IsHostStarted
NetworkBehaviour.IsOffline
NetworkBehaviour.IsNetworked
NetworkBehaviour.GetIsNetworked()
NetworkBehaviour.IsManagerReconciling
NetworkBehaviour.Observers
NetworkBehaviour.IsOwner
NetworkBehaviour.IsController
NetworkBehaviour.HasAuthority
NetworkBehaviour.Owner
NetworkBehaviour.OwnerId
NetworkBehaviour.ObjectId
NetworkBehaviour.LocalConnection
NetworkBehaviour.OwnerMatches(NetworkConnection)
NetworkBehaviour.Despawn(GameObject, DespawnType?)
NetworkBehaviour.Despawn(NetworkObject, DespawnType?)
NetworkBehaviour.Despawn(DespawnType?)
NetworkBehaviour.Spawn(GameObject, NetworkConnection, Scene)
NetworkBehaviour.Spawn(NetworkObject, NetworkConnection, Scene)
NetworkBehaviour.RemoveOwnership()
NetworkBehaviour.GiveOwnership(NetworkConnection)
NetworkBehaviour.GetInstance<T>()
NetworkBehaviour.TryRegisterInstance<T>(T)
NetworkBehaviour.UnregisterInstance<T>()
NetworkBehaviour.CanLog(LoggingType)
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(TagHandle)
Component.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.name
Object.hideFlags

Remarks

Server. Unlock(string, int) is called by UnlockWaypointAction and GrantWaypointAction; it raises OnWaypointUnlocked, which the interactable system answers by persisting the page and telling the owner. The load path installs rows through Restore(string, int, ulong); the save path drains CollectDirtyPages(List<WaypointPageSnapshot>) and confirms with MarkPersisted(string, int, ulong).

Owner client. The spawn payload carries the whole record (owner only — an observer is written an empty block, since which towns a stranger has visited is nobody's business), and WaypointUnlockedBroadcast keeps it current. The three other travel broadcasts are turned into the static events the map listens to.

Framing. FishNet packs every behaviour's spawn payload into one buffer with no per-behaviour framing, so the block is length-prefixed and the reader seeks to its end on any disagreement rather than returning early. See FactionController.ReadPayload.

Properties

UnlockedScenes

Every scene the character has at least one unlocked waypoint in.

public IReadOnlyCollection<string> UnlockedScenes { get; }

Property Value

IReadOnlyCollection<string>

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.

public void CollectDirtyPages(List<WaypointPageSnapshot> results)

Parameters

results List<WaypointPageSnapshot>

Receives one entry per page with unwritten bits.

CountUnlocked()

Number of unlocked waypoints across every scene. Diagnostics and tests.

public int CountUnlocked()

Returns

int

IsUnlocked(string, int)

Whether the character has discovered a waypoint.

public bool IsUnlocked(string sceneName, int waypointIndex)

Parameters

sceneName string

The scene the waypoint stands in.

waypointIndex int

The waypoint's authored index within that scene.

Returns

bool

MarkPersisted(string, int, ulong)

Records that a page's bits reached the database, so they are no longer dirty.

public void MarkPersisted(string sceneName, int page, ulong writtenMask)

Parameters

sceneName string

The scene the page belongs to.

page int

Which page.

writtenMask ulong

The 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.

OnStartCharacter()

Registers the owner-only broadcasts that keep the record current and surface the travel results.

public override void OnStartCharacter()

OnStopCharacter()

Unregisters the broadcasts. Symmetric with OnStartCharacter() — a pooled respawn re-runs it, and an unmatched register would stack handlers per respawn.

public override void OnStopCharacter()

ReadPayload(NetworkConnection, Reader)

Called before network start callbacks, but after the object is initialized with network values. This may be used to read information from predicted spawning, or simply have values set before initialization without depending on SyncTypes.

public override void ReadPayload(NetworkConnection conn, Reader reader)

Parameters

conn NetworkConnection
reader Reader

ResetState(bool)

Clears the record. The object is pooled; a respawned character must not inherit the previous occupant's discoveries.

public override void ResetState(bool asServer)

Parameters

asServer bool

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.

public void Restore(string sceneName, int page, ulong mask)

Parameters

sceneName string

The scene the page belongs to.

page int

Which 64-waypoint page of the scene.

mask ulong

The unlocked bits of that page.

Unlock(string, int)

Marks a waypoint as discovered and raises OnWaypointUnlocked when it was not already.

public bool Unlock(string sceneName, int waypointIndex)

Parameters

sceneName string

The scene the waypoint stands in.

waypointIndex int

The 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.

WritePayload(NetworkConnection, Writer)

Called when writing a spawn. This may be used to deliver information for predicted spawning, or simply have values set before initialization without depending on SyncTypes.

public override void WritePayload(NetworkConnection conn, Writer writer)

Parameters

conn NetworkConnection
writer Writer